@ogcio/o11y-sdk-node
Version:
Opentelemetry standard instrumentation SDK for NodeJS based project
19 lines (18 loc) • 884 B
TypeScript
import { Counter, Gauge, Histogram, MetricOptions, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, Attributes } from "@opentelemetry/api";
type MetricTypeMap<TAttributes extends Attributes> = {
counter: Counter<TAttributes>;
histogram: Histogram<TAttributes>;
gauge: Gauge<TAttributes>;
updowncounter: UpDownCounter<TAttributes>;
"async-counter": ObservableCounter<TAttributes>;
"async-updowncounter": ObservableUpDownCounter<TAttributes>;
"async-gauge": ObservableGauge<TAttributes>;
};
export type MetricType = keyof MetricTypeMap<Attributes>;
export interface MetricsParams {
meterName: string;
metricName: string;
options?: MetricOptions;
}
export declare function getMetric<T extends MetricType, TAttributes extends Attributes = Attributes>(type: T, p: MetricsParams): MetricTypeMap<TAttributes>[T];
export {};