class Prometheus::Counter

Overview

A Counter is a cumulative metric that represents a single monotonically increasing counter whose value can only increase or be reset to zero.

Use a Counter for metrics that accumulate values, such as:

Example:

counter = Counter.new("http_requests_total", "Total HTTP requests")
counter.inc    # Increment by 1
counter.inc(5) # Increment by 5

NOTE Counter values cannot decrease. Use a Gauge for values that can go up and down.

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 inc(value : Number = 1, labels : Labels | Nil = nil) #

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

def type : String #

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