@sentry/browser-utils 10.68.0 → 11.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/htmlTreeAsString.js.map +1 -1
- package/build/cjs/index.js +2 -1
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/metrics/browserMetrics.js +25 -91
- package/build/cjs/metrics/browserMetrics.js.map +1 -1
- package/build/cjs/metrics/inp.js +0 -57
- package/build/cjs/metrics/inp.js.map +1 -1
- package/build/cjs/metrics/lcp.js +0 -67
- package/build/cjs/metrics/lcp.js.map +1 -1
- package/build/cjs/metrics/userTiming.js +118 -0
- package/build/cjs/metrics/userTiming.js.map +1 -0
- package/build/cjs/metrics/utils.js +0 -43
- package/build/cjs/metrics/utils.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js +2 -6
- package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/initUnique.js +1 -1
- package/build/cjs/metrics/web-vitals/lib/initUnique.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/onHidden.js +3 -4
- package/build/cjs/metrics/web-vitals/lib/onHidden.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +1 -1
- package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -2
- package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js.map +1 -1
- package/build/cjs/metrics/webVitalSpans.js +25 -9
- package/build/cjs/metrics/webVitalSpans.js.map +1 -1
- package/build/esm/htmlTreeAsString.js.map +1 -1
- package/build/esm/index.js +2 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/metrics/browserMetrics.js +29 -94
- package/build/esm/metrics/browserMetrics.js.map +1 -1
- package/build/esm/metrics/inp.js +3 -57
- package/build/esm/metrics/inp.js.map +1 -1
- package/build/esm/metrics/lcp.js +1 -66
- package/build/esm/metrics/lcp.js.map +1 -1
- package/build/esm/metrics/userTiming.js +115 -0
- package/build/esm/metrics/userTiming.js.map +1 -0
- package/build/esm/metrics/utils.js +2 -44
- package/build/esm/metrics/utils.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js +2 -6
- package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/initUnique.js +1 -1
- package/build/esm/metrics/web-vitals/lib/initUnique.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/onHidden.js +3 -4
- package/build/esm/metrics/web-vitals/lib/onHidden.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +1 -1
- package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -2
- package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js.map +1 -1
- package/build/esm/metrics/webVitalSpans.js +26 -10
- package/build/esm/metrics/webVitalSpans.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/metrics/browserMetrics.d.ts +5 -29
- package/build/types/metrics/browserMetrics.d.ts.map +1 -1
- package/build/types/metrics/inp.d.ts +0 -13
- package/build/types/metrics/inp.d.ts.map +1 -1
- package/build/types/metrics/lcp.d.ts +0 -16
- package/build/types/metrics/lcp.d.ts.map +1 -1
- package/build/types/metrics/userTiming.d.ts +37 -0
- package/build/types/metrics/userTiming.d.ts.map +1 -0
- package/build/types/metrics/utils.d.ts +1 -25
- package/build/types/metrics/utils.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/getCLS.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/getINP.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/getLCP.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/bindReporter.d.ts +1 -1
- package/build/types/metrics/web-vitals/lib/bindReporter.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/initMetric.d.ts +3 -3
- package/build/types/metrics/web-vitals/lib/initMetric.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/observe.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/onHidden.d.ts +4 -16
- package/build/types/metrics/web-vitals/lib/onHidden.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +1 -1
- package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/runOnce.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/whenActivated.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/onFCP.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/onTTFB.d.ts.map +1 -1
- package/build/types/metrics/web-vitals/types.d.ts +1 -1
- package/build/types/metrics/web-vitals/types.d.ts.map +1 -1
- package/build/types/metrics/webVitalSpans.d.ts +15 -9
- package/build/types/metrics/webVitalSpans.d.ts.map +1 -1
- package/build/types/types.d.ts +1 -1
- package/package.json +6 -15
- package/build/cjs/metrics/cls.js +0 -64
- package/build/cjs/metrics/cls.js.map +0 -1
- package/build/esm/metrics/cls.js +0 -61
- package/build/esm/metrics/cls.js.map +0 -1
- package/build/types/metrics/cls.d.ts +0 -17
- package/build/types/metrics/cls.d.ts.map +0 -1
- package/build/types-ts3.8/debug-build.d.ts +0 -7
- package/build/types-ts3.8/getNativeImplementation.d.ts +0 -69
- package/build/types-ts3.8/htmlTreeAsString.d.ts +0 -11
- package/build/types-ts3.8/index.d.ts +0 -17
- package/build/types-ts3.8/instrument/dom.d.ts +0 -11
- package/build/types-ts3.8/instrument/history.d.ts +0 -15
- package/build/types-ts3.8/instrument/location.d.ts +0 -13
- package/build/types-ts3.8/instrument/xhr.d.ts +0 -14
- package/build/types-ts3.8/is.d.ts +0 -7
- package/build/types-ts3.8/metrics/browserMetrics.d.ts +0 -119
- package/build/types-ts3.8/metrics/cls.d.ts +0 -17
- package/build/types-ts3.8/metrics/elementTiming.d.ts +0 -21
- package/build/types-ts3.8/metrics/inp.d.ts +0 -35
- package/build/types-ts3.8/metrics/instrument.d.ts +0 -121
- package/build/types-ts3.8/metrics/lcp.d.ts +0 -22
- package/build/types-ts3.8/metrics/resourceTiming.d.ts +0 -13
- package/build/types-ts3.8/metrics/utils.d.ts +0 -73
- package/build/types-ts3.8/metrics/web-vitals/getCLS.d.ts +0 -26
- package/build/types-ts3.8/metrics/web-vitals/getINP.d.ts +0 -34
- package/build/types-ts3.8/metrics/web-vitals/getLCP.d.ts +0 -16
- package/build/types-ts3.8/metrics/web-vitals/lib/InteractionManager.d.ts +0 -37
- package/build/types-ts3.8/metrics/web-vitals/lib/LCPEntryManager.d.ts +0 -5
- package/build/types-ts3.8/metrics/web-vitals/lib/LayoutShiftManager.d.ts +0 -7
- package/build/types-ts3.8/metrics/web-vitals/lib/bindReporter.d.ts +0 -7
- package/build/types-ts3.8/metrics/web-vitals/lib/generateUniqueID.d.ts +0 -7
- package/build/types-ts3.8/metrics/web-vitals/lib/getActivationStart.d.ts +0 -2
- package/build/types-ts3.8/metrics/web-vitals/lib/getNavigationEntry.d.ts +0 -2
- package/build/types-ts3.8/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +0 -5
- package/build/types-ts3.8/metrics/web-vitals/lib/globalListeners.d.ts +0 -11
- package/build/types-ts3.8/metrics/web-vitals/lib/initMetric.d.ts +0 -21
- package/build/types-ts3.8/metrics/web-vitals/lib/initUnique.d.ts +0 -7
- package/build/types-ts3.8/metrics/web-vitals/lib/observe.d.ts +0 -23
- package/build/types-ts3.8/metrics/web-vitals/lib/onHidden.d.ts +0 -27
- package/build/types-ts3.8/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +0 -15
- package/build/types-ts3.8/metrics/web-vitals/lib/runOnce.d.ts +0 -2
- package/build/types-ts3.8/metrics/web-vitals/lib/whenActivated.d.ts +0 -2
- package/build/types-ts3.8/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +0 -6
- package/build/types-ts3.8/metrics/web-vitals/onFCP.d.ts +0 -11
- package/build/types-ts3.8/metrics/web-vitals/onTTFB.d.ts +0 -20
- package/build/types-ts3.8/metrics/web-vitals/types/base.d.ts +0 -106
- package/build/types-ts3.8/metrics/web-vitals/types/cls.d.ts +0 -58
- package/build/types-ts3.8/metrics/web-vitals/types/fcp.d.ts +0 -47
- package/build/types-ts3.8/metrics/web-vitals/types/inp.d.ts +0 -150
- package/build/types-ts3.8/metrics/web-vitals/types/lcp.d.ts +0 -74
- package/build/types-ts3.8/metrics/web-vitals/types/ttfb.d.ts +0 -60
- package/build/types-ts3.8/metrics/web-vitals/types.d.ts +0 -78
- package/build/types-ts3.8/metrics/webVitalSpans.d.ts +0 -65
- package/build/types-ts3.8/networkUtils.d.ts +0 -28
- package/build/types-ts3.8/types.d.ts +0 -15
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Client } from '@sentry/core';
|
|
2
|
-
import type { WebVitalReportEvent } from './utils';
|
|
3
|
-
/**
|
|
4
|
-
* Starts tracking the Cumulative Layout Shift on the current page and collects the value once
|
|
5
|
-
*
|
|
6
|
-
* - the page visibility is hidden
|
|
7
|
-
* - a navigation span is started (to stop CLS measurement for SPA soft navigations)
|
|
8
|
-
*
|
|
9
|
-
* Once either of these events triggers, the CLS value is sent as a standalone span and we stop
|
|
10
|
-
* measuring CLS.
|
|
11
|
-
*/
|
|
12
|
-
export declare function trackClsAsStandaloneSpan(client: Client): void;
|
|
13
|
-
/**
|
|
14
|
-
* Exported only for testing!
|
|
15
|
-
*/
|
|
16
|
-
export declare function _sendStandaloneClsSpan(clsValue: number, entry: LayoutShift | undefined, pageloadSpanId: string, reportEvent: WebVitalReportEvent): void;
|
|
17
|
-
//# sourceMappingURL=cls.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cls.d.ts","sourceRoot":"","sources":["../../../src/metrics/cls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,cAAc,CAAC;AAe3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAqB7D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,WAAW,GAAG,SAAS,EAC9B,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,mBAAmB,QA4CjC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
|
|
3
|
-
*
|
|
4
|
-
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
|
5
|
-
*/
|
|
6
|
-
export declare const DEBUG_BUILD: boolean;
|
|
7
|
-
//# sourceMappingURL=debug-build.d.ts.map
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { WINDOW } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* We generally want to use window.fetch / window.setTimeout.
|
|
4
|
-
* However, in some cases this may be wrapped (e.g. by Zone.js for Angular),
|
|
5
|
-
* so we try to get an unpatched version of this from a sandboxed iframe.
|
|
6
|
-
*/
|
|
7
|
-
interface CacheableImplementations {
|
|
8
|
-
setTimeout: typeof WINDOW.setTimeout;
|
|
9
|
-
fetch: typeof WINDOW.fetch;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Get the native implementation of a browser function.
|
|
13
|
-
*
|
|
14
|
-
* This can be used to ensure we get an unwrapped version of a function, in cases where a wrapped function can lead to problems.
|
|
15
|
-
*
|
|
16
|
-
* The following methods can be retrieved:
|
|
17
|
-
* - `setTimeout`: This can be wrapped by e.g. Angular, causing change detection to be triggered.
|
|
18
|
-
* - `fetch`: This can be wrapped by e.g. ad-blockers, causing an infinite loop when a request is blocked.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getNativeImplementation<T extends keyof CacheableImplementations>(name: T): CacheableImplementations[T];
|
|
21
|
-
/** Clear a cached implementation. */
|
|
22
|
-
export declare function clearCachedImplementation(name: keyof CacheableImplementations): void;
|
|
23
|
-
/**
|
|
24
|
-
* A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.
|
|
25
|
-
* Whenever someone wraps the Fetch API and returns the wrong promise chain,
|
|
26
|
-
* this chain becomes orphaned and there is no possible way to capture it's rejections
|
|
27
|
-
* other than allowing it bubble up to this very handler. eg.
|
|
28
|
-
*
|
|
29
|
-
* const f = window.fetch;
|
|
30
|
-
* window.fetch = function () {
|
|
31
|
-
* const p = f.apply(this, arguments);
|
|
32
|
-
*
|
|
33
|
-
* p.then(function() {
|
|
34
|
-
* console.log('hi.');
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* return p;
|
|
38
|
-
* }
|
|
39
|
-
*
|
|
40
|
-
* `p.then(function () { ... })` is producing a completely separate promise chain,
|
|
41
|
-
* however, what's returned is `p` - the result of original `fetch` call.
|
|
42
|
-
*
|
|
43
|
-
* This mean, that whenever we use the Fetch API to send our own requests, _and_
|
|
44
|
-
* some ad-blocker blocks it, this orphaned chain will _always_ reject,
|
|
45
|
-
* effectively causing another event to be captured.
|
|
46
|
-
* This makes a whole process become an infinite loop, which we need to somehow
|
|
47
|
-
* deal with, and break it in one way or another.
|
|
48
|
-
*
|
|
49
|
-
* To deal with this issue, we are making sure that we _always_ use the real
|
|
50
|
-
* browser Fetch API, instead of relying on what `window.fetch` exposes.
|
|
51
|
-
* The only downside to this would be missing our own requests as breadcrumbs,
|
|
52
|
-
* but because we are already not doing this, it should be just fine.
|
|
53
|
-
*
|
|
54
|
-
* Possible failed fetch error messages per-browser:
|
|
55
|
-
*
|
|
56
|
-
* Chrome: Failed to fetch
|
|
57
|
-
* Edge: Failed to Fetch
|
|
58
|
-
* Firefox: NetworkError when attempting to fetch resource
|
|
59
|
-
* Safari: resource blocked by content blocker
|
|
60
|
-
*/
|
|
61
|
-
export declare function fetch(...rest: Parameters<typeof WINDOW.fetch>): ReturnType<typeof WINDOW.fetch>;
|
|
62
|
-
/**
|
|
63
|
-
* Get an unwrapped `setTimeout` method.
|
|
64
|
-
* This ensures that even if e.g. Angular wraps `setTimeout`, we get the native implementation,
|
|
65
|
-
* avoiding triggering change detection.
|
|
66
|
-
*/
|
|
67
|
-
export declare function setTimeout(...rest: Parameters<typeof WINDOW.setTimeout>): ReturnType<typeof WINDOW.setTimeout>;
|
|
68
|
-
export {};
|
|
69
|
-
//# sourceMappingURL=getNativeImplementation.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given a child DOM element, returns a query-selector statement describing that
|
|
3
|
-
* and its ancestors
|
|
4
|
-
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
|
|
5
|
-
* @returns generated DOM path
|
|
6
|
-
*/
|
|
7
|
-
export declare function htmlTreeAsString(elem: unknown, options?: string[] | {
|
|
8
|
-
keyAttrs?: string[];
|
|
9
|
-
maxStringLength?: number;
|
|
10
|
-
}): string;
|
|
11
|
-
//# sourceMappingURL=htmlTreeAsString.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { addPerformanceInstrumentationHandler, addClsInstrumentationHandler, addTtfbInstrumentationHandler, addLcpInstrumentationHandler, addInpInstrumentationHandler, } from './metrics/instrument';
|
|
2
|
-
export { addPerformanceEntries, addWebVitalsToSpan, startTrackingInteractions, startTrackingLongTasks, startTrackingLongAnimationFrames, startTrackingWebVitals, startTrackingINP, registerInpInteractionListener, } from './metrics/browserMetrics';
|
|
3
|
-
export { elementTimingIntegration, startTrackingElementTiming } from './metrics/elementTiming';
|
|
4
|
-
export { extractNetworkProtocol } from './metrics/utils';
|
|
5
|
-
export { trackClsAsSpan, trackInpAsSpan, trackLcpAsSpan } from './metrics/webVitalSpans';
|
|
6
|
-
export { whenIdleOrHidden } from './metrics/web-vitals/lib/whenIdleOrHidden';
|
|
7
|
-
export { addClickKeypressInstrumentationHandler } from './instrument/dom';
|
|
8
|
-
export { addHistoryInstrumentationHandler } from './instrument/history';
|
|
9
|
-
export { fetch, setTimeout, clearCachedImplementation, getNativeImplementation } from './getNativeImplementation';
|
|
10
|
-
export { addXhrInstrumentationHandler, SENTRY_XHR_DATA_KEY } from './instrument/xhr';
|
|
11
|
-
export { getBodyString, getFetchRequestArgBody, serializeFormData, parseXhrResponseHeaders } from './networkUtils';
|
|
12
|
-
export { resourceTimingToSpanAttributes } from './metrics/resourceTiming';
|
|
13
|
-
export { htmlTreeAsString } from './htmlTreeAsString';
|
|
14
|
-
export { isElement } from './is';
|
|
15
|
-
export { getAbsoluteUrl } from './instrument/location';
|
|
16
|
-
export { FetchHint, NetworkMetaWarning, XhrHint } from './types';
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HandlerDataDom } from '@sentry/core';
|
|
2
|
-
/**
|
|
3
|
-
* Add an instrumentation handler for when a click or a keypress happens.
|
|
4
|
-
*
|
|
5
|
-
* Use at your own risk, this might break without changelog notice, only used internally.
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export declare function addClickKeypressInstrumentationHandler(handler: (data: HandlerDataDom) => void): void;
|
|
9
|
-
/** Exported for tests only. */
|
|
10
|
-
export declare function instrumentDOM(): void;
|
|
11
|
-
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { HandlerDataHistory } from '@sentry/core';
|
|
2
|
-
/**
|
|
3
|
-
* Add an instrumentation handler for when a fetch request happens.
|
|
4
|
-
* The handler function is called once when the request starts and once when it ends,
|
|
5
|
-
* which can be identified by checking if it has an `endTimestamp`.
|
|
6
|
-
*
|
|
7
|
-
* Use at your own risk, this might break without changelog notice, only used internally.
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
export declare function addHistoryInstrumentationHandler(handler: (data: HandlerDataHistory) => void): void;
|
|
11
|
-
/**
|
|
12
|
-
* Exported just for testing
|
|
13
|
-
*/
|
|
14
|
-
export declare function instrumentHistory(): void;
|
|
15
|
-
//# sourceMappingURL=history.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param urlOrPath - The URL or path to convert to an absolute URL.
|
|
4
|
-
*
|
|
5
|
-
* @return the absolute URL when handed a relative URL path, by
|
|
6
|
-
* combining the current `window.location.origin` with param urlOrPath.
|
|
7
|
-
*
|
|
8
|
-
* If param urlOrPath is already a full or an invalid URL,
|
|
9
|
-
* or URL determination fails, the original param urlOrPath is returned unchanged.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
export declare function getAbsoluteUrl(urlOrPath: string): string;
|
|
13
|
-
//# sourceMappingURL=location.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { HandlerDataXhr } from '@sentry/core';
|
|
2
|
-
export declare const SENTRY_XHR_DATA_KEY = "__sentry_xhr_v3__";
|
|
3
|
-
/**
|
|
4
|
-
* Add an instrumentation handler for when an XHR request happens.
|
|
5
|
-
* The handler function is called once when the request starts and once when it ends,
|
|
6
|
-
* which can be identified by checking if it has an `endTimestamp`.
|
|
7
|
-
*
|
|
8
|
-
* Use at your own risk, this might break without changelog notice, only used internally.
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export declare function addXhrInstrumentationHandler(handler: (data: HandlerDataXhr) => void): void;
|
|
12
|
-
/** Exported only for tests. */
|
|
13
|
-
export declare function instrumentXHR(): void;
|
|
14
|
-
//# sourceMappingURL=xhr.d.ts.map
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { Client, Span, SpanAttributes } from '@sentry/core';
|
|
2
|
-
interface StartTrackingWebVitalsOptions {
|
|
3
|
-
/**
|
|
4
|
-
* When `true`, CLS is tracked as a standalone span. When `false`, CLS is
|
|
5
|
-
* recorded as a measurement on the pageload span. When `undefined`, CLS
|
|
6
|
-
* tracking is skipped entirely (e.g. because span streaming handles it).
|
|
7
|
-
*/
|
|
8
|
-
recordClsStandaloneSpans: boolean | undefined;
|
|
9
|
-
/**
|
|
10
|
-
* When `true`, LCP is tracked as a standalone span. When `false`, LCP is
|
|
11
|
-
* recorded as a measurement on the pageload span. When `undefined`, LCP
|
|
12
|
-
* tracking is skipped entirely (e.g. because span streaming handles it).
|
|
13
|
-
*/
|
|
14
|
-
recordLcpStandaloneSpans: boolean | undefined;
|
|
15
|
-
client: Client;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Start tracking web vitals.
|
|
19
|
-
* The callback returned by this function can be used to stop tracking & ensure all measurements are final & captured.
|
|
20
|
-
*
|
|
21
|
-
* @deprecated this function will be removed and streamlined once we stop supporting standalone v1
|
|
22
|
-
* @returns A function that forces web vitals collection
|
|
23
|
-
*/
|
|
24
|
-
export declare function startTrackingWebVitals({ recordClsStandaloneSpans, recordLcpStandaloneSpans, client, }: StartTrackingWebVitalsOptions): () => void;
|
|
25
|
-
/**
|
|
26
|
-
* Start tracking long tasks.
|
|
27
|
-
*/
|
|
28
|
-
export declare function startTrackingLongTasks(): void;
|
|
29
|
-
/**
|
|
30
|
-
* Start tracking long animation frames.
|
|
31
|
-
*/
|
|
32
|
-
export declare function startTrackingLongAnimationFrames(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Start tracking interaction events.
|
|
35
|
-
*/
|
|
36
|
-
export declare function startTrackingInteractions(): void;
|
|
37
|
-
export { registerInpInteractionListener, startTrackingINP } from './inp';
|
|
38
|
-
interface AddPerformanceEntriesOptions {
|
|
39
|
-
/**
|
|
40
|
-
* Resource spans with `op`s matching strings in the array will not be emitted.
|
|
41
|
-
*
|
|
42
|
-
* Default: []
|
|
43
|
-
*/
|
|
44
|
-
ignoreResourceSpans: Array<'resouce.script' | 'resource.css' | 'resource.img' | 'resource.other' | string>;
|
|
45
|
-
/**
|
|
46
|
-
* Performance spans created from browser Performance APIs,
|
|
47
|
-
* `performance.mark(...)` nand `performance.measure(...)`
|
|
48
|
-
* with `name`s matching strings in the array will not be emitted.
|
|
49
|
-
*
|
|
50
|
-
* Default: []
|
|
51
|
-
*/
|
|
52
|
-
ignorePerformanceApiSpans: Array<string | RegExp>;
|
|
53
|
-
/**
|
|
54
|
-
* Whether span streaming is enabled.
|
|
55
|
-
*/
|
|
56
|
-
spanStreamingEnabled?: boolean;
|
|
57
|
-
}
|
|
58
|
-
interface AddWebVitalsToSpanOptions {
|
|
59
|
-
/**
|
|
60
|
-
* Flag to determine if CLS should be recorded as a measurement on the pageload span or
|
|
61
|
-
* sent as a standalone span instead.
|
|
62
|
-
* Sending it as a standalone span will yield more accurate LCP values.
|
|
63
|
-
*
|
|
64
|
-
* Default: `false` for backwards compatibility.
|
|
65
|
-
*/
|
|
66
|
-
recordClsOnPageloadSpan: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Flag to determine if LCP should be recorded as a measurement on the pageload span or
|
|
69
|
-
* sent as a standalone span instead.
|
|
70
|
-
* Sending it as a standalone span will yield more accurate LCP values.
|
|
71
|
-
*
|
|
72
|
-
* Default: `false` for backwards compatibility.
|
|
73
|
-
*/
|
|
74
|
-
recordLcpOnPageloadSpan: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Whether span streaming is enabled.
|
|
77
|
-
*/
|
|
78
|
-
spanStreamingEnabled?: boolean;
|
|
79
|
-
}
|
|
80
|
-
/** Add performance related spans to a transaction */
|
|
81
|
-
export declare function addPerformanceEntries(span: Span, options: AddPerformanceEntriesOptions): void;
|
|
82
|
-
/**
|
|
83
|
-
* Writes the collected web vitals (LCP, CLS, INP, TTFB, FP, FCP) onto the pageload span,
|
|
84
|
-
* either as measurements/attributes (v1) or as web vital attributes (span streaming).
|
|
85
|
-
*
|
|
86
|
-
* This should be called when the pageload span ends, after the web vitals have been finalized.
|
|
87
|
-
* It is a no-op for non-pageload spans, but always resets the collected web vital state so it
|
|
88
|
-
* doesn't leak into a subsequent navigation.
|
|
89
|
-
*/
|
|
90
|
-
export declare function addWebVitalsToSpan(span: Span, options: AddWebVitalsToSpanOptions): void;
|
|
91
|
-
/**
|
|
92
|
-
* Create measure related spans.
|
|
93
|
-
* Exported only for tests.
|
|
94
|
-
*/
|
|
95
|
-
export declare function _addMeasureSpans(span: Span, entry: PerformanceEntry, startTime: number, duration: number, timeOrigin: number, ignorePerformanceApiSpans: AddPerformanceEntriesOptions['ignorePerformanceApiSpans']): void;
|
|
96
|
-
/**
|
|
97
|
-
* Instrument navigation entries
|
|
98
|
-
* exported only for tests
|
|
99
|
-
*/
|
|
100
|
-
export declare function _addNavigationSpans(span: Span, entry: PerformanceNavigationTiming, timeOrigin: number): void;
|
|
101
|
-
/**
|
|
102
|
-
* Create resource-related spans.
|
|
103
|
-
* Exported only for tests.
|
|
104
|
-
*/
|
|
105
|
-
export declare function _addResourceSpans(span: Span, entry: PerformanceResourceTiming, resourceUrl: string, startTime: number, duration: number, timeOrigin: number, ignoredResourceSpanOps?: Array<string>): void;
|
|
106
|
-
type ExperimentalResourceTimingProperty = 'renderBlockingStatus' | 'deliveryType' | 'responseStatus';
|
|
107
|
-
/**
|
|
108
|
-
* Use this to set any attributes we can take directly form the PerformanceResourceTiming entry.
|
|
109
|
-
*
|
|
110
|
-
* This is just a mapping function for entry->attribute to keep bundle-size minimal.
|
|
111
|
-
* Experimental properties are also accepted (see {@link ExperimentalResourceTimingProperty}).
|
|
112
|
-
* Assumes that all entry properties might be undefined for browser-specific differences.
|
|
113
|
-
* Only accepts string and number values for now and also sets 0-values.
|
|
114
|
-
*/
|
|
115
|
-
export declare function _setResourceRequestAttributes(entry: Partial<PerformanceResourceTiming> & Partial<Record<ExperimentalResourceTimingProperty, number | string>>, attributes: SpanAttributes, properties: [
|
|
116
|
-
keyof PerformanceResourceTiming | ExperimentalResourceTimingProperty,
|
|
117
|
-
string
|
|
118
|
-
][]): void;
|
|
119
|
-
//# sourceMappingURL=browserMetrics.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Client } from '@sentry/core';
|
|
2
|
-
import { WebVitalReportEvent } from './utils';
|
|
3
|
-
/**
|
|
4
|
-
* Starts tracking the Cumulative Layout Shift on the current page and collects the value once
|
|
5
|
-
*
|
|
6
|
-
* - the page visibility is hidden
|
|
7
|
-
* - a navigation span is started (to stop CLS measurement for SPA soft navigations)
|
|
8
|
-
*
|
|
9
|
-
* Once either of these events triggers, the CLS value is sent as a standalone span and we stop
|
|
10
|
-
* measuring CLS.
|
|
11
|
-
*/
|
|
12
|
-
export declare function trackClsAsStandaloneSpan(client: Client): void;
|
|
13
|
-
/**
|
|
14
|
-
* Exported only for testing!
|
|
15
|
-
*/
|
|
16
|
-
export declare function _sendStandaloneClsSpan(clsValue: number, entry: LayoutShift | undefined, pageloadSpanId: string, reportEvent: WebVitalReportEvent): void;
|
|
17
|
-
//# sourceMappingURL=cls.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Captures [Element Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceElementTiming)
|
|
3
|
-
* data as Sentry metrics.
|
|
4
|
-
*
|
|
5
|
-
* To mark an element for tracking, add the `elementtiming` HTML attribute:
|
|
6
|
-
* ```html
|
|
7
|
-
* <img src="hero.jpg" elementtiming="hero-image" />
|
|
8
|
-
* <p elementtiming="hero-text">Welcome!</p>
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* This emits `ui.element.render_time` and `ui.element.load_time` (for images)
|
|
12
|
-
* as distribution metrics, tagged with the element's identifier and paint type.
|
|
13
|
-
*/
|
|
14
|
-
export declare const elementTimingIntegration: () => import("@sentry/core").Integration & {
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Use `elementTimingIntegration` instead. This function is a no-op and will be removed in a future version.
|
|
19
|
-
*/
|
|
20
|
-
export declare function startTrackingElementTiming(): () => void;
|
|
21
|
-
//# sourceMappingURL=elementTiming.d.ts.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Span } from '@sentry/core';
|
|
2
|
-
import { InstrumentationHandlerCallback } from './instrument';
|
|
3
|
-
interface InteractionContext {
|
|
4
|
-
span: Span | undefined;
|
|
5
|
-
elementName: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* 60 seconds is the maximum for a plausible INP value
|
|
9
|
-
* (source: Me)
|
|
10
|
-
*/
|
|
11
|
-
export declare const MAX_PLAUSIBLE_INP_DURATION = 60;
|
|
12
|
-
/**
|
|
13
|
-
* Start tracking INP webvital events.
|
|
14
|
-
*/
|
|
15
|
-
export declare function startTrackingINP(): () => void;
|
|
16
|
-
export declare const INP_ENTRY_MAP: Record<string, 'click' | 'hover' | 'drag' | 'press'>;
|
|
17
|
-
/** Starts tracking the Interaction to Next Paint on the current page. #
|
|
18
|
-
* exported only for testing
|
|
19
|
-
*/
|
|
20
|
-
export declare function _trackINP(): () => void;
|
|
21
|
-
/**
|
|
22
|
-
* exported only for testing
|
|
23
|
-
*/
|
|
24
|
-
export declare const _onInp: InstrumentationHandlerCallback;
|
|
25
|
-
/**
|
|
26
|
-
* Look up a cached interaction context (element name + root span) by interactionId.
|
|
27
|
-
* Returns undefined if no context was cached for this interaction.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getCachedInteractionContext(interactionId: number | undefined): InteractionContext | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Register a listener to cache route information for INP interactions.
|
|
32
|
-
*/
|
|
33
|
-
export declare function registerInpInteractionListener(): void;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=inp.d.ts.map
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
type InstrumentHandlerTypePerformanceObserver = 'longtask' | 'event' | 'navigation' | 'paint' | 'resource' | 'element' | 'first-input';
|
|
2
|
-
interface PerformanceEntry {
|
|
3
|
-
readonly duration: number;
|
|
4
|
-
readonly entryType: string;
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly startTime: number;
|
|
7
|
-
toJSON(): Record<string, unknown>;
|
|
8
|
-
}
|
|
9
|
-
export interface PerformanceEventTiming extends PerformanceEntry {
|
|
10
|
-
processingStart: number;
|
|
11
|
-
processingEnd: number;
|
|
12
|
-
duration: number;
|
|
13
|
-
cancelable?: boolean;
|
|
14
|
-
target?: unknown | null;
|
|
15
|
-
interactionId?: number;
|
|
16
|
-
}
|
|
17
|
-
interface PerformanceScriptTiming extends PerformanceEntry {
|
|
18
|
-
sourceURL: string;
|
|
19
|
-
sourceFunctionName: string;
|
|
20
|
-
sourceCharPosition: number;
|
|
21
|
-
invoker: string;
|
|
22
|
-
invokerType: string;
|
|
23
|
-
}
|
|
24
|
-
export interface PerformanceLongAnimationFrameTiming extends PerformanceEntry {
|
|
25
|
-
scripts: PerformanceScriptTiming[];
|
|
26
|
-
}
|
|
27
|
-
interface Metric {
|
|
28
|
-
/**
|
|
29
|
-
* The name of the metric (in acronym form).
|
|
30
|
-
*/
|
|
31
|
-
name: 'CLS' | 'FCP' | 'INP' | 'LCP' | 'TTFB';
|
|
32
|
-
/**
|
|
33
|
-
* The current value of the metric.
|
|
34
|
-
*/
|
|
35
|
-
value: number;
|
|
36
|
-
/**
|
|
37
|
-
* The rating as to whether the metric value is within the "good",
|
|
38
|
-
* "needs improvement", or "poor" thresholds of the metric.
|
|
39
|
-
*/
|
|
40
|
-
rating: 'good' | 'needs-improvement' | 'poor';
|
|
41
|
-
/**
|
|
42
|
-
* The delta between the current value and the last-reported value.
|
|
43
|
-
* On the first report, `delta` and `value` will always be the same.
|
|
44
|
-
*/
|
|
45
|
-
delta: number;
|
|
46
|
-
/**
|
|
47
|
-
* A unique ID representing this particular metric instance. This ID can
|
|
48
|
-
* be used by an analytics tool to dedupe multiple values sent for the same
|
|
49
|
-
* metric instance, or to group multiple deltas together and calculate a
|
|
50
|
-
* total. It can also be used to differentiate multiple different metric
|
|
51
|
-
* instances sent from the same page, which can happen if the page is
|
|
52
|
-
* restored from the back/forward cache (in that case new metrics object
|
|
53
|
-
* get created).
|
|
54
|
-
*/
|
|
55
|
-
id: string;
|
|
56
|
-
/**
|
|
57
|
-
* Any performance entries relevant to the metric value calculation.
|
|
58
|
-
* The array may also be empty if the metric value was not based on any
|
|
59
|
-
* entries (e.g. a CLS value of 0 given no layout shifts).
|
|
60
|
-
*/
|
|
61
|
-
entries: PerformanceEntry[];
|
|
62
|
-
/**
|
|
63
|
-
* The type of navigation
|
|
64
|
-
*
|
|
65
|
-
* Navigation Timing API (or `undefined` if the browser doesn't
|
|
66
|
-
* support that API). For pages that are restored from the bfcache, this
|
|
67
|
-
* value will be 'back-forward-cache'.
|
|
68
|
-
*/
|
|
69
|
-
navigationType: 'navigate' | 'reload' | 'back-forward' | 'back-forward-cache' | 'prerender' | 'restore';
|
|
70
|
-
}
|
|
71
|
-
type CleanupHandlerCallback = () => void;
|
|
72
|
-
/**
|
|
73
|
-
* Add a callback that will be triggered when a CLS metric is available.
|
|
74
|
-
* Returns a cleanup callback which can be called to remove the instrumentation handler.
|
|
75
|
-
*
|
|
76
|
-
* Pass `stopOnCallback = true` to stop listening for CLS when the cleanup callback is called.
|
|
77
|
-
* This will lead to the CLS being finalized and frozen.
|
|
78
|
-
*/
|
|
79
|
-
export declare function addClsInstrumentationHandler(callback: (data: {
|
|
80
|
-
metric: Metric;
|
|
81
|
-
}) => void, stopOnCallback?: boolean): CleanupHandlerCallback;
|
|
82
|
-
/**
|
|
83
|
-
* Add a callback that will be triggered when a LCP metric is available.
|
|
84
|
-
* Returns a cleanup callback which can be called to remove the instrumentation handler.
|
|
85
|
-
*
|
|
86
|
-
* Pass `stopOnCallback = true` to stop listening for LCP when the cleanup callback is called.
|
|
87
|
-
* This will lead to the LCP being finalized and frozen.
|
|
88
|
-
*/
|
|
89
|
-
export declare function addLcpInstrumentationHandler(callback: (data: {
|
|
90
|
-
metric: Metric;
|
|
91
|
-
}) => void, stopOnCallback?: boolean): CleanupHandlerCallback;
|
|
92
|
-
/**
|
|
93
|
-
* Add a callback that will be triggered when a TTFD metric is available.
|
|
94
|
-
*/
|
|
95
|
-
export declare function addTtfbInstrumentationHandler(callback: (data: {
|
|
96
|
-
metric: Metric;
|
|
97
|
-
}) => void): CleanupHandlerCallback;
|
|
98
|
-
export type InstrumentationHandlerCallback = (data: {
|
|
99
|
-
metric: Pick<Metric, Exclude<keyof Metric, 'entries'>> & {
|
|
100
|
-
entries: PerformanceEventTiming[];
|
|
101
|
-
};
|
|
102
|
-
}) => void;
|
|
103
|
-
/**
|
|
104
|
-
* Add a callback that will be triggered when a INP metric is available.
|
|
105
|
-
* Returns a cleanup callback which can be called to remove the instrumentation handler.
|
|
106
|
-
*/
|
|
107
|
-
export declare function addInpInstrumentationHandler(callback: InstrumentationHandlerCallback): CleanupHandlerCallback;
|
|
108
|
-
export declare function addPerformanceInstrumentationHandler(type: 'event', callback: (data: {
|
|
109
|
-
entries: ((PerformanceEntry & {
|
|
110
|
-
target?: unknown | null;
|
|
111
|
-
}) | PerformanceEventTiming)[];
|
|
112
|
-
}) => void): CleanupHandlerCallback;
|
|
113
|
-
export declare function addPerformanceInstrumentationHandler(type: InstrumentHandlerTypePerformanceObserver, callback: (data: {
|
|
114
|
-
entries: PerformanceEntry[];
|
|
115
|
-
}) => void): CleanupHandlerCallback;
|
|
116
|
-
/**
|
|
117
|
-
* Check if a PerformanceEntry is a PerformanceEventTiming by checking for the `duration` property.
|
|
118
|
-
*/
|
|
119
|
-
export declare function isPerformanceEventTiming(entry: PerformanceEntry): entry is PerformanceEventTiming;
|
|
120
|
-
export {};
|
|
121
|
-
//# sourceMappingURL=instrument.d.ts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Client } from '@sentry/core';
|
|
2
|
-
import { WebVitalReportEvent } from './utils';
|
|
3
|
-
/**
|
|
4
|
-
* 60 seconds is the maximum for a plausible LCP value.
|
|
5
|
-
*/
|
|
6
|
-
export declare const MAX_PLAUSIBLE_LCP_DURATION = 60000;
|
|
7
|
-
export declare function isValidLcpMetric(lcpValue: number | undefined): lcpValue is number;
|
|
8
|
-
/**
|
|
9
|
-
* Starts tracking the Largest Contentful Paint on the current page and collects the value once
|
|
10
|
-
*
|
|
11
|
-
* - the page visibility is hidden
|
|
12
|
-
* - a navigation span is started (to stop LCP measurement for SPA soft navigations)
|
|
13
|
-
*
|
|
14
|
-
* Once either of these events triggers, the LCP value is sent as a standalone span and we stop
|
|
15
|
-
* measuring LCP for subsequent routes.
|
|
16
|
-
*/
|
|
17
|
-
export declare function trackLcpAsStandaloneSpan(client: Client): void;
|
|
18
|
-
/**
|
|
19
|
-
* Exported only for testing!
|
|
20
|
-
*/
|
|
21
|
-
export declare function _sendStandaloneLcpSpan(lcpValue: number, entry: LargestContentfulPaint | undefined, pageloadSpanId: string, reportEvent: WebVitalReportEvent): void;
|
|
22
|
-
//# sourceMappingURL=lcp.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SpanAttributes } from '@sentry/core';
|
|
2
|
-
/**
|
|
3
|
-
* Converts a PerformanceResourceTiming entry to span data for the resource span. Most importantly,
|
|
4
|
-
* it converts the timing values from timestamps relative to the `performance.timeOrigin` to absolute timestamps
|
|
5
|
-
* in seconds.
|
|
6
|
-
*
|
|
7
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming#timestamps
|
|
8
|
-
*
|
|
9
|
-
* @param resourceTiming
|
|
10
|
-
* @returns An array where the first element is the attribute name and the second element is the attribute value.
|
|
11
|
-
*/
|
|
12
|
-
export declare function resourceTimingToSpanAttributes(resourceTiming: PerformanceResourceTiming): SpanAttributes;
|
|
13
|
-
//# sourceMappingURL=resourceTiming.d.ts.map
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Client, Span, SpanAttributes, SpanTimeInput, StartSpanOptions } from '@sentry/core';
|
|
2
|
-
export type WebVitalReportEvent = 'pagehide' | 'navigation';
|
|
3
|
-
/**
|
|
4
|
-
* Checks if a given value is a valid measurement value.
|
|
5
|
-
*/
|
|
6
|
-
export declare function isMeasurementValue(value: unknown): value is number;
|
|
7
|
-
/**
|
|
8
|
-
* Helper function to start child on transactions. This function will make sure that the transaction will
|
|
9
|
-
* use the start timestamp of the created child span if it is earlier than the transactions actual
|
|
10
|
-
* start timestamp.
|
|
11
|
-
*/
|
|
12
|
-
export declare function startAndEndSpan(parentSpan: Span, startTimeInSeconds: number, endTime: SpanTimeInput, { ...ctx }: StartSpanOptions): Span | undefined;
|
|
13
|
-
interface StandaloneWebVitalSpanOptions {
|
|
14
|
-
name: string;
|
|
15
|
-
transaction?: string;
|
|
16
|
-
attributes: SpanAttributes;
|
|
17
|
-
startTime: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Starts an inactive, standalone span used to send web vital values to Sentry.
|
|
21
|
-
* DO NOT use this for arbitrary spans, as these spans require special handling
|
|
22
|
-
* during ingestion to extract metrics.
|
|
23
|
-
*
|
|
24
|
-
* This function adds a bunch of attributes and data to the span that's shared
|
|
25
|
-
* by all web vital standalone spans. However, you need to take care of adding
|
|
26
|
-
* the actual web vital value as an event to the span. Also, you need to assign
|
|
27
|
-
* a transaction name and some other values that are specific to the web vital.
|
|
28
|
-
*
|
|
29
|
-
* Ultimately, you also need to take care of ending the span to send it off.
|
|
30
|
-
*
|
|
31
|
-
* @param options
|
|
32
|
-
*
|
|
33
|
-
* @returns an inactive, standalone and NOT YET ended span
|
|
34
|
-
*/
|
|
35
|
-
export declare function startStandaloneWebVitalSpan(options: StandaloneWebVitalSpanOptions): Span | undefined;
|
|
36
|
-
/** Get the browser performance API. */
|
|
37
|
-
export declare function getBrowserPerformanceAPI(): Performance | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Converts from milliseconds to seconds
|
|
40
|
-
* @param time time in ms
|
|
41
|
-
*/
|
|
42
|
-
export declare function msToSec(time: number): number;
|
|
43
|
-
/**
|
|
44
|
-
* Converts ALPN protocol ids to name and version.
|
|
45
|
-
*
|
|
46
|
-
* (https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids)
|
|
47
|
-
* @param nextHopProtocol PerformanceResourceTiming.nextHopProtocol
|
|
48
|
-
*/
|
|
49
|
-
export declare function extractNetworkProtocol(nextHopProtocol: string): {
|
|
50
|
-
name: string;
|
|
51
|
-
version: string;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Generic support check for web vitals
|
|
55
|
-
*/
|
|
56
|
-
export declare function supportsWebVital(entryType: 'layout-shift' | 'largest-contentful-paint'): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Listens for events on which we want to collect a previously accumulated web vital value.
|
|
59
|
-
* Currently, this includes:
|
|
60
|
-
*
|
|
61
|
-
* - pagehide (i.e. user minimizes browser window, hides tab, etc)
|
|
62
|
-
* - soft navigation (we only care about the vital of the initially loaded route)
|
|
63
|
-
*
|
|
64
|
-
* As a "side-effect", this function will also collect the span id of the pageload span.
|
|
65
|
-
*
|
|
66
|
-
* @param collectorCallback the callback to be called when the first of these events is triggered. Parameters:
|
|
67
|
-
* - event: the event that triggered the reporting of the web vital value.
|
|
68
|
-
* - pageloadSpanId: the span id of the pageload span. This is used to link the web vital span to the pageload span.
|
|
69
|
-
* - pageloadSpan: the pageload span instance. This is used for full access to the pageload span for span streaming.
|
|
70
|
-
*/
|
|
71
|
-
export declare function listenForWebVitalReportEvents(client: Client, collectorCallback: (event: WebVitalReportEvent, pageloadSpanId: string, pageloadSpan?: Span) => void): void;
|
|
72
|
-
export {};
|
|
73
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { CLSMetric, MetricRatingThresholds, ReportOpts } from './types';
|
|
2
|
-
/** Thresholds for CLS. See https://web.dev/articles/cls#what_is_a_good_cls_score */
|
|
3
|
-
export declare const CLSThresholds: MetricRatingThresholds;
|
|
4
|
-
/**
|
|
5
|
-
* Calculates the [CLS](https://web.dev/articles/cls) value for the current page and
|
|
6
|
-
* calls the `callback` function once the value is ready to be reported, along
|
|
7
|
-
* with all `layout-shift` performance entries that were used in the metric
|
|
8
|
-
* value calculation. The reported value is a `double` (corresponding to a
|
|
9
|
-
* [layout shift score](https://web.dev/articles/cls#layout_shift_score)).
|
|
10
|
-
*
|
|
11
|
-
* If the `reportAllChanges` configuration option is set to `true`, the
|
|
12
|
-
* `callback` function will be called as soon as the value is initially
|
|
13
|
-
* determined as well as any time the value changes throughout the page
|
|
14
|
-
* lifespan.
|
|
15
|
-
*
|
|
16
|
-
* _**Important:** CLS should be continually monitored for changes throughout
|
|
17
|
-
* the entire lifespan of a page—including if the user returns to the page after
|
|
18
|
-
* it's been hidden/backgrounded. However, since browsers often [will not fire
|
|
19
|
-
* additional callbacks once the user has backgrounded a
|
|
20
|
-
* page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),
|
|
21
|
-
* `callback` is always called when the page's visibility state changes to
|
|
22
|
-
* hidden. As a result, the `callback` function might be called multiple times
|
|
23
|
-
* during the same page load._
|
|
24
|
-
*/
|
|
25
|
-
export declare const onCLS: (onReport: (metric: CLSMetric) => void, opts?: ReportOpts) => void;
|
|
26
|
-
//# sourceMappingURL=getCLS.d.ts.map
|