# class Prometheus::Counter

- Prometheus::Counter
- Prometheus::Metric
- Reference
- Object

##
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:

- Number of requests served
- Number of tasks completed
- Number of errors

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

- #collect : Array(Sample)
- #inc(value : Number = 1)
- #type : String
- #value : Float64

### 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 #