import { BaseContext } from './base-context.js'; import { Numberish } from './numberish.js'; import { NamedResultDescriptor } from './metadata.js'; import { AggregationConfig, MetricConfig, MetricType } from '@sentio/protos'; import { MapStateStorage } from '@sentio/runtime'; export type Labels = { [key: string]: string; }; export declare class MetricOptions { unit?: string; description?: string; sparse?: boolean; aggregationConfig?: Partial; } 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?: MetricConfig); } export declare class MetricState extends MapStateStorage { static INSTANCE: MetricState; getOrRegisterMetric(type: MetricType, name: string, option?: CounterOptions | MetricOptions): Metric; } export declare class MetricStateNew extends MapStateStorage { static INSTANCE: MetricStateNew; 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; } export declare class MeterNew { private readonly ctx; constructor(ctx: BaseContext); Counter(name: string): CounterNewBinding; Gauge(name: string): GaugeNewBinding; } export declare class CounterNew extends Counter { static register(name: string, option?: CounterOptions): CounterNew; /** * internal use only, to create a metric use {@link register} instead */ static _create(name: string, option?: CounterOptions): CounterNew; private constructor(); add(ctx: BaseContext, value: Numberish, labels?: Labels): void; sub(ctx: BaseContext, value: Numberish, labels?: Labels): void; private recordNew; } export declare class GaugeNewBinding { private readonly gauge; private readonly ctx; constructor(name: string, ctx: BaseContext); record(value: Numberish, labels?: Labels): void; } export declare class CounterNewBinding { private readonly counter; private readonly ctx; constructor(name: string, ctx: BaseContext); add(value: Numberish, labels?: Labels): void; sub(value: Numberish, labels?: Labels): void; } export declare class GaugeNew extends Gauge { static register(name: string, option?: MetricOptions): Gauge; /** * internal use only, to create a metric use {@link register} instead */ static _create(name: string, option?: MetricOptions): GaugeNew; private constructor(); record(ctx: BaseContext, value: Numberish, labels?: Labels): void; } //# sourceMappingURL=meter.d.ts.map