export declare type GenericSample = string | number | boolean; export declare type StatEntityType = "connection" | "track" | "dataTrack"; declare type SerializedStat = { key: string; timestamp: number; value?: GenericSample; min?: number; max?: number; avg?: number; }; declare class BaseStat { key: string; entityType: StatEntityType; entityId: string; entitySubId?: string; timestamp: number; rawSample: GenericSample; auxRawSample?: GenericSample; processedSample: GenericSample; preprocessor?: PreprocessSampleFunction; postprocessor?: PostprocessSampleFunction; constructor(key: string, entityType: StatEntityType, entityId: string, entitySubId: string | undefined, timestamp: number, sample: GenericSample, preprocessor?: PreprocessSampleFunction, postprocessor?: PostprocessSampleFunction, auxRawSample?: GenericSample); preProcessSample(newTimestamp: number, newSample: GenericSample, newAuxRawSample?: GenericSample): GenericSample; postProcessSample(processedSample: GenericSample): GenericSample; update(timestamp: number, sample: GenericSample, auxSample?: GenericSample): boolean; serialize(): SerializedStat; } declare class NormalStat extends BaseStat { } declare class MinMaxAvgStat extends BaseStat { min: number; max: number; avg: number; sampleNo: number; maxSampleNo: number; needsReset: boolean; firstRun: boolean; constructor(key: string, entityType: StatEntityType, entityId: string, entitySubId: string | undefined, timestamp: number, sample: number, preprocessor?: PreprocessSampleFunction, postprocessor?: PostprocessSampleFunction, auxRawSample?: GenericSample); update(timestamp: number, sample: GenericSample, auxSample?: GenericSample): boolean; serialize(): SerializedStat; } declare class CumulativeStat extends BaseStat { sampleNo: number; maxSampleNo: number; needsReset: boolean; firstRun: boolean; firstProcessedSampleInBucket: number; constructor(key: string, entityType: StatEntityType, entityId: string, entitySubId: string | undefined, timestamp: number, sample: GenericSample, preprocessor?: PreprocessSampleFunction, postprocessor?: PostprocessSampleFunction, auxRawSample?: GenericSample); update(timestamp: number, sample: GenericSample, auxSample?: GenericSample): boolean; serialize(): SerializedStat; } declare type Stat = NormalStat | MinMaxAvgStat | CumulativeStat; declare type MonitoredStats = { entityId: string; entitySubId?: string; entityType: StatEntityType; stats: Record; }; export declare type ReadyStats = { entityId: string; entitySubId?: string; entityType: StatEntityType; stats: SerializedStat[]; }; export declare type PreprocessSampleFunction = (currentSample: GenericSample, currentTimestamp: number, previousSample?: GenericSample, previousTimestamp?: number, currentAuxRawSample?: GenericSample, previousAuxRawSample?: GenericSample) => GenericSample; export declare type PostprocessSampleFunction = (processedSample: GenericSample) => GenericSample; export declare type BucketType = "normal" | "minMaxAvg" | "cumulative"; export declare class Stats { registry: Record; monitored: Record; ready: Record; register(key: string, type: BucketType, preprocess?: PreprocessSampleFunction, postprocess?: PostprocessSampleFunction): void; update(key: string, entityType: StatEntityType, entityId: string, entitySubId: string | undefined, timestamp: number, sample: GenericSample, auxSample?: GenericSample): void; popReady(): ReadyStats[]; popNotReadyForEntity(entityId: string, entitySubId: string | undefined, entityType: StatEntityType): ReadyStats | void; } export {};