UNPKG

@altostra/core

Version:

Core library for shared types and logic

29 lines (28 loc) 1.05 kB
import type { Logger } from "../../common/Logging"; import type { Option } from "../../common/Option"; import type { ITelemetryAgent } from "../ITelemetryAgent"; import type { ITelemetryReporter } from "../ITelemetryReporter"; import type { TelemetryEvent } from "../TelemetryEvent"; export declare class BatchTelemetryAgent<T extends string> implements ITelemetryAgent<T> { #private; constructor(options: Partial<Options>, reporter: ITelemetryReporter<T>); private get batchIsFull(); private get batchIsEmpty(); private get batchIsNotEmpty(); send(event: TelemetryEvent<T>): Promise<void>; private startTimer; private stopTimer; /** * @spec * The batchTelemetry role is to send the data to the reporter * It is the reporter's job to retry to report the data in case something fails */ private reportEvents; dispose(): Promise<void>; } export interface Options { batchSize: number; reportInterval: Option<number>; debugLogger: Logger; } export declare const defaultOptions: Options;