1 | import type { TransactionContext } from '@sentry/types';
|
2 | import { tracingContextFromHeaders } from '@sentry/utils';
|
3 | import type { Span } from './span';
|
4 | /**
|
5 | * Wraps a function with a transaction/span and finishes the span after the function is done.
|
6 | *
|
7 | * Note that if you have not enabled tracing extensions via `addTracingExtensions`
|
8 | * or you didn't set `tracesSampleRate`, this function will not generate spans
|
9 | * and the `span` returned from the callback will be undefined.
|
10 | *
|
11 | * This function is meant to be used internally and may break at any time. Use at your own risk.
|
12 | *
|
13 | * @internal
|
14 | * @private
|
15 | */
|
16 | export declare function trace<T>(context: TransactionContext, callback: (span?: Span) => T, onError?: (error: unknown) => void): T;
|
17 | /**
|
18 | * Wraps a function with a transaction/span and finishes the span after the function is done.
|
19 | * The created span is the active span and will be used as parent by other spans created inside the function
|
20 | * and can be accessed via `Sentry.getSpan()`, as long as the function is executed while the scope is active.
|
21 | *
|
22 | * If you want to create a span that is not set as active, use {@link startInactiveSpan}.
|
23 | *
|
24 | * Note that if you have not enabled tracing extensions via `addTracingExtensions`
|
25 | * or you didn't set `tracesSampleRate`, this function will not generate spans
|
26 | * and the `span` returned from the callback will be undefined.
|
27 | */
|
28 | export declare function startSpan<T>(context: TransactionContext, callback: (span: Span | undefined) => T): T;
|
29 | /**
|
30 | * @deprecated Use {@link startSpan} instead.
|
31 | */
|
32 | export declare const startActiveSpan: typeof startSpan;
|
33 | /**
|
34 | * Similar to `Sentry.startSpan`. Wraps a function with a transaction/span, but does not finish the span
|
35 | * after the function is done automatically.
|
36 | *
|
37 | * The created span is the active span and will be used as parent by other spans created inside the function
|
38 | * and can be accessed via `Sentry.getActiveSpan()`, as long as the function is executed while the scope is active.
|
39 | *
|
40 | * Note that if you have not enabled tracing extensions via `addTracingExtensions`
|
41 | * or you didn't set `tracesSampleRate`, this function will not generate spans
|
42 | * and the `span` returned from the callback will be undefined.
|
43 | */
|
44 | export declare function startSpanManual<T>(context: TransactionContext, callback: (span: Span | undefined, finish: () => void) => T): T;
|
45 | /**
|
46 | * Creates a span. This span is not set as active, so will not get automatic instrumentation spans
|
47 | * as children or be able to be accessed via `Sentry.getSpan()`.
|
48 | *
|
49 | * If you want to create a span that is set as active, use {@link startSpan}.
|
50 | *
|
51 | * Note that if you have not enabled tracing extensions via `addTracingExtensions`
|
52 | * or you didn't set `tracesSampleRate` or `tracesSampler`, this function will not generate spans
|
53 | * and the `span` returned from the callback will be undefined.
|
54 | */
|
55 | export declare function startInactiveSpan(context: TransactionContext): Span | undefined;
|
56 | /**
|
57 | * Returns the currently active span.
|
58 | */
|
59 | export declare function getActiveSpan(): Span | undefined;
|
60 | export declare function continueTrace({ sentryTrace, baggage, }: {
|
61 | sentryTrace: Parameters<typeof tracingContextFromHeaders>[0];
|
62 | baggage: Parameters<typeof tracingContextFromHeaders>[1];
|
63 | }): Partial<TransactionContext>;
|
64 | export declare function continueTrace<V>({ sentryTrace, baggage, }: {
|
65 | sentryTrace: Parameters<typeof tracingContextFromHeaders>[0];
|
66 | baggage: Parameters<typeof tracingContextFromHeaders>[1];
|
67 | }, callback: (transactionContext: Partial<TransactionContext>) => V): V;
|
68 | //# sourceMappingURL=trace.d.ts.map |
\ | No newline at end of file |