/// <reference types="node" />
/// <reference types="node" />
import * as events from "events";
import * as http from "http";
import { SpanContext } from "@opentelemetry/api";
import { TraceState } from "@opentelemetry/core";
import { Span } from "@opentelemetry/sdk-trace-base";
import { ICorrelationContext, ITraceparent, AzureFnContext, AzureFnRequest, HttpRequest } from "./types";
import { HttpRequest as AzureFnHttpRequest } from "@azure/functions";
export declare class CorrelationContextManager {
    private static _isDisabled;
    /**
     * Converts an OpenTelemetry SpanContext object to an ICorrelationContext object for backwards compatibility with ApplicationInsights
     * @param spanContext OpenTelmetry SpanContext object
     * @param parentId spanId of the parent span
     * @param name OpenTelemetry human readable name of the span
     * @param traceState String of key value pairs for additional trace context
     * @returns ICorrelationContext object
     */
    static spanToContextObject(spanContext: SpanContext, parentId?: string, name?: string, traceState?: TraceState): ICorrelationContext;
    /**
     * Provides the current Context.
     * The context is the most recent one entered into for the current
     * logical chain of execution, including across asynchronous calls.
     * @returns ICorrelationContext object
     */
    static getCurrentContext(): ICorrelationContext | null;
    private static _getParentSpanId;
    /**
     * Helper to generate objects conforming to the CorrelationContext interface
     * @param operationId String assigned to a series of related telemetry items - equivalent to OpenTelemetry traceId
     * @param parentId spanId of the parent span
     * @param operationName Human readable name of the span
     * @param traceparent Context conveying string in the format version-traceId-spanId-traceFlag
     * @param tracestate String of key value pairs for additional trace context
     * @returns ICorrelationContext object
     */
    static generateContextObject(operationId: string, parentId?: string, operationName?: string, traceparent?: ITraceparent, tracestate?: TraceState): ICorrelationContext;
    /**
     * Runs a function inside a given Context.
     * All logical children of the execution path that entered this Context
     * will receive this Context object on calls to GetCurrentContext.
     * @param ctx Context to run the function within
     * @param fn Function to run within the stated context
     * @returns any
     */
    static runWithContext(ctx: ICorrelationContext, fn: () => any): any;
    /**
     * Wrapper for cls-hooked bindEmitter method
     * @param emitter emitter to bind to the current context
     */
    static wrapEmitter(emitter: events.EventEmitter): void;
    /**
     * Patches a callback to restore the correct Context when getCurrentContext
     * is run within it. This is necessary if automatic correlation fails to work
     * with user-included libraries.
     * The supplied callback will be given the same context that was present for
     * the call to wrapCallback
     * @param fn Function to be wrapped in the provided context
     * @param ctx Context to bind the function to
     * @returns Generic type T
     */
    static wrapCallback<T>(fn: T, ctx?: ICorrelationContext): T;
    /**
     * Enables the CorrelationContextManager
     * @param forceClsHooked unused parameter used to satisfy backward compatibility
     */
    static enable(forceClsHooked?: boolean): void;
    /**
     * Creates a new correlation context
     * @param input Any kind of object we can extract context information from
     * @param request HTTP request we can pull context information from in the form of the request's headers
     * @returns IcorrelationContext object
     */
    static startOperation(input: AzureFnContext | (http.IncomingMessage | AzureFnRequest) | SpanContext | Span, request?: HttpRequest | string | AzureFnHttpRequest): ICorrelationContext;
    /**
     * Disables the CorrelationContextManager
     */
    static disable(): void;
    /**
     * Resets the namespace
     */
    static reset(): void;
    /**
     * Converts ApplicationInsights' ICorrelationContext to an OpenTelemetry SpanContext
     * @param ctx ICorrelationContext object to convert to a SpanContext
     * @returns OpenTelemetry SpanContext
     */
    private static _contextObjectToSpanContext;
}
