/*!
* Copyright 2019, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///
import { BasePlugin } from '@opentelemetry/core';
import { ClientRequest, RequestOptions } from 'http';
import { Func, Http, HttpPluginConfig, HttpRequestArgs } from './types';
/**
* Http instrumentation plugin for Opentelemetry
*/
export declare class HttpPlugin extends BasePlugin {
readonly moduleName: string;
readonly version: string;
readonly component: string;
protected _config: HttpPluginConfig;
/** keep track on spans not ended */
private readonly _spanNotEnded;
constructor(moduleName: string, version: string);
/** Patches HTTP incoming and outcoming request functions. */
protected patch(): typeof import("http");
/** Unpatches all HTTP patched function. */
protected unpatch(): void;
/**
* Creates spans for incoming requests, restoring spans' context if applied.
*/
protected _getPatchIncomingRequestFunction(): (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(): (original: Func) => Func;
protected _getPatchOutgoingGetFunction(clientRequest: (options: RequestOptions | string | URL, ...args: HttpRequestArgs) => ClientRequest): (original: Func) => Func;
/**
* 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 _onNewResponse;
private _onNewRequest;
private _safeExecute;
}
export declare const plugin: HttpPlugin;
//# sourceMappingURL=http.d.ts.map