@@ -182,6 +182,38 @@ export type Metric<T extends string = NoLabelNameType> =
182182 | Summary < T >
183183 | Histogram < T > ;
184184
185+ declare abstract class AbstractMetric {
186+ /**
187+ * The name of the metric.
188+ */
189+ readonly name : string ;
190+
191+ /**
192+ * The help text of the metric.
193+ */
194+ readonly help : string ;
195+
196+ /**
197+ * List of registers attached to the metric.
198+ */
199+ readonly registers : readonly Registry [ ] ;
200+
201+ /**
202+ * List of label names attached to the metric.
203+ */
204+ readonly labelNames : readonly string [ ] ;
205+
206+ /**
207+ * The aggregation method used for aggregating this metric in a Node.js cluster.
208+ */
209+ readonly aggregator : Aggregator ;
210+
211+ /**
212+ * If provided, the collect function of the metric, which is invoked on each scrape.
213+ */
214+ readonly collect ?: CollectFunction < this> ;
215+ }
216+
185217/**
186218 * Aggregation methods, used for aggregating metrics in a Node.js cluster.
187219 */
@@ -255,7 +287,9 @@ export interface ObserveDataWithExemplar<T extends string> {
255287/**
256288 * A counter is a cumulative metric that represents a single numerical value that only ever goes up
257289 */
258- export class Counter < T extends string = NoLabelNameType > {
290+ export class Counter <
291+ T extends string = NoLabelNameType ,
292+ > extends AbstractMetric {
259293 /**
260294 * @param configuration Configuration when creating a Counter metric. Name and Help is required.
261295 */
@@ -335,7 +369,7 @@ export interface GaugeConfiguration<T extends string>
335369/**
336370 * A gauge is a metric that represents a single numerical value that can arbitrarily go up and down.
337371 */
338- export class Gauge < T extends string = NoLabelNameType > {
372+ export class Gauge < T extends string = NoLabelNameType > extends AbstractMetric {
339373 /**
340374 * @param configuration Configuration when creating a Gauge metric. Name and Help is mandatory
341375 */
@@ -476,7 +510,9 @@ export interface HistogramConfiguration<T extends string>
476510/**
477511 * A histogram samples observations (usually things like request durations or response sizes) and counts them in configurable buckets
478512 */
479- export class Histogram < T extends string = NoLabelNameType > {
513+ export class Histogram <
514+ T extends string = NoLabelNameType ,
515+ > extends AbstractMetric {
480516 /**
481517 * @param configuration Configuration when creating the Histogram. Name and Help is mandatory
482518 */
@@ -602,7 +638,9 @@ export interface SummaryConfiguration<T extends string>
602638/**
603639 * A summary samples observations
604640 */
605- export class Summary < T extends string = NoLabelNameType > {
641+ export class Summary <
642+ T extends string = NoLabelNameType ,
643+ > extends AbstractMetric {
606644 /**
607645 * @param configuration Configuration when creating Summary metric. Name and Help is mandatory
608646 */
0 commit comments