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 : 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 : Prometheus::LabelSet = LabelSet.new) new

Instance Method Detail

def collect : Array(Sample) #

def inc(value : Number = 1) #

def type : String #

def value : Float64 #