# abstract class Prometheus::Metric

- Prometheus::Metric
- Reference
- Object

##
Overview

Base class for all metric types (Counter, Gauge, Histogram, Summary).

This abstract class defines the common interface and behavior for all metrics:

- Each metric has a name, help text, and optional labels
- Names must match the regex `[a-zA-Z_:][a-zA-Z0-9_:]*`
- Each metric type must implement `#type` and `#collect` methods

Metric implementations should be thread-safe and handle concurrent access appropriately.

##
Direct Known Subclasses

- Prometheus::Counter
- Prometheus::Gauge
- Prometheus::Histogram
- Prometheus::Summary

##
Defined in:

types.cr

##
Constructors

- .new(name : String, help : String, labels : Prometheus::LabelSet = LabelSet.new)

##
Instance Method Summary

- #collect : Array(Sample)
- #help : String
- #labels : LabelSet
- #name : String
- #type : String

##
Constructor Detail

def self.new(name : String, help : String, labels : Prometheus::LabelSet = LabelSet.new) #

##
Instance Method Detail

abstract def collect : Array(Sample) #
def help : String #
def labels : LabelSet #
def name : String #
abstract def type : String #