What metric types does `prometheus_client` provide?
BeginnerConceptTesting, services & metrics
Answer
- Counter: only goes up (resets on restart). Requests served, findings detected. Query with
rate(). - Gauge: goes up and down. Queue depth, in-flight requests, last successful run timestamp.
- Histogram: observations in configurable buckets, plus
_sumand_count. Request latency; aggregatable across instances withhistogram_quantile(). - Summary: client-side quantiles; cheap but cannot be aggregated across instances.
Prefer histograms for latency in anything that runs as more than one replica.
More on Testing, services & metrics
Why should automation scripts have tests at all?BeginnerHow does pytest discover and run tests?BeginnerWhy does pytest use plain `assert` instead of `assertEqual`?BeginnerWhat are pytest fixtures, and what scopes exist?IntermediateWhat built-in fixtures do you use most?IntermediateHow does `@pytest.mark.parametrize` work?Beginner