Metrics¶
metrics
¶
Pluggable metrics hooks for the Durable Workflow client and worker.
Pass any MetricsRecorder implementation as metrics= on
Client or Worker. The
SDK ships three recorders out of the box: NoopMetrics (the default),
InMemoryMetrics for tests and small exporter loops, and
PrometheusMetrics which forwards to the optional prometheus-client
package. Custom recorders implement two methods — MetricsRecorder.increment
and MetricsRecorder.record — and receive stable metric names and tag
dicts defined as module-level constants in this file.
MetricsRecorder
¶
NoopMetrics
¶
Default metrics recorder that intentionally drops all observations.
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.