From b6ed318268ecdeafe60894898108ac0eb90bedbb Mon Sep 17 00:00:00 2001 From: Cayman Date: Thu, 10 Aug 2023 10:12:30 -0400 Subject: [PATCH] fix: export supporting metrics types --- src/metrics.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/metrics.ts b/src/metrics.ts index 6dcc6dd7..6f585fff 100644 --- a/src/metrics.ts +++ b/src/metrics.ts @@ -22,7 +22,7 @@ export enum MessageSource { type LabelsGeneric = Record type CollectFn = (metric: Gauge) => void -interface Gauge { +export interface Gauge { // Sorry for this mess, `prom-client` API choices are not great // If the function signature was `inc(value: number, labels?: Labels)`, this would be simpler inc(value?: number): void @@ -36,7 +36,7 @@ interface Gauge { addCollect(collectFn: CollectFn): void } -interface Histogram { +export interface Histogram { startTimer(): () => void observe(value: number): void @@ -46,26 +46,26 @@ interface Histogram { reset(): void } -interface AvgMinMax { +export interface AvgMinMax { set(values: number[]): void set(labels: Labels, values: number[]): void set(arg1?: Labels | number[], arg2?: number[]): void } -type GaugeConfig = { +export type GaugeConfig = { name: string help: string labelNames?: keyof Labels extends string ? (keyof Labels)[] : undefined } -type HistogramConfig = { +export type HistogramConfig = { name: string help: string labelNames?: (keyof Labels)[] buckets?: number[] } -type AvgMinMaxConfig = GaugeConfig +export type AvgMinMaxConfig = GaugeConfig export interface MetricsRegister { gauge(config: GaugeConfig): Gauge