UNPKG

@salesforce/o11y-reporter

Version:

A wrapper service around o11y and o11y_schema for telemetry reporting.

68 lines (58 loc) 2.19 kB
/* * Copyright (c) 2025, salesforce.com, inc. * All rights reserved. * For full license text, see LICENSE.txt file in the repo root. */ // Type definitions for external dependencies // Note: These modules are used at runtime but don't need TypeScript declarations here // since they're external dependencies and the bundled code handles them // Type definitions that should be available from o11y packages interface Environment { appName: string; sdkVersion: string; } interface Instrumentation { log(schema: unknown, data: { message: string }): void; } interface InstrumentedAppMethods { registerLogCollector(collector: any, options: { retroactive: boolean }): void; registerMetricsCollector(collector: any): void; simpleCollector: any; } interface SimpleCollector { hasData: boolean; estimatedByteSize: number; getRawContentsOfCoreEnvelope(): unknown; } // Main O11yService class declaration export declare class O11yService { O11Y_UPLOAD_THRESHOLD_BYTES: number; o11yUploadEndpoint: string | undefined; instrumentation: Instrumentation | undefined; a4dO11ySchema: unknown; readonly environment: Record<string, string>; private static instances: Map<string, O11yService>; private static sharedInstrumentation: Instrumentation | null; private static sharedInstrApp: InstrumentedAppMethods | null; private static sharedO11yModules: any | null; private static sharedProtoEncoderFunc: | ((input: unknown) => Uint8Array) | null; private extensionName: string; private constructor(); static getInstance(extensionId: string): O11yService; initialize(extensionName: string, o11yUploadEndpoint: string): Promise<void>; private initializeSharedResources(): Promise<void>; logEvent(properties?: { [key: string]: any }): void; upload(): Promise<void>; initSimpleCollector( o11yApp: InstrumentedAppMethods, environment: Environment, o11yModules: any | null, ): Promise<SimpleCollector>; uploadAsNeededAsync( ignoreThreshold?: boolean, ): Promise<PromiseSettledResult<Response>[]>; uploadToFalconAsync(binary: Uint8Array): Promise<Response>; postRequest(endpoint: string, body: any): Promise<any>; }