@erickluis00/otelviewer
Version:
Shared OpenTelemetry tracing utilities, types, and batch processor for Realtime OpenTelemetry Viewer [WIP]
39 lines • 1.77 kB
TypeScript
import { TracerProvider, MeterProvider } from '@opentelemetry/api';
import { LoggerProvider } from '@opentelemetry/api-logs';
import type { Instrumentation, InstrumentationConfig } from '@opentelemetry/instrumentation';
export interface FetchInstrumentationConfig extends InstrumentationConfig {
enabled?: boolean;
}
/**
* FetchInstrumentation class that implements the Instrumentation interface
* Patches global fetch and creates spans for tracing
*/
export declare class FetchInstrumentation implements Instrumentation<FetchInstrumentationConfig> {
readonly instrumentationName = "@erickluis00/otelviewer-fetch";
readonly instrumentationVersion = "1.0.0";
private _enabled;
private _originalFetch;
private _config;
private _tracerProvider;
private _meterProvider;
private _loggerProvider;
constructor(config?: FetchInstrumentationConfig);
enable(): void;
disable(): void;
setTracerProvider(tracerProvider: TracerProvider): void;
setMeterProvider(meterProvider: MeterProvider): void;
setLoggerProvider(loggerProvider: LoggerProvider): void;
setConfig(config: FetchInstrumentationConfig): void;
getConfig(): FetchInstrumentationConfig;
}
/**
* Creates a fetch instrumentation that patches global fetch and creates spans
* Much simpler than using UndiciInstrumentation - just intercepts fetch directly
*
* This maintains proper span hierarchy and context propagation automatically
* when using tracer.startActiveSpan()
*
* Returns an Instrumentation instance that can be used in Instrumentation[] arrays
*/
export declare function createFetchInstrumentation(config?: FetchInstrumentationConfig): Instrumentation<FetchInstrumentationConfig>;
//# sourceMappingURL=fetch-instrumentation.d.ts.map