DynamicFlag

zio.blocks.config.DynamicFlag
See theDynamicFlag companion object
abstract class DynamicFlag[A](default: A, defaultExpression: String)(implicit reader: Reader[A])

A flag whose value is determined by a rollout expression that can be updated at runtime.

Each call to apply evaluates the rollout expression against the provided key/attributes and tracks evaluation counters. Use evaluate for evaluation without counter tracking.

Intended to be extended by Scala object definitions:

 object MyFeature extends DynamicFlag[Boolean](false, "true@beta/50%; false")

Resolution order for initial expression: FlagSource → system property → env variable → constructor default.

Attributes

Companion
object
Source
DynamicFlag.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def apply(key: String, attributes: String*): A

Evaluates the rollout expression for the given key and attributes, tracking evaluation counters.

Evaluates the rollout expression for the given key and attributes, tracking evaluation counters.

Attributes

Source
DynamicFlag.scala
def counters: Map[String, Long]

Current evaluation counter snapshot (key → count). Thread-safe but approximate.

Current evaluation counter snapshot (key → count). Thread-safe but approximate.

Attributes

Source
DynamicFlag.scala
def evaluate(key: String, attributes: String*): A

Evaluates the rollout expression without tracking counters.

Evaluates the rollout expression without tracking counters.

Attributes

Source
DynamicFlag.scala
def expression: String

The current rollout expression string.

The current rollout expression string.

Attributes

Source
DynamicFlag.scala
def parseErrorCount: Long

Count of evaluations where a matched rollout value could not be parsed and the call fell back to the flag default. Thread-safe; approximate. A non-zero value indicates misconfigured rollout expressions.

Count of evaluations where a matched rollout value could not be parsed and the call fell back to the flag default. Thread-safe; approximate. A non-zero value indicates misconfigured rollout expressions.

Attributes

Source
DynamicFlag.scala

Attributes

Source
DynamicFlag.scala
def update(newExpression: String): Either[ConfigError, Unit]

Attributes

Source
DynamicFlag.scala

Update history (most recent first), limited to last 10 updates.

Update history (most recent first), limited to last 10 updates.

Attributes

Source
DynamicFlag.scala

Concrete fields

val name: String

Attributes

Source
DynamicFlag.scala