/// import type * as http from 'http'; import * as url from 'url'; import { Func, Http, HttpInstrumentationConfig, HttpRequestArgs } from './types'; import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation'; /** * Http instrumentation instrumentation for Opentelemetry */ export declare class HttpInstrumentation extends InstrumentationBase { /** keep track on spans not ended */ private readonly _spanNotEnded; private readonly _version; constructor(config?: HttpInstrumentationConfig & InstrumentationConfig); private _getConfig; setConfig(config?: HttpInstrumentationConfig & InstrumentationConfig): void; init(): any[]; private _getHttpInstrumentation; private _getHttpsInstrumentation; /** * Creates spans for incoming requests, restoring spans' context if applied. */ protected _getPatchIncomingRequestFunction(component: 'http' | 'https'): (original: (event: string, ...args: unknown[]) => boolean) => (this: {}, event: string, ...args: unknown[]) => boolean; /** * Creates spans for outgoing requests, sending spans' context for distributed * tracing. */ protected _getPatchOutgoingRequestFunction(component: 'http' | 'https'): (original: Func) => Func; protected _getPatchOutgoingGetFunction(clientRequest: (options: http.RequestOptions | string | url.URL, ...args: HttpRequestArgs) => http.ClientRequest): (_original: Func) => Func; /** Patches HTTPS outgoing requests */ private _getPatchHttpsOutgoingRequestFunction; private _setDefaultOptions; /** Patches HTTPS outgoing get requests */ private _getPatchHttpsOutgoingGetFunction; /** * Attach event listeners to a client request to end span and add span attributes. * * @param request The original request object. * @param options The arguments to the original function. * @param span representing the current operation */ private _traceClientRequest; private _incomingRequestFunction; private _outgoingRequestFunction; private _startHttpSpan; private _closeHttpSpan; private _callResponseHook; private _callRequestHook; }