UNPKG

5.27 kBTypeScriptView Raw
1import type { Client, Span, StartSpanOptions } from '@sentry/core';
2export declare const BROWSER_TRACING_INTEGRATION_ID = "BrowserTracing";
3/** Options for Browser Tracing integration */
4export interface BrowserTracingOptions {
5 /**
6 * The time that has to pass without any span being created.
7 * If this time is exceeded, the idle span will finish.
8 *
9 * Default: 1000 (ms)
10 */
11 idleTimeout: number;
12 /**
13 * The max. time an idle span may run.
14 * If this time is exceeded, the idle span will finish no matter what.
15 *
16 * Default: 30000 (ms)
17 */
18 finalTimeout: number;
19 /**
20 The max. time an idle span may run.
21 * If this time is exceeded, the idle span will finish no matter what.
22 *
23 * Default: 15000 (ms)
24 */
25 childSpanTimeout: number;
26 /**
27 * If a span should be created on page load.
28 * If this is set to `false`, this integration will not start the default page load span.
29 * Default: true
30 */
31 instrumentPageLoad: boolean;
32 /**
33 * If a span should be created on navigation (history change).
34 * If this is set to `false`, this integration will not start the default navigation spans.
35 * Default: true
36 */
37 instrumentNavigation: boolean;
38 /**
39 * Flag spans where tabs moved to background with "cancelled". Browser background tab timing is
40 * not suited towards doing precise measurements of operations. By default, we recommend that this option
41 * be enabled as background transactions can mess up your statistics in nondeterministic ways.
42 *
43 * Default: true
44 */
45 markBackgroundSpan: boolean;
46 /**
47 * If true, Sentry will capture long tasks and add them to the corresponding transaction.
48 *
49 * Default: true
50 */
51 enableLongTask: boolean;
52 /**
53 * If true, Sentry will capture long animation frames and add them to the corresponding transaction.
54 *
55 * Default: false
56 */
57 enableLongAnimationFrame: boolean;
58 /**
59 * If true, Sentry will capture first input delay and add it to the corresponding transaction.
60 *
61 * Default: true
62 */
63 enableInp: boolean;
64 /**
65 * Flag to disable patching all together for fetch requests.
66 *
67 * Default: true
68 */
69 traceFetch: boolean;
70 /**
71 * Flag to disable patching all together for xhr requests.
72 *
73 * Default: true
74 */
75 traceXHR: boolean;
76 /**
77 * Flag to disable tracking of long-lived streams, like server-sent events (SSE) via fetch.
78 * Do not enable this in case you have live streams or very long running streams.
79 *
80 * Default: false
81 */
82 trackFetchStreamPerformance: boolean;
83 /**
84 * If true, Sentry will capture http timings and add them to the corresponding http spans.
85 *
86 * Default: true
87 */
88 enableHTTPTimings: boolean;
89 /**
90 * _experiments allows the user to send options to define how this integration works.
91 *
92 * Default: undefined
93 */
94 _experiments: Partial<{
95 enableInteractions: boolean;
96 enableStandaloneClsSpans: boolean;
97 }>;
98 /**
99 * A callback which is called before a span for a pageload or navigation is started.
100 * It receives the options passed to `startSpan`, and expects to return an updated options object.
101 */
102 beforeStartSpan?: (options: StartSpanOptions) => StartSpanOptions;
103 /**
104 * This function will be called before creating a span for a request with the given url.
105 * Return false if you don't want a span for the given url.
106 *
107 * Default: (url: string) => true
108 */
109 shouldCreateSpanForRequest?(this: void, url: string): boolean;
110}
111/**
112 * The Browser Tracing integration automatically instruments browser pageload/navigation
113 * actions as transactions, and captures requests, metrics and errors as spans.
114 *
115 * The integration can be configured with a variety of options, and can be extended to use
116 * any routing library.
117 *
118 * We explicitly export the proper type here, as this has to be extended in some cases.
119 */
120export declare const browserTracingIntegration: (_options?: Partial<BrowserTracingOptions>) => {
121 name: string;
122 afterAllSetup(client: Client<import("@sentry/core").ClientOptions<import("@sentry/core").BaseTransportOptions>>): void;
123};
124/**
125 * Manually start a page load span.
126 * This will only do something if a browser tracing integration integration has been setup.
127 *
128 * If you provide a custom `traceOptions` object, it will be used to continue the trace
129 * instead of the default behavior, which is to look it up on the <meta> tags.
130 */
131export declare function startBrowserTracingPageLoadSpan(client: Client, spanOptions: StartSpanOptions, traceOptions?: {
132 sentryTrace?: string | undefined;
133 baggage?: string | undefined;
134}): Span | undefined;
135/**
136 * Manually start a navigation span.
137 * This will only do something if a browser tracing integration has been setup.
138 */
139export declare function startBrowserTracingNavigationSpan(client: Client, spanOptions: StartSpanOptions): Span | undefined;
140/** Returns the value of a meta tag */
141export declare function getMetaContent(metaName: string): string | undefined;
142//# sourceMappingURL=browserTracingIntegration.d.ts.map
\No newline at end of file