import LogEventProcessor from './LogEventProcessor'; import { StatsigOptions } from './StatsigOptions'; export declare const MAX_SAMPLING_RATE = 10000; export declare const MAX_MARKER_COUNT = 26; export interface Marker { markerID?: string; key: KeyType; action: ActionType; timestamp: number; step?: StepType; statusCode?: number; error?: Record; success?: boolean; url?: string; idListCount?: number; reason?: 'timeout'; sdkRegion?: string | null; configName?: string; } export type DiagnosticsSamplingRate = { dcs: number; log: number; idlist: number; initialize: number; api_call: number; gcir: number; }; export type SDKConstants = DiagnosticsSamplingRate; export type ContextType = 'initialize' | 'config_sync' | 'event_logging' | 'api_call' | 'get_client_initialize_response'; export type KeyType = 'download_config_specs' | 'bootstrap' | 'get_id_list' | 'get_id_list_sources' | 'get_config' | 'get_experiment' | 'check_gate' | 'get_layer' | 'get_client_initialize_response' | 'overall'; export type StepType = 'process' | 'network_request'; export type ActionType = 'start' | 'end'; type DiagnosticsMarkers = { initialize: Marker[]; config_sync: Marker[]; event_logging: Marker[]; api_call: Marker[]; get_client_initialize_response: Marker[]; }; export declare class DiagnosticsImpl { readonly mark: { overall: { start: (data: RequiredActionTags, context?: ContextType) => void; end: (data: RequiredActionTags, context?: ContextType) => void; }; downloadConfigSpecs: { process: { start: (data: Record, context?: ContextType) => void; end: (data: { success: boolean; }, context?: ContextType) => void; }; networkRequest: { start: (data: Record, context?: ContextType) => void; end: (data: { success: boolean; sdkRegion?: string | null | undefined; statusCode?: number | undefined; error?: Record | undefined; }, context?: ContextType) => void; }; }; bootstrap: { process: { start: (data: Record, context?: ContextType) => void; end: (data: { success: boolean; }, context?: ContextType) => void; }; networkRequest: { start: (data: RequiredActionTags, context?: ContextType) => void; end: (data: RequiredActionTags, context?: ContextType) => void; }; }; getIDList: { process: { start: (data: { markerID: string; }, context?: ContextType) => void; end: (data: { success: boolean; markerID: string; }, context?: ContextType) => void; }; networkRequest: { start: (data: { url: string; markerID: string; }, context?: ContextType) => void; end: (data: { success: boolean; statusCode?: number | undefined; sdkRegion?: string | null | undefined; markerID: string; }, context?: ContextType) => void; }; }; getIDListSources: { process: { start: (data: { idListCount: number; }, context?: ContextType) => void; end: (data: { success: boolean; }, context?: ContextType) => void; }; networkRequest: { start: (data: Record, context?: ContextType) => void; end: (data: { success: boolean; sdkRegion?: string | null | undefined; statusCode?: number | undefined; error?: Record | undefined; }, context?: ContextType) => void; }; }; getClientInitializeResponse: { start: (data: RequiredActionTags, context?: ContextType) => void; end: (data: RequiredActionTags, context?: ContextType) => void; }; api_call: (tag: string) => { start: (data: RequiredActionTags, context?: ContextType) => void; end: (data: RequiredActionTags, context?: ContextType) => void; } | null; }; private readonly markers; private disabledCoreAPI; private logger; private context; private samplingRates; constructor(args: { logger: LogEventProcessor; options?: StatsigOptions; markers?: DiagnosticsMarkers; }); setContext(context: ContextType): void; setSamplingRate(samplingRate: unknown): void; selectAction(key: KeyType, step?: StepType): { start: (data: ActionType["start"], context?: ContextType) => void; end: (data: ActionType["end"], context?: ContextType) => void; }; selectStep(key: KeyType): { process: { start: (data: StepType["process"]["start"], context?: ContextType | undefined) => void; end: (data: StepType["process"]["end"], context?: ContextType | undefined) => void; }; networkRequest: { start: (data: StepType["networkRequest"]["start"], context?: ContextType | undefined) => void; end: (data: StepType["networkRequest"]["end"], context?: ContextType | undefined) => void; }; }; addMarker(marker: Marker, overrideContext?: ContextType): void; getMarker(context: ContextType): Marker[]; clearMarker(context: ContextType): void; getMarkerCount(context: ContextType): number; logDiagnostics(context: ContextType, optionalArgs?: { type: 'id_list' | 'config_spec' | 'initialize' | 'api_call' | 'get_client_initialize_response'; }): void; private updateSamplingRates; private safeSet; getShouldLogDiagnostics(type: 'id_list' | 'config_spec' | 'initialize' | 'api_call' | 'get_client_initialize_response'): boolean; } export default abstract class Diagnostics { static mark: DiagnosticsImpl['mark']; static instance: DiagnosticsImpl; static initialize(args: { logger: LogEventProcessor; options?: StatsigOptions; markers?: DiagnosticsMarkers; }): void; static logDiagnostics(context: ContextType, optionalArgs?: { type: 'id_list' | 'config_spec' | 'initialize' | 'api_call' | 'get_client_initialize_response'; }): void; static setContext(context: ContextType): void; static formatNetworkError(e: unknown): Record | undefined; static getMarkerCount(context: ContextType): number; } type RequiredActionTags = { [K in keyof Marker]?: Marker[K]; }; interface RequiredStepTags { start: RequiredActionTags; end: RequiredActionTags; } interface RequiredMarkerTags { process: RequiredStepTags; networkRequest: RequiredStepTags; } export {};