import { DiagLogger, Meter, MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api"; import { Instrumentation, InstrumentationConfig, InstrumentationModuleDefinition, SpanCustomizationHook } from "@opentelemetry/instrumentation"; import { Logger } from "@opentelemetry/api-logs"; import { LoggerProvider } from "@opentelemetry/sdk-logs"; //#region src/instrumentations/InstrumentationAbstract/InstrumentationAbstract.d.ts declare abstract class InstrumentationAbstract implements Instrumentation { readonly instrumentationName: string; readonly instrumentationVersion: string; protected _config: ConfigType; protected _diag: DiagLogger; constructor(instrumentationName: string, instrumentationVersion: string, config: ConfigType); private _tracer; protected get tracer(): Tracer; private _meter; protected get meter(): Meter; private _logger; protected get logger(): Logger; /** * @experimental * * Get module definitions defined by {@link init}. * This can be used for experimental compile-time instrumentation. * * @returns an array of {@link InstrumentationModuleDefinition} */ getModuleDefinitions(): InstrumentationModuleDefinition[]; abstract disable(): void; abstract enable(): void; getConfig(): ConfigType; /** * Sets InstrumentationConfig to this plugin * @param config */ setConfig(config: ConfigType): void; /** * Sets LoggerProvider to this plugin * @param loggerProvider */ setLoggerProvider(loggerProvider: LoggerProvider): void; /** * Sets MeterProvider to this plugin * @param meterProvider */ setMeterProvider(meterProvider: MeterProvider): void; /** * Sets TraceProvider to this plugin * @param tracerProvider */ setTracerProvider(tracerProvider: TracerProvider): void; /** * Init method in which plugin should define _modules and patches for * methods. * * Note: OTel uses `| void` but we use `| undefined` for semantic clarity. * `void` in union types is confusing because it mixes "returns nothing" with "returns data or nothing". * `undefined` better expresses the intent: this method may or may not return a value. */ protected abstract init(): InstrumentationModuleDefinition | InstrumentationModuleDefinition[] | undefined; protected _updateMetricInstruments(): void; /** * Execute span customization hook, if configured, and log any errors. * Any semantics of the trigger and info are defined by the specific instrumentation. * @param hookHandler The optional hook handler which the user has configured via instrumentation config * @param triggerName The name of the trigger for executing the hook for logging purposes * @param span The span to which the hook should be applied * @param info The info object to be passed to the hook, with useful data the hook may use */ protected _runSpanCustomizationHook(hookHandler: SpanCustomizationHook | undefined, triggerName: string, span: Span, info: SpanCustomizationInfoType): void; } //#endregion export { InstrumentationAbstract }; //# sourceMappingURL=InstrumentationAbstract.d.ts.map