Skip to main content
client_python
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage
Edit page

Instrumenting

Six metric types are available. Pick based on what your value does:

TypeUpdate modelUse for
Counteronly uprequests served, errors, bytes sent
Gaugeup and downqueue depth, active connections, memory usage
Histogramobservations in bucketsrequest latency, request size — when you need quantiles in queries
Summaryobservations (count + sum)request latency, request size — when average is enough
Infostatic key-value pairsbuild version, environment metadata
Enumone of N statestask state, lifecycle phase

See the Prometheus documentation on metric types and instrumentation best practices for deeper guidance on choosing between Histogram and Summary.

Disabling _created metrics

By default counters, histograms, and summaries export an additional series suffixed with _created and a value of the unix timestamp for when the metric was created. If this information is not helpful, it can be disabled by setting the environment variable PROMETHEUS_DISABLE_CREATED_SERIES=True or in code:

from prometheus_client import disable_created_metrics
disable_created_metrics()