import { Exception, Span } from "@opentelemetry/api";
import type { Request, Response } from "express";
/**
 * Starts new server span and adds google cloud functions specific attributes.
 *
 * @param req the express request (see https://expressjs.com/en/api.html#req)
 * @returns a promise with the created span.
 */
export declare function startHttpSpan(req: Request): Promise<Span>;
/**
 * Starts a new server span and calls the given function passing it the
 * created span as first argument.
 * Additionally the new span gets set in context and this context is activated
 * for the duration of the function call.
 *
 * @param req the express request (see https://expressjs.com/en/api.html#req)
 * @param fn function called in the context of the span and receives the newly created span as an argument
 */
export declare function startActiveHttpSpan<F extends (span: Span) => ReturnType<F>>(req: Request, fn: F): Promise<ReturnType<F> | undefined>;
/**
 * Ends the given span and flushes the tracer provider.
 *
 * @param span the span to end.
 * @param res the express response (see  https://expressjs.com/en/api.html#res). Provided response should be fully prepared (e.g. status code set)
 * @param error an optional error that will be recorded before the span is ended.
 * @returns a promise to await the tracer provider's flush operation.
 */
export declare function endHttpSpanAndFlush(span: Span, res: Response, error?: Exception): Promise<void>;
/**
 * Ends the given span.
 *
 * @param span the span to end.
 * @param res the express response (see  https://expressjs.com/en/api.html#res). Provided response should be fully prepared (e.g. status code set)
 * @param error an optional error that will be recorded before the span is ended.
 */
export declare function endHttpSpan(span: Span, res: Response, error?: Exception): void;
/**
 * Flushes registered tracer provider. To successfully flush the registered tracer provider must have forceFlush method implemented.
 *
 * @returns flush promise
 */
export declare function flushSpans(): Promise<void>;
/**
 * Returns true if it is cold start, otherwise false
 * NOTE: the function is exported to make cold start unit testable
 */
export declare const isColdStart: () => boolean;
/**
 * Resets cached forceFlush function
 * NOTE: the function is exported only for unit testing
 */
export declare function resetForceFlushCache(): void;
//# sourceMappingURL=GcfInstrumentation.d.ts.map