Metrics¶
metrics
¶
Pluggable metrics hooks for the Durable Workflow client and worker.
Pass any :class:MetricsRecorder implementation as metrics= on
:class:~durable_workflow.Client or :class:~durable_workflow.Worker. The
SDK ships three recorders out of the box: :class:NoopMetrics (the default),
:class:InMemoryMetrics for tests and small exporter loops, and
:class:PrometheusMetrics which forwards to the optional prometheus-client
package. Custom recorders implement two methods — :meth:MetricsRecorder.increment
and :meth:MetricsRecorder.record — and receive stable metric names and tag
dicts defined as module-level constants in this file.
MetricsRecorder
¶
NoopMetrics
¶
InMemoryMetrics
dataclass
¶
Simple recorder useful for tests and custom exporter loops.
increment
¶
Accumulate into an in-memory counter keyed by name + sorted tags.
record
¶
Append an observation to an in-memory histogram keyed by name + sorted tags.
counter_value
¶
Return the current value of a counter, or 0.0 if it has never been incremented.
observations
¶
Return a copy of the histogram observations recorded under name + tags.