import { EventProcessor, Hub, Integration, Span, SpanContext, SpanStatus } from '@sentry/types';
/**
 * Options for Tracing integration
 */
interface TracingOptions {
    /**
     * List of strings / regex where the integration should create Spans out of. Additionally this will be used
     * to define which outgoing requests the `sentry-trace` header will be attached to.
     *
     * Default: ['localhost', /^\//]
     */
    tracingOrigins: Array<string | RegExp>;
    /**
     * Flag to disable patching all together for fetch requests.
     *
     * Default: true
     */
    traceFetch: boolean;
    /**
     * Flag to disable patching all together for xhr requests.
     *
     * Default: true
     */
    traceXHR: boolean;
    /**
     * This function will be called before creating a span for a request with the given url.
     * Return false if you don't want a span for the given url.
     *
     * By default it uses the `tracingOrigins` options as a url match.
     */
    shouldCreateSpanForRequest(url: string): boolean;
    /**
     * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of
     * the last finished span as the endtime for the transaction.
     * Time is in ms.
     *
     * Default: 500
     */
    idleTimeout: number;
    /**
     * Flag to enable/disable creation of `navigation` transaction on history changes. Useful for react applications with
     * a router.
     *
     * Default: true
     */
    startTransactionOnLocationChange: boolean;
    /**
     * Sample to determine if the Integration should instrument anything. The decision will be taken once per load
     * on initalization.
     * 0 = 0% chance of instrumenting
     * 1 = 100% change of instrumenting
     *
     * Default: 1
     */
    tracesSampleRate: number;
    /**
     * The maximum duration of a transaction before it will be discarded. This is for some edge cases where a browser
     * completely freezes the JS state and picks it up later (background tabs).
     * So after this duration, the SDK will not send the event.
     * If you want to have an unlimited duration set it to 0.
     * Time is in seconds.
     *
     * Default: 600
     */
    maxTransactionDuration: number;
    /**
     * Flag to discard all spans that occur in background. This includes transactions. Browser background tab timing is
     * not suited towards doing precise measurements of operations. That's why this option discards any active transaction
     * and also doesn't add any spans that happen in the background. Background spans/transaction can mess up your
     * statistics in non deterministic ways that's why we by default recommend leaving this opition enabled.
     *
     * Default: true
     */
    discardBackgroundSpans: boolean;
}
/** JSDoc */
interface Activity {
    name: string;
    span?: Span;
}
/**
 * Tracing Integration
 */
export declare class Tracing implements Integration {
    /**
     * @inheritDoc
     */
    name: string;
    /**
     * @inheritDoc
     */
    static id: string;
    /**
     * Is Tracing enabled, this will be determined once per pageload.
     */
    private static _enabled?;
    /** JSDoc */
    static options: TracingOptions;
    /**
     * Returns current hub.
     */
    private static _getCurrentHub?;
    private static _activeTransaction?;
    private static _currentIndex;
    static _activities: {
        [key: number]: Activity;
    };
    private static _debounce;
    private readonly _emitOptionsWarning;
    private static _performanceCursor;
    private static _heartbeatTimer;
    private static _prevHeartbeatString;
    private static _heartbeatCounter;
    /**
     * Constructor for Tracing
     *
     * @param _options TracingOptions
     */
    constructor(_options?: Partial<TracingOptions>);
    /**
     * @inheritDoc
     */
    setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
    /**
     * Pings the heartbeat
     */
    private static _pingHeartbeat;
    /**
     * Checks when entries of Tracing._activities are not changing for 3 beats. If this occurs we finish the transaction
     *
     */
    private static _beat;
    /**
     * Discards active transactions if tab moves to background
     */
    private _setupBackgroundTabDetection;
    /**
     * Unsets the current active transaction + activities
     */
    private static _resetActiveTransaction;
    /**
     * Registers to History API to detect navigation changes
     */
    private _setupHistory;
    /**
     * Attaches to fetch to add sentry-trace header + creating spans
     */
    private _setupFetchTracing;
    /**
     * Attaches to XHR to add sentry-trace header + creating spans
     */
    private _setupXHRTracing;
    /**
     * Configures global error listeners
     */
    private _setupErrorHandling;
    /**
     * Is tracing enabled
     */
    private static _isEnabled;
    /**
     * Starts a Transaction waiting for activity idle to finish
     */
    static startIdleTransaction(name: string, spanContext?: SpanContext): Span | undefined;
    /**
     * Update transaction
     * @deprecated
     */
    static updateTransactionName(name: string): void;
    /**
     * Finshes the current active transaction
     */
    static finishIdleTransaction(): void;
    /**
     * This uses `performance.getEntries()` to add additional spans to the active transaction.
     * Also, we update our timings since we consider the timings in this API to be more correct than our manual
     * measurements.
     *
     * @param transactionSpan The transaction span
     */
    private static _addPerformanceEntries;
    /**
     * Sets the status of the current active transaction (if there is one)
     */
    static setTransactionStatus(status: SpanStatus): void;
    /**
     * Converts from milliseconds to seconds
     * @param time time in ms
     */
    private static _msToSec;
    /**
     * Starts tracking for a specifc activity
     *
     * @param name Name of the activity, can be any string (Only used internally to identify the activity)
     * @param spanContext If provided a Span with the SpanContext will be created.
     * @param options _autoPopAfter_ | Time in ms, if provided the activity will be popped automatically after this timeout. This can be helpful in cases where you cannot gurantee your application knows the state and calls `popActivity` for sure.
     */
    static pushActivity(name: string, spanContext?: SpanContext, options?: {
        autoPopAfter?: number;
    }): number;
    /**
     * Removes activity and finishes the span in case there is one
     */
    static popActivity(id: number, spanData?: {
        [key: string]: any;
    }): void;
}
export {};
//# sourceMappingURL=tracing.d.ts.map