Creates a new Counter.
Configuration object.
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.
Increments the counter by a given value (convenience alias). Note: Since Counter uses a reader, this is just documentation — actual increment must be handled in the reader function or external state.
Amount to increment by (default: 1).
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 Counter metric. Represents a cumulative metric that only increases.
Example