Creates a new Histogram.
Configuration object.
Optionalbuckets?: number[]Optional bucket thresholds (default: []). +Inf always added.
Optionaldescription?: stringOptional description.
Optionallabels?: Record<string, string>Optional default labels.
Metric name.
Optional ReadonlydescriptionOptional metric description (used in # HELP).
Optional ReadonlylabelsDefault labels applied to all samples of this metric.
ReadonlynameThe sanitized metric name.
ReadonlytypeThe Prometheus metric type.
Observes a value, updating buckets, sum, and count.
The observed value.
Alias for observe().
The observed value.
Resets all bucket counts, sum, and total count to zero.
Serializes the metric to Prometheus exposition format.
A Promise resolving to the serialized string.
StaticcleanSanitizes a metric name by removing or replacing invalid characters.
Prometheus metric names must match [a-zA-Z_:][a-zA-Z0-9_:]* This removes hyphens, parens; replaces slashes and spaces with underscores.
Optionalinput: stringThe raw metric name.
The cleaned metric name.
StaticconcatConcatenates multiple metrics into a single exposition string.
used to set the metric type
The metrics to serialize.
A Promise resolving to the combined string.
StaticlabelConverts a label object to a Prometheus label string (e.g., {foo="bar"}).
Optionallabels: Record<string, string | number>The label key-value pairs.
The formatted label string.
A Prometheus Histogram metric. Counts observations in configurable buckets and provides sum + count.
Example