class Prometheus::Gauge

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:

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.cr

Instance Method Summary

Instance methods inherited from class Prometheus::Metric

collect(io : IO) : Nil
collect : 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

Instance Method Detail

def dec(value : Number = 1, labels : Labels | Nil = nil) #

def inc(value : Number = 1, labels : Labels | Nil = nil) #

def set(value : Number, labels : Labels | Nil = nil) #

def type : String #

def value(labels : Labels | Nil = nil) : Float64 #