client_python
prometheus.github.io › client_python › instrumenting › gauge
Gauge | client_python
April 24, 2026 - A Gauge tracks a value that can go up and down. Use it for things you sample at a point in time — active connections, queue depth, memory usage, temperature. from prometheus_client import Gauge g = Gauge('my_inprogress_requests', 'Description of gauge') g.inc() # Increment by 1 g.dec(10) ...
HexDocs
hexdocs.pm › prometheus_ex › Prometheus.Metric.Gauge.html
Prometheus.Metric.Gauge — Prometheus.ex v5.1.0
Resets the value of the gauge identified by spec. Raises Prometheus.UnknownMetricError exception if a gauge for spec can't be found.<br> Raises Prometheus.InvalidMetricArityError exception if labels count mismatch. Sets the gauge identified by spec to value.
question about initial gauge/counter values
ok (r@turbot)9> prometheus_gauge:reset("name"). true (r@turbot)10> prometheus_gauge:value("name"). 0 · I expected the metric to be created with the default value, and also that reset would always work. More on github.com
Avoid reading zero values after a restart
There's no way to make Prometheus wait. Even if you could, if 0 is a valid value as you say then how would Prometheus know if a 0 reading was a "real" one or not? You should ideally handle this in your system being scraped, either by having it set the gauge on startup or by having it retrieve the current value in real-time whenever it is scraped. If for whatever reason neither of those is possible then you should avoid using 0 as the default value if it can also be a "real" value. Use NaN, -1, or something else that's more explicitly invalid, then set your rules up accordingly. More on reddit.com
How to implement Prometheus Gauge Set method in open-telemetry?
Problem Statement A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I'm trying to migrate an project's metric implement from Prometheus to open-telemetry,it heavily use gauge.Set to measure valu... More on github.com
If the metric is a timestamp, should it's name end with epoch or seconds?
The naming conventions suggest the timestamp_seconds suffix. More on reddit.com
OneUptime
oneuptime.com › home › blog › how to create prometheus gauge patterns
How to Create Prometheus Gauge Patterns
January 30, 2026 - Track resource usage as a percentage or absolute value. from prometheus_client import Gauge import psutil cpu_usage = Gauge( 'system_cpu_usage_percent', 'Current CPU usage percentage', ['cpu'] ) memory_usage_percent = Gauge( 'system_memory_usage_percent', 'Current memory usage percentage' ) disk_usage = Gauge( 'system_disk_usage_bytes', 'Current disk usage in bytes', ['mount_point'] ) def collect_system_metrics(): # CPU per core for i, percent in enumerate(psutil.cpu_percent(percpu=True)): cpu_usage.labels(cpu=f'cpu{i}').set(percent) # Memory mem = psutil.virtual_memory() memory_usage_percent.set(mem.percent) # Disk per mount point for partition in psutil.disk_partitions(): usage = psutil.disk_usage(partition.mountpoint) disk_usage.labels(mount_point=partition.mountpoint).set(usage.used)
Mirage
mirage.github.io › prometheus › prometheus › Prometheus › Gauge › index.html
Gauge (prometheus.Prometheus.Gauge)
v_labels ~label_names ~help ~namespace ~subsystem name is a family of metrics with full name namespace_subsystem_name and documentation string help. Each metric in the family will provide a value for each of the labels.
Robust Perception
robustperception.io › how-does-a-prometheus-gauge-work
How does a Prometheus Gauge work? – Robust Perception | Prometheus Monitoring Experts
December 26, 2016 - Gauges can go up and down over time, and scrapes take a snapshot of the current value. There's no potential for messing around with moving averages or resets, as there is with counters. Where Prometheus differs from other other monitoring systems is the API for gauges in instrumentation. The Prometheus Gauge API covers all the gauge uses cases in one place. It has inc, dec, and set methods, plus various utility functions for common uses such as setting the current time.
Jupp0r
jupp0r.github.io › prometheus-cpp › classprometheus_1_1Gauge.html
Prometheus Client Library for Modern C++: prometheus::Gauge Class Reference
A gauge metric to represent a value that can arbitrarily go up and down. The class represents the metric type gauge: https://prometheus.io/docs/concepts/metric_types/#gauge
Call: +32 3 292 56 79
Address: Kruikstraat 22 bus 12, 2060, Antwerp
InfluxData Documentation
docs.influxdata.com › flux › v0 › prometheus › metric-types › gauge
Work with Prometheus gauges - InfluxData Documentation
November 6, 2023 - Use Flux to query and transform Prometheus gauge metrics stored in InfluxDB. A gauge is a metric that represents a single numerical value that can arbitrarily go up and down.
NVIDIA
docs.nvidia.com › metropolis › deepstream › 9.1 › sdk-api › classprometheus_1_1Gauge.html
NVIDIA DeepStream SDK API Reference: prometheus::Gauge Class Reference | NVIDIA Docs
Decrement the gauge by 1. Decrement ... the gauge by 1. Increment the gauge by the given amount. Increment the gauge by the given amount. Set the gauge to the given value....
Prometheus
prometheus.io › docs › concepts › metric_types
Metric types | Prometheus
Gauges are typically used for measured values like temperatures or current memory usage, but also "counts" that can go up and down, like the number of concurrent requests.
Reddit
reddit.com › r/prometheusmonitoring › avoid reading zero values after a restart
r/PrometheusMonitoring on Reddit: Avoid reading zero values after a restart
February 3, 2022 -
Is there a way to avoid reading zero values? This is my problem:
-
Lets say that I have a prometheus
gaugethat I update every few minutes with some numbern. -
Now let's say that I restart my software. Right after restarting, the value of the
gaugewill take a default value0becausenhasn't been set yet. -
Before
nis set, prometheus reads thegaugevalue, which is0 -
Is there way to make prometheus wait until the
gagugevalue is set?
I could also just filter out 0 values, but 0 can be also a valid value.
Top answer 1 of 2
4
There's no way to make Prometheus wait. Even if you could, if 0 is a valid value as you say then how would Prometheus know if a 0 reading was a "real" one or not? You should ideally handle this in your system being scraped, either by having it set the gauge on startup or by having it retrieve the current value in real-time whenever it is scraped. If for whatever reason neither of those is possible then you should avoid using 0 as the default value if it can also be a "real" value. Use NaN, -1, or something else that's more explicitly invalid, then set your rules up accordingly.
2 of 2
2
Set the gauge value before the Prometheus http listener/metrics handler is setup. Or use a function like max_over_time
GitHub
github.com › open-telemetry › opentelemetry-go › issues › 3984
How to implement Prometheus Gauge Set method in open-telemetry? · Issue #3984 · open-telemetry/opentelemetry-go
April 11, 2023 - It have an gauge metric for conn pool stats, defined as: ... On other hand, another library we used only expose an Store method to the user, which is been called when the library want to set a metric to an concrete value (with different labels group), we implement Store use gauge.Set method.
Author: open-telemetry
Google Groups
groups.google.com › g › prometheus-developers › c › zTgIUR7Y-JQ
[python prometheus_client] is Gauge.set guaranteed to always cast as float given value?
I'm considering to use a gauge to reflect the evolution of a boolean value. Knowing that the set method of a Gauge cast the given value as a float, I could call directly my_gauge.set(my_bool_value), and have it set to 0.0 or 1.0.