import { TrackedError } from './TrackedError'; import { TryCatchFinallyContext, TryCatchFinallyHook } from './wrapTryCatchFinallyPromisable'; export type OperationStatsContext = TContext & { tags: string[]; sharedContext: { tags: string[]; }; decoratorArgs?: { shouldStats?: (args: OperationStatsEventArgs) => boolean | void; }; }; export declare abstract class OperationStats implements TryCatchFinallyHook { static getTryCatchFinallyHook(_ctx: OperationStatsContext): TryCatchFinallyHook; abstract stats(args: StatsArgs): void; getMetricName(ctx: OperationStatsContext): string | undefined; onTry(ctx: OperationStatsContext): () => void; mergeTags(...tagSets: (StatsTags | undefined)[]): string[]; mergeTags(distinct: boolean, ...tagSets: StatsTags[]): string[]; tagsMapToArray(tags: StatsTagsMap): string[]; tagsArrayToMap(tags: string[]): StatsTagsMap; statsOperationEvent(args: OperationStatsEventArgs): void; onCatch(ctx: OperationStatsContext): void; onFinally(ctx: OperationStatsContext): () => void; getHistogramMetric(ctx: OperationStatsContext): string | undefined; extractTagsFromError(error: TrackedError, ctx: OperationStatsContext): string[]; getErrorOperationNameTag(error: TrackedError, ctx: OperationStatsContext): string | undefined; getOperationNameTag(ctx: OperationStatsContext): string | undefined; } export type StatsMethod = 'incr' | 'histogram' | 'set'; export type StatsArgs = { method?: StatsMethod; metric: string; value?: number; tags?: StatsTags; }; export type StatsTagsMap = Record; export type StatsTags = string[] | StatsTagsMap; export type OperationStatsEvent = OperationStatsContext['stage'] | 'duration'; export interface OperationStatsEventArgs { event: OperationStatsEvent; context: OperationStatsContext; stats: StatsArgs; shouldStats: boolean; }