ObservabilityConfig class
Observability switches, configured once at bus construction.
The default is completely off: no counters, no timestamps and no allocation on the hot path. When enabled is true, metrics controls the metric counters; tracing is reserved for span exporters and does not affect metrics.
Constructors
- ObservabilityConfig({bool enabled = false, bool metrics = true, bool tracing = false, double sampleRate = 1.0, int cardinalityLimit = 1000, bool capturePayloads = false, MetricKeyBuilder? metricKeyBuilder})
-
const
Properties
- capturePayloads → bool
-
Attach the event to EventBusError.event. Off by default: errors carry no
payload unless the application asks for it.
final
- cardinalityLimit → int
-
The maximum number of distinct metric keys; the rest go to
__other__.final - enabled → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- metricKeyBuilder → MetricKeyBuilder?
-
Overrides the metric key; null means the event type token.
final
- metrics → bool
-
Collect counters and latency samples. Only meaningful when enabled.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampleRate → double
-
The fraction of latency samples to record (1.0 records every sample).
Counters are always exact.
final
- tracing → bool
-
Reserved for tracing exporters; metrics never depend on it.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- disabled → const ObservabilityConfig
- The default: nothing is collected.