import { BaseContext } from './base-context.js'; import { Numberish } from './numberish.js'; import { NamedResultDescriptor } from './metadata.js'; import { AggregationConfigSchema, type MetricConfig, MetricConfigSchema, MetricType } from '@sentio/protos'; import { type MessageInitShape } from '@bufbuild/protobuf'; import { MapStateStorage } from '@sentio/runtime'; export type Labels = { [key: string]: string; }; export declare class MetricOptions { unit?: string; description?: string; sparse?: boolean; aggregationConfig?: MessageInitShape; } export declare class CounterOptions { unit?: string; description?: string; sparse?: boolean; resolutionConfig?: { intervalInMinutes: number; }; } export declare class Metric extends NamedResultDescriptor { config: MetricConfig; constructor(type: MetricType, name: string, option?: MessageInitShape); } export declare class MetricState extends MapStateStorage { static INSTANCE: MetricState; getOrRegisterMetric(type: MetricType, name: string, option?: CounterOptions | MetricOptions): Metric; } export declare class Counter extends Metric { static register(name: string, option?: CounterOptions): Counter; /** * internal use only, to create a metric use {@link register} instead */ static _create(name: string, option?: CounterOptions): Counter; protected constructor(name: string, option?: CounterOptions); add(ctx: BaseContext, value: Numberish, labels?: Labels): void; sub(ctx: BaseContext, value: Numberish, labels?: Labels): void; private record; } export declare class CounterBinding { private readonly ctx; private readonly counter; constructor(name: string, ctx: BaseContext); add(value: Numberish, labels?: Labels): void; sub(value: Numberish, labels?: Labels): void; } export declare class Gauge extends Metric { static register(name: string, option?: MetricOptions): Gauge; /** * internal use only, to create a metric use {@link register} instead */ static _create(name: string, option?: MetricOptions): Gauge; protected constructor(name: string, option?: MetricOptions); record(ctx: BaseContext, value: Numberish, labels?: Labels): void; } export declare class GaugeBinding { private readonly gauge; private readonly ctx; constructor(name: string, ctx: BaseContext); record(value: Numberish, labels?: Labels): void; } export declare class Meter { private readonly ctx; constructor(ctx: BaseContext); Counter(name: string): CounterBinding; Gauge(name: string): GaugeBinding; } //# sourceMappingURL=meter.d.ts.map