class
Prometheus::Gauge
- Prometheus::Gauge
- Prometheus::Metric
- Reference
- Object
Overview
A Gauge is a metric that represents a single numerical value that can arbitrarily go up and down.
Use a Gauge for metrics that can increase and decrease, such as:
- Current memory usage
- Number of items in a queue
- Number of active connections
Example:
gauge = Gauge.new("cpu_usage", "CPU usage percentage")
gauge.set(45.2) # Set to specific value
gauge.inc(5) # Increase by 5
gauge.dec(3) # Decrease by 3
Defined in:
metrics.crInstance Method Summary
- #dec(value : Number = 1, labels : Labels | Nil = nil)
- #inc(value : Number = 1, labels : Labels | Nil = nil)
- #set(value : Number, labels : Labels | Nil = nil)
- #type : String
- #value(labels : Labels | Nil = nil) : Float64
Instance methods inherited from class Prometheus::Metric
collect(io : IO) : Nilcollect : Array(Sample) collect, help : String help, labels : LabelSet labels, name : String name, type : String type
Constructor methods inherited from class Prometheus::Metric
new(name : String, help : String, labels : Hash(String, String) = nil)new(name : String, help : String, labels : Prometheus::LabelSet = LabelSet.new) new