@sentry/browser-utils 11.4.0 → 11.6.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.
Files changed (42) hide show
  1. package/build/cjs/getNativeImplementation.js +8 -1
  2. package/build/cjs/getNativeImplementation.js.map +1 -1
  3. package/build/cjs/performance/entries.js +43 -39
  4. package/build/cjs/performance/entries.js.map +1 -1
  5. package/build/cjs/performance/interactions.js +4 -1
  6. package/build/cjs/performance/interactions.js.map +1 -1
  7. package/build/cjs/performance/resourceTiming.js +7 -5
  8. package/build/cjs/performance/resourceTiming.js.map +1 -1
  9. package/build/cjs/performance/userTiming.js +17 -22
  10. package/build/cjs/performance/userTiming.js.map +1 -1
  11. package/build/cjs/web-vitals/emitSpan.js +3 -3
  12. package/build/cjs/web-vitals/emitSpan.js.map +1 -1
  13. package/build/cjs/web-vitals/softNavs.js +1 -1
  14. package/build/cjs/web-vitals/softNavs.js.map +1 -1
  15. package/build/cjs/web-vitals/spans.js +9 -9
  16. package/build/cjs/web-vitals/spans.js.map +1 -1
  17. package/build/esm/getNativeImplementation.js +8 -1
  18. package/build/esm/getNativeImplementation.js.map +1 -1
  19. package/build/esm/package.json +1 -1
  20. package/build/esm/performance/entries.js +45 -41
  21. package/build/esm/performance/entries.js.map +1 -1
  22. package/build/esm/performance/interactions.js +5 -2
  23. package/build/esm/performance/interactions.js.map +1 -1
  24. package/build/esm/performance/resourceTiming.js +9 -7
  25. package/build/esm/performance/resourceTiming.js.map +1 -1
  26. package/build/esm/performance/userTiming.js +19 -24
  27. package/build/esm/performance/userTiming.js.map +1 -1
  28. package/build/esm/web-vitals/emitSpan.js +5 -5
  29. package/build/esm/web-vitals/emitSpan.js.map +1 -1
  30. package/build/esm/web-vitals/softNavs.js +3 -3
  31. package/build/esm/web-vitals/softNavs.js.map +1 -1
  32. package/build/esm/web-vitals/spans.js +11 -11
  33. package/build/esm/web-vitals/spans.js.map +1 -1
  34. package/build/types/getNativeImplementation.d.ts.map +1 -1
  35. package/build/types/performance/entries.d.ts +3 -3
  36. package/build/types/performance/entries.d.ts.map +1 -1
  37. package/build/types/performance/resourceTiming.d.ts.map +1 -1
  38. package/build/types/performance/userTiming.d.ts +1 -1
  39. package/build/types/performance/userTiming.d.ts.map +1 -1
  40. package/build/types/web-vitals/emitSpan.d.ts.map +1 -1
  41. package/build/types/web-vitals/spans.d.ts.map +1 -1
  42. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
2
- import { defineIntegration, browserPerformanceTimeOrigin, spanToJSON, stringMatchesSomePattern, isPrimitive } from '@sentry/core';
3
- import { getBrowserPerformanceAPI, msToSec, startAndEndSpan } from './utils.js';
2
+ import { defineIntegration, spanToJSON, _INTERNAL_performanceTimeToSeconds, stringMatchesSomePattern, isPrimitive } from '@sentry/core';
3
+ import { getBrowserPerformanceAPI, startAndEndSpan } from './utils.js';
4
4
  import { getNavigationEntry } from '../web-vitals/utils.js';
5
5
 
6
6
  const INTEGRATION_NAME = "UserTiming";
@@ -9,11 +9,9 @@ const _userTimingIntegration = ((options = {}) => {
9
9
  name: INTEGRATION_NAME,
10
10
  setup(client) {
11
11
  const performance = getBrowserPerformanceAPI();
12
- const timeOrigin = browserPerformanceTimeOrigin();
13
- if (!performance?.getEntries || !timeOrigin) {
12
+ if (!performance?.getEntries) {
14
13
  return;
15
14
  }
16
- const timeOriginInSeconds = msToSec(timeOrigin);
17
15
  let performanceCursor = 0;
18
16
  client.on("beforeIdleSpanEnd", (idleSpan) => {
19
17
  const { attributes, start_timestamp: parentStartTimestamp } = spanToJSON(idleSpan);
@@ -21,26 +19,25 @@ const _userTimingIntegration = ((options = {}) => {
21
19
  if (parentOp !== "pageload" && parentOp !== "navigation") {
22
20
  return;
23
21
  }
24
- const requestTime = msToSec(getNavigationEntry(false)?.requestStart ?? 0);
22
+ const requestStart = getNavigationEntry(false)?.requestStart ?? 0;
25
23
  const performanceEntries = performance.getEntries();
26
24
  for (const entry of performanceEntries.slice(performanceCursor)) {
27
25
  if (entry.entryType !== "mark" && entry.entryType !== "measure") {
28
26
  continue;
29
27
  }
30
- const startTime = msToSec(entry.startTime);
31
- const absoluteStartTime = timeOriginInSeconds + startTime;
32
- if (parentOp === "navigation" && parentStartTimestamp && absoluteStartTime < parentStartTimestamp) {
28
+ const startTimestamp = _INTERNAL_performanceTimeToSeconds(entry.startTime);
29
+ if (!startTimestamp) {
33
30
  continue;
34
31
  }
35
- _addUserTimingSpan(
36
- idleSpan,
37
- entry,
38
- startTime,
39
- msToSec(Math.max(0, entry.duration)),
40
- timeOriginInSeconds,
41
- requestTime,
42
- options.ignore ?? []
32
+ if (parentOp === "navigation" && parentStartTimestamp && startTimestamp < parentStartTimestamp) {
33
+ continue;
34
+ }
35
+ const endTimestamp = _INTERNAL_performanceTimeToSeconds(
36
+ entry.startTime + Math.max(0, entry.duration),
37
+ entry.startTime
43
38
  );
39
+ const requestTimestamp = _INTERNAL_performanceTimeToSeconds(requestStart, entry.startTime);
40
+ _addUserTimingSpan(idleSpan, entry, startTimestamp, endTimestamp, requestTimestamp, options.ignore ?? []);
44
41
  }
45
42
  performanceCursor = performanceEntries.length;
46
43
  });
@@ -48,23 +45,21 @@ const _userTimingIntegration = ((options = {}) => {
48
45
  };
49
46
  });
50
47
  const userTimingIntegration = defineIntegration(_userTimingIntegration);
51
- function _addUserTimingSpan(parentSpan, entry, startTime, duration, timeOrigin, requestTime, ignore) {
48
+ function _addUserTimingSpan(parentSpan, entry, startTimestamp, endTimestamp, requestTimestamp, ignore) {
52
49
  if (isReact19MeasureEntry(entry) || stringMatchesSomePattern(entry.name, ignore)) {
53
50
  return;
54
51
  }
55
- const spanStartTimestamp = timeOrigin + Math.max(startTime, requestTime);
56
- const originalStartTimestamp = timeOrigin + startTime;
57
- const spanEndTimestamp = originalStartTimestamp + duration;
52
+ const spanStartTimestamp = Math.max(startTimestamp, requestTimestamp);
58
53
  const attributes = {
59
54
  [SENTRY_ORIGIN]: `auto.browser.user_timing.${entry.entryType}`
60
55
  };
61
- if (spanStartTimestamp !== originalStartTimestamp) {
56
+ if (spanStartTimestamp !== startTimestamp) {
62
57
  attributes["sentry.browser.measure_happened_before_request"] = true;
63
58
  attributes["sentry.browser.measure_start_time"] = spanStartTimestamp;
64
59
  }
65
60
  addDetailToSpanAttributes(attributes, entry);
66
- if (spanStartTimestamp <= spanEndTimestamp) {
67
- startAndEndSpan(parentSpan, spanStartTimestamp, spanEndTimestamp, {
61
+ if (spanStartTimestamp <= endTimestamp) {
62
+ startAndEndSpan(parentSpan, spanStartTimestamp, endTimestamp, {
68
63
  name: entry.name,
69
64
  op: entry.entryType,
70
65
  attributes
@@ -1 +1 @@
1
- {"version":3,"file":"userTiming.js","sources":["../../../src/performance/userTiming.ts"],"sourcesContent":["import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';\nimport type { IntegrationFn, Span, SpanAttributes, SpanAttributeValue } from '@sentry/core';\nimport {\n browserPerformanceTimeOrigin,\n defineIntegration,\n isPrimitive,\n spanToJSON,\n stringMatchesSomePattern,\n} from '@sentry/core';\nimport { getBrowserPerformanceAPI, msToSec, startAndEndSpan } from './utils';\nimport { getNavigationEntry } from '../web-vitals/utils';\n\ninterface UserTimingOptions {\n /**\n * User Timing entries with names matching any of these strings or regular expressions will not be emitted.\n *\n * Default: []\n */\n ignore?: Array<string | RegExp>;\n}\n\nconst INTEGRATION_NAME = 'UserTiming';\n\nconst _userTimingIntegration = ((options: UserTimingOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const performance = getBrowserPerformanceAPI();\n const timeOrigin = browserPerformanceTimeOrigin();\n if (!performance?.getEntries || !timeOrigin) {\n return;\n }\n const timeOriginInSeconds = msToSec(timeOrigin);\n let performanceCursor = 0;\n\n client.on('beforeIdleSpanEnd', idleSpan => {\n const { attributes, start_timestamp: parentStartTimestamp } = spanToJSON(idleSpan);\n const parentOp = attributes[SENTRY_OP];\n\n if (parentOp !== 'pageload' && parentOp !== 'navigation') {\n return;\n }\n\n const requestTime = msToSec(getNavigationEntry(false)?.requestStart ?? 0);\n const performanceEntries = performance.getEntries();\n\n for (const entry of performanceEntries.slice(performanceCursor)) {\n if (entry.entryType !== 'mark' && entry.entryType !== 'measure') {\n continue;\n }\n\n const startTime = msToSec(entry.startTime);\n const absoluteStartTime = timeOriginInSeconds + startTime;\n\n if (parentOp === 'navigation' && parentStartTimestamp && absoluteStartTime < parentStartTimestamp) {\n continue;\n }\n\n _addUserTimingSpan(\n idleSpan,\n entry,\n startTime,\n msToSec(Math.max(0, entry.duration)),\n timeOriginInSeconds,\n requestTime,\n options.ignore ?? [],\n );\n }\n\n performanceCursor = performanceEntries.length;\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Captures spans created with the browser's User Timing APIs, `performance.mark` and `performance.measure`.\n *\n * The integration must be explicitly added to `Sentry.init`. Entries are attached to the active pageload or\n * navigation span when it ends.\n *\n * @example\n * ```ts\n * Sentry.init({\n * integrations: [\n * Sentry.browserTracingIntegration(),\n * Sentry.userTimingIntegration({\n * ignore: ['third-party-mark', /framework-measure/],\n * }),\n * ],\n * });\n * ```\n */\nexport const userTimingIntegration = defineIntegration(_userTimingIntegration);\n\n/**\n * Creates a span for a browser User Timing entry.\n * Exported only for tests.\n */\nexport function _addUserTimingSpan(\n parentSpan: Span,\n entry: PerformanceEntry,\n startTime: number,\n duration: number,\n timeOrigin: number,\n requestTime: number,\n ignore: Array<string | RegExp>,\n): void {\n if (isReact19MeasureEntry(entry) || stringMatchesSomePattern(entry.name, ignore)) {\n return;\n }\n\n // Measures can reference arbitrary timestamps, including timestamps before the page request started.\n const spanStartTimestamp = timeOrigin + Math.max(startTime, requestTime);\n const originalStartTimestamp = timeOrigin + startTime;\n const spanEndTimestamp = originalStartTimestamp + duration;\n\n const attributes: SpanAttributes = {\n [SENTRY_ORIGIN]: `auto.browser.user_timing.${entry.entryType}`,\n };\n\n if (spanStartTimestamp !== originalStartTimestamp) {\n attributes['sentry.browser.measure_happened_before_request'] = true;\n attributes['sentry.browser.measure_start_time'] = spanStartTimestamp;\n }\n\n addDetailToSpanAttributes(attributes, entry as PerformanceMeasure);\n\n // Third-party measurements can contain timestamps which would produce invalid spans.\n if (spanStartTimestamp <= spanEndTimestamp) {\n startAndEndSpan(parentSpan, spanStartTimestamp, spanEndTimestamp, {\n name: entry.name,\n op: entry.entryType,\n attributes,\n });\n }\n}\n\n/**\n * React 19.2+ creates performance.measure entries for component renders.\n * We can identify them by the `detail.devtools.track` property being set to 'Components ⚛'.\n * See https://react.dev/reference/dev-tools/react-performance-tracks.\n */\nfunction isReact19MeasureEntry(entry: PerformanceEntry): boolean | void {\n if (entry.entryType !== 'measure') {\n return;\n }\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return (entry as PerformanceMeasure).detail.devtools.track === 'Components ⚛';\n } catch {\n return;\n }\n}\n\nfunction addDetailToSpanAttributes(attributes: SpanAttributes, entry: PerformanceMeasure): void {\n try {\n // Accessing detail can throw in some browsers due to security restrictions.\n const detail = entry.detail;\n if (!detail) {\n return;\n }\n\n if (typeof detail === 'object') {\n for (const [key, value] of Object.entries(detail)) {\n if (value && isPrimitive(value)) {\n attributes[`sentry.browser.measure.detail.${key}`] = value as SpanAttributeValue;\n } else if (value !== undefined) {\n try {\n attributes[`sentry.browser.measure.detail.${key}`] = JSON.stringify(value);\n } catch {\n // User-provided detail values are not guaranteed to be serializable.\n }\n }\n }\n return;\n }\n\n if (isPrimitive(detail)) {\n attributes['sentry.browser.measure.detail'] = detail as SpanAttributeValue;\n return;\n }\n\n try {\n attributes['sentry.browser.measure.detail'] = JSON.stringify(detail);\n } catch {\n // User-provided detail values are not guaranteed to be serializable.\n }\n } catch {\n // Accessing detail can throw in some browsers due to security restrictions.\n }\n}\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,gBAAA,GAAmB,YAAA;AAEzB,MAAM,sBAAA,IAA0B,CA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CAAA;AAAA,IACrE,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;;;;"}
1
+ {"version":3,"file":"userTiming.js","sources":["../../../src/performance/userTiming.ts"],"sourcesContent":["import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';\nimport type { IntegrationFn, Span, SpanAttributes, SpanAttributeValue } from '@sentry/core';\nimport {\n defineIntegration,\n isPrimitive,\n _INTERNAL_performanceTimeToSeconds,\n spanToJSON,\n stringMatchesSomePattern,\n} from '@sentry/core';\nimport { getBrowserPerformanceAPI, startAndEndSpan } from './utils';\nimport { getNavigationEntry } from '../web-vitals/utils';\n\ninterface UserTimingOptions {\n /**\n * User Timing entries with names matching any of these strings or regular expressions will not be emitted.\n *\n * Default: []\n */\n ignore?: Array<string | RegExp>;\n}\n\nconst INTEGRATION_NAME = 'UserTiming';\n\nconst _userTimingIntegration = ((options: UserTimingOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const performance = getBrowserPerformanceAPI();\n if (!performance?.getEntries) {\n return;\n }\n let performanceCursor = 0;\n\n client.on('beforeIdleSpanEnd', idleSpan => {\n const { attributes, start_timestamp: parentStartTimestamp } = spanToJSON(idleSpan);\n const parentOp = attributes[SENTRY_OP];\n\n if (parentOp !== 'pageload' && parentOp !== 'navigation') {\n return;\n }\n\n const requestStart = getNavigationEntry(false)?.requestStart ?? 0;\n const performanceEntries = performance.getEntries();\n\n for (const entry of performanceEntries.slice(performanceCursor)) {\n if (entry.entryType !== 'mark' && entry.entryType !== 'measure') {\n continue;\n }\n\n const startTimestamp = _INTERNAL_performanceTimeToSeconds(entry.startTime);\n if (!startTimestamp) {\n continue;\n }\n\n if (parentOp === 'navigation' && parentStartTimestamp && startTimestamp < parentStartTimestamp) {\n continue;\n }\n\n const endTimestamp = _INTERNAL_performanceTimeToSeconds(\n entry.startTime + Math.max(0, entry.duration),\n entry.startTime,\n ) as number;\n\n // We convert the request start with the entry's time origin, so that the clamp in `_addUserTimingSpan` compares\n // timestamps on the same timeline, even if the time origin was corrected between the request and the entry.\n const requestTimestamp = _INTERNAL_performanceTimeToSeconds(requestStart, entry.startTime) as number;\n\n _addUserTimingSpan(idleSpan, entry, startTimestamp, endTimestamp, requestTimestamp, options.ignore ?? []);\n }\n\n performanceCursor = performanceEntries.length;\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Captures spans created with the browser's User Timing APIs, `performance.mark` and `performance.measure`.\n *\n * The integration must be explicitly added to `Sentry.init`. Entries are attached to the active pageload or\n * navigation span when it ends.\n *\n * @example\n * ```ts\n * Sentry.init({\n * integrations: [\n * Sentry.browserTracingIntegration(),\n * Sentry.userTimingIntegration({\n * ignore: ['third-party-mark', /framework-measure/],\n * }),\n * ],\n * });\n * ```\n */\nexport const userTimingIntegration = defineIntegration(_userTimingIntegration);\n\n/**\n * Creates a span for a browser User Timing entry.\n * Exported only for tests.\n */\nexport function _addUserTimingSpan(\n parentSpan: Span,\n entry: PerformanceEntry,\n startTimestamp: number,\n endTimestamp: number,\n requestTimestamp: number,\n ignore: Array<string | RegExp>,\n): void {\n if (isReact19MeasureEntry(entry) || stringMatchesSomePattern(entry.name, ignore)) {\n return;\n }\n\n // Measures can reference arbitrary timestamps, including timestamps before the page request started.\n const spanStartTimestamp = Math.max(startTimestamp, requestTimestamp);\n\n const attributes: SpanAttributes = {\n [SENTRY_ORIGIN]: `auto.browser.user_timing.${entry.entryType}`,\n };\n\n if (spanStartTimestamp !== startTimestamp) {\n attributes['sentry.browser.measure_happened_before_request'] = true;\n attributes['sentry.browser.measure_start_time'] = spanStartTimestamp;\n }\n\n addDetailToSpanAttributes(attributes, entry as PerformanceMeasure);\n\n // Third-party measurements can contain timestamps which would produce invalid spans.\n if (spanStartTimestamp <= endTimestamp) {\n startAndEndSpan(parentSpan, spanStartTimestamp, endTimestamp, {\n name: entry.name,\n op: entry.entryType,\n attributes,\n });\n }\n}\n\n/**\n * React 19.2+ creates performance.measure entries for component renders.\n * We can identify them by the `detail.devtools.track` property being set to 'Components ⚛'.\n * See https://react.dev/reference/dev-tools/react-performance-tracks.\n */\nfunction isReact19MeasureEntry(entry: PerformanceEntry): boolean | void {\n if (entry.entryType !== 'measure') {\n return;\n }\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return (entry as PerformanceMeasure).detail.devtools.track === 'Components ⚛';\n } catch {\n return;\n }\n}\n\nfunction addDetailToSpanAttributes(attributes: SpanAttributes, entry: PerformanceMeasure): void {\n try {\n // Accessing detail can throw in some browsers due to security restrictions.\n const detail = entry.detail;\n if (!detail) {\n return;\n }\n\n if (typeof detail === 'object') {\n for (const [key, value] of Object.entries(detail)) {\n if (value && isPrimitive(value)) {\n attributes[`sentry.browser.measure.detail.${key}`] = value as SpanAttributeValue;\n } else if (value !== undefined) {\n try {\n attributes[`sentry.browser.measure.detail.${key}`] = JSON.stringify(value);\n } catch {\n // User-provided detail values are not guaranteed to be serializable.\n }\n }\n }\n return;\n }\n\n if (isPrimitive(detail)) {\n attributes['sentry.browser.measure.detail'] = detail as SpanAttributeValue;\n return;\n }\n\n try {\n attributes['sentry.browser.measure.detail'] = JSON.stringify(detail);\n } catch {\n // User-provided detail values are not guaranteed to be serializable.\n }\n } catch {\n // Accessing detail can throw in some browsers due to security restrictions.\n }\n}\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,gBAAA,GAAmB,YAAA;AAEzB,MAAM,sBAAA,IAA0B,CAAC,OAAA,GAA6B,EAAC,KAAM;AACnE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,MAAM,MAAA,EAAQ;AACZ,MAAA,MAAM,cAAc,wBAAA,EAAyB;AAC7C,MAAA,IAAI,CAAC,aAAa,UAAA,EAAY;AAC5B,QAAA;AAAA,MACF;AACA,MAAA,IAAI,iBAAA,GAAoB,CAAA;AAExB,MAAA,MAAA,CAAO,EAAA,CAAG,qBAAqB,CAAA,QAAA,KAA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AAM,SAAS,KAAA,CAAM,MAAA;AACrB,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,OAAO,WAAW,QAAA,EAAU;AAC9B,MAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,EAAG;AACjD,QAAA,IAAI,KAAA,IAAS,WAAA,CAAY,KAAK,CAAA,EAAG;AAC/B,UAAA,UAAA,CAAW,CAAA,8BAAA,EAAiC,GAAG,CAAA,CAAE,CAAA,GAAI,KAAA;AAAA,QACvD,CAAA,MAAA,IAAW,UAAU,KAAA,CAAA,EAAW;AAC9B,UAAA,IAAI;AACF,YAAA,UAAA,CAAW,iCAAiC,GAAG,CAAA,CAAE,CAAA,GAAI,IAAA,CAAK,UAAU,KAAK,CAAA;AAAA,UAC3E,CAAA,CAAA,MAAQ;AAAA,UAER;AAAA,QACF;AAAA,MACF;AACA,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,WAAA,CAAY,MAAM,CAAA,EAAG;AACvB,MAAA,UAAA,CAAW,+BAA+B,CAAA,GAAI,MAAA;AAC9C,MAAA;AAAA,IACF;AAEA,IAAA,IAAI;AACF,MAAA,UAAA,CAAW,+BAA+B,CAAA,GAAI,IAAA,CAAK,SAAA,CAAU,MAAM,CAAA;AAAA,IACrE,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;;;;"}
@@ -1,6 +1,6 @@
1
- import { getRootSpan, spanToJSON, getCurrentScope, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getClient } from '@sentry/core';
1
+ import { getRootSpan, spanToJSON, getCurrentScope, getClient } from '@sentry/core';
2
2
  import { startInactiveSpan } from '@sentry/core/browser';
3
- import { USER_AGENT_ORIGINAL, BROWSER_NAVIGATION_ID, BROWSER_NAVIGATION_TYPE, SENTRY_SEGMENT_NAME, SENTRY_TRANSACTION, SENTRY_EXCLUSIVE_TIME, SENTRY_REPLAY_ID } from '@sentry/conventions/attributes';
3
+ import { USER_AGENT_ORIGINAL, SENTRY_OP, BROWSER_NAVIGATION_ID, BROWSER_NAVIGATION_TYPE, SENTRY_SEGMENT_NAME, SENTRY_TRANSACTION, SENTRY_EXCLUSIVE_TIME, SENTRY_ORIGIN, SENTRY_REPLAY_ID } from '@sentry/conventions/attributes';
4
4
  import { WINDOW } from '../types.js';
5
5
 
6
6
  function _emitWebVitalSpan(options) {
@@ -21,8 +21,8 @@ function _emitWebVitalSpan(options) {
21
21
  const segmentSpan = parentSpan && getRootSpan(parentSpan);
22
22
  const segmentName = segmentSpan ? spanToJSON(segmentSpan).name : getCurrentScope().getScopeData().transactionName;
23
23
  const attributes = {
24
- [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin,
25
- [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
24
+ [SENTRY_ORIGIN]: origin,
25
+ [SENTRY_OP]: op,
26
26
  [SENTRY_EXCLUSIVE_TIME]: 0,
27
27
  [`browser.web_vital.${metricName}.value`]: value,
28
28
  // oxlint-disable-next-line typescript-eslint/no-deprecated
@@ -32,7 +32,7 @@ function _emitWebVitalSpan(options) {
32
32
  [USER_AGENT_ORIGINAL]: WINDOW.navigator?.userAgent,
33
33
  ...passedAttributes
34
34
  };
35
- if (parentSpan && spanToJSON(parentSpan).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === "pageload") {
35
+ if (parentSpan && spanToJSON(parentSpan).attributes[SENTRY_OP] === "pageload") {
36
36
  attributes["sentry.pageload.span_id"] = parentSpan.spanContext().spanId;
37
37
  }
38
38
  if (softNavigationId != null) {
@@ -1 +1 @@
1
- {"version":3,"file":"emitSpan.js","sources":["../../../src/web-vitals/emitSpan.ts"],"sourcesContent":["import type { Integration, Span, SpanAttributes } from '@sentry/core';\nimport {\n getClient,\n getCurrentScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n} from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/core/browser';\nimport {\n SENTRY_EXCLUSIVE_TIME,\n BROWSER_NAVIGATION_ID,\n BROWSER_NAVIGATION_TYPE,\n SENTRY_REPLAY_ID,\n SENTRY_SEGMENT_NAME,\n SENTRY_TRANSACTION,\n USER_AGENT_ORIGINAL,\n} from '@sentry/conventions/attributes';\nimport { WINDOW } from '../types';\nimport type { MetricNavigationType } from '../instrumentation/performanceObserver';\n\n// Locally-defined interfaces to avoid leaking bare global type references into the\n// generated .d.ts. The `declare global` augmentations in web-vitals/types.ts make these\n// available during this package's compilation but are NOT carried to consumers.\n// This mirrors the pattern used for PerformanceEventTiming in instrument.ts.\nexport interface LayoutShift extends PerformanceEntry {\n value: number;\n sources: Array<{ node: Node | null }>;\n hadRecentInput: boolean;\n}\n\nexport interface LargestContentfulPaint extends PerformanceEntry {\n readonly renderTime: DOMHighResTimeStamp;\n readonly loadTime: DOMHighResTimeStamp;\n readonly size: number;\n readonly id: string;\n readonly url: string;\n readonly element: Element | null;\n}\n\ninterface WebVitalSpanOptions {\n name: string;\n op: string;\n origin: string;\n metricName: 'lcp' | 'cls' | 'inp';\n value: number;\n attributes?: SpanAttributes;\n parentSpan?: Span;\n startTime: number;\n endTime?: number;\n /** Set when the vital was reported for a soft navigation rather than the initial page load. */\n softNavigationId?: number;\n /** The navigation the vital was measured on, as reported by web-vitals. */\n navigationType?: MetricNavigationType;\n /**\n * When `true`, the span is sent on its own as a v2 streamed span instead of being folded into a\n * transaction. Used for INP when span streaming is disabled (it reports late, so it can't ride\n * the pageload transaction).\n *\n * TODO(standalone): remove once the static (transaction) trace lifecycle is dropped and INP always streams.\n */\n standalone?: boolean;\n}\n\n/**\n * Emits a web vital span. When `standalone` is set it is sent on its own as a v2 streamed span;\n * otherwise it flows through the span streaming pipeline as a child of `parentSpan`.\n */\nexport function _emitWebVitalSpan(options: WebVitalSpanOptions): void {\n const {\n name,\n op,\n origin,\n metricName,\n value,\n attributes: passedAttributes,\n parentSpan,\n startTime,\n endTime,\n standalone,\n softNavigationId,\n navigationType,\n } = options;\n\n // Taken off the segment span itself, so it can't diverge from it: a routing instrumentation may\n // rename that span (a pageload span is named `Pageload` until its route resolves), and the scope's\n // transaction name is deliberately not kept in sync with it. Only a standalone span, which is sent\n // without its segment span, has to fall back to the scope.\n const segmentSpan = parentSpan && getRootSpan(parentSpan);\n const segmentName = segmentSpan ? spanToJSON(segmentSpan).name : getCurrentScope().getScopeData().transactionName;\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,\n [SENTRY_EXCLUSIVE_TIME]: 0,\n [`browser.web_vital.${metricName}.value`]: value,\n // oxlint-disable-next-line typescript-eslint/no-deprecated\n [SENTRY_TRANSACTION]: segmentName,\n [SENTRY_SEGMENT_NAME]: segmentName,\n // Web vital score calculation relies on the user agent\n [USER_AGENT_ORIGINAL]: WINDOW.navigator?.userAgent,\n ...passedAttributes,\n };\n\n if (parentSpan && spanToJSON(parentSpan).attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'pageload') {\n // for LCP and CLS, we collect the pageload span id as an attribute\n attributes['sentry.pageload.span_id'] = parentSpan.spanContext().spanId;\n }\n\n if (softNavigationId != null) {\n attributes[BROWSER_NAVIGATION_ID] = softNavigationId;\n }\n\n if (navigationType) {\n attributes[BROWSER_NAVIGATION_TYPE] = navigationType;\n }\n\n // A standalone span is sent as a plain v2 span without running the `processSpan` hooks (see\n // `captureStandaloneSpanWithStaticCallback`), so Replay can't attach the replay id itself. Set it\n // here, mirroring Replay's `processSpan`, so INP keeps its replay association like it did on v1.\n // TODO(standalone): remove once the static (transaction) trace lifecycle is dropped and INP always\n // streams, at which point Replay's `processSpan` runs and attaches the replay id.\n if (standalone) {\n Object.assign(attributes, getReplayAttributes());\n }\n\n const span = startInactiveSpan({\n name,\n attributes,\n startTime,\n parentSpan,\n // oxlint-disable-next-line typescript/no-deprecated -- intentional during the v1/v2 transition; see the TODO(standalone) above\n experimental: standalone ? { standalone: true } : undefined,\n });\n\n if (span) {\n span.end(endTime ?? startTime);\n }\n}\n\ninterface ReplayIntegration extends Integration {\n getReplayId: (onlyIfSampled?: boolean) => string | undefined;\n getRecordingMode: () => 'session' | 'buffer' | undefined;\n}\n\n// TODO(standalone): remove once the static (transaction) trace lifecycle is dropped; Replay's\n// `processSpan` then attaches the replay id to the streamed INP span instead.\nfunction getReplayAttributes(): SpanAttributes {\n const replay = getClient()?.getIntegrationByName<ReplayIntegration>('Replay');\n const replayId = replay?.getReplayId(true);\n if (!replayId) {\n return {};\n }\n\n return {\n [SENTRY_REPLAY_ID]: replayId,\n // Not the `SENTRY_REPLAY_IS_BUFFERING` convention: that one has no `sentry._internal.` prefix, and\n // the rest of the SDK sets the prefixed key (see `logs/internal.ts`, `metrics/internal.ts`).\n 'sentry._internal.replay_is_buffering': replay!.getRecordingMode() === 'buffer' ? true : undefined,\n };\n}\n"],"names":[],"mappings":";;;;;AAqEO,SAAS,kBAAkB,OAAA,EAAoC;AACpE,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,EAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA,EAAY,gBAAA;AAAA,IACZ,UAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAMJ,EAAA,MAAM,WAAA,GAAc,UAAA,IAAc,WAAA,CAAY,UAAU,CAAA;AACxD,EAAA,MAAM,WAAA,GAAc,cAAc,UAAA,CAAW,WAAW,EAAE,IAAA,GAAO,eAAA,EAAgB,CAAE,YAAA,EAAa,CAAE,eAAA;AAElG,EAAA,MAAM,UAAA,GAA6B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AG,oBAAA,CAAwC,QAAQ,CAAA;AAC5E,EAAA,MAAM,QAAA,GAAW,MAAA,EAAQ,WAAA,CAAY,IAAI,CAAA;AACzC,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,OAAO;AAAA,IACL,CAAC,gBAAgB,GAAG,QAAA;AAAA;AAAA;AAAA,IAGpB,sCAAA,EAAwC,MAAA,CAAQ,gBAAA,EAAiB,KAAM,WAAW,IAAA,GAAO;AAAA,GAC3F;AACF;;;;"}
1
+ {"version":3,"file":"emitSpan.js","sources":["../../../src/web-vitals/emitSpan.ts"],"sourcesContent":["import type { Integration, Span, SpanAttributes } from '@sentry/core';\nimport { getClient, getCurrentScope, getRootSpan, spanToJSON } from '@sentry/core';\nimport { startInactiveSpan } from '@sentry/core/browser';\nimport {\n SENTRY_EXCLUSIVE_TIME,\n BROWSER_NAVIGATION_ID,\n BROWSER_NAVIGATION_TYPE,\n SENTRY_REPLAY_ID,\n SENTRY_SEGMENT_NAME,\n SENTRY_TRANSACTION,\n USER_AGENT_ORIGINAL,\n SENTRY_OP,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { WINDOW } from '../types';\nimport type { MetricNavigationType } from '../instrumentation/performanceObserver';\n\n// Locally-defined interfaces to avoid leaking bare global type references into the\n// generated .d.ts. The `declare global` augmentations in web-vitals/types.ts make these\n// available during this package's compilation but are NOT carried to consumers.\n// This mirrors the pattern used for PerformanceEventTiming in instrument.ts.\nexport interface LayoutShift extends PerformanceEntry {\n value: number;\n sources: Array<{ node: Node | null }>;\n hadRecentInput: boolean;\n}\n\nexport interface LargestContentfulPaint extends PerformanceEntry {\n readonly renderTime: DOMHighResTimeStamp;\n readonly loadTime: DOMHighResTimeStamp;\n readonly size: number;\n readonly id: string;\n readonly url: string;\n readonly element: Element | null;\n}\n\ninterface WebVitalSpanOptions {\n name: string;\n op: string;\n origin: string;\n metricName: 'lcp' | 'cls' | 'inp';\n value: number;\n attributes?: SpanAttributes;\n parentSpan?: Span;\n startTime: number;\n endTime?: number;\n /** Set when the vital was reported for a soft navigation rather than the initial page load. */\n softNavigationId?: number;\n /** The navigation the vital was measured on, as reported by web-vitals. */\n navigationType?: MetricNavigationType;\n /**\n * When `true`, the span is sent on its own as a v2 streamed span instead of being folded into a\n * transaction. Used for INP when span streaming is disabled (it reports late, so it can't ride\n * the pageload transaction).\n *\n * TODO(standalone): remove once the static (transaction) trace lifecycle is dropped and INP always streams.\n */\n standalone?: boolean;\n}\n\n/**\n * Emits a web vital span. When `standalone` is set it is sent on its own as a v2 streamed span;\n * otherwise it flows through the span streaming pipeline as a child of `parentSpan`.\n */\nexport function _emitWebVitalSpan(options: WebVitalSpanOptions): void {\n const {\n name,\n op,\n origin,\n metricName,\n value,\n attributes: passedAttributes,\n parentSpan,\n startTime,\n endTime,\n standalone,\n softNavigationId,\n navigationType,\n } = options;\n\n // Taken off the segment span itself, so it can't diverge from it: a routing instrumentation may\n // rename that span (a pageload span is named `Pageload` until its route resolves), and the scope's\n // transaction name is deliberately not kept in sync with it. Only a standalone span, which is sent\n // without its segment span, has to fall back to the scope.\n const segmentSpan = parentSpan && getRootSpan(parentSpan);\n const segmentName = segmentSpan ? spanToJSON(segmentSpan).name : getCurrentScope().getScopeData().transactionName;\n\n const attributes: SpanAttributes = {\n [SENTRY_ORIGIN]: origin,\n [SENTRY_OP]: op,\n [SENTRY_EXCLUSIVE_TIME]: 0,\n [`browser.web_vital.${metricName}.value`]: value,\n // oxlint-disable-next-line typescript-eslint/no-deprecated\n [SENTRY_TRANSACTION]: segmentName,\n [SENTRY_SEGMENT_NAME]: segmentName,\n // Web vital score calculation relies on the user agent\n [USER_AGENT_ORIGINAL]: WINDOW.navigator?.userAgent,\n ...passedAttributes,\n };\n\n if (parentSpan && spanToJSON(parentSpan).attributes[SENTRY_OP] === 'pageload') {\n // for LCP and CLS, we collect the pageload span id as an attribute\n attributes['sentry.pageload.span_id'] = parentSpan.spanContext().spanId;\n }\n\n if (softNavigationId != null) {\n attributes[BROWSER_NAVIGATION_ID] = softNavigationId;\n }\n\n if (navigationType) {\n attributes[BROWSER_NAVIGATION_TYPE] = navigationType;\n }\n\n // A standalone span is sent as a plain v2 span without running the `processSpan` hooks (see\n // `captureStandaloneSpanWithStaticCallback`), so Replay can't attach the replay id itself. Set it\n // here, mirroring Replay's `processSpan`, so INP keeps its replay association like it did on v1.\n // TODO(standalone): remove once the static (transaction) trace lifecycle is dropped and INP always\n // streams, at which point Replay's `processSpan` runs and attaches the replay id.\n if (standalone) {\n Object.assign(attributes, getReplayAttributes());\n }\n\n const span = startInactiveSpan({\n name,\n attributes,\n startTime,\n parentSpan,\n // oxlint-disable-next-line typescript/no-deprecated -- intentional during the v1/v2 transition; see the TODO(standalone) above\n experimental: standalone ? { standalone: true } : undefined,\n });\n\n if (span) {\n span.end(endTime ?? startTime);\n }\n}\n\ninterface ReplayIntegration extends Integration {\n getReplayId: (onlyIfSampled?: boolean) => string | undefined;\n getRecordingMode: () => 'session' | 'buffer' | undefined;\n}\n\n// TODO(standalone): remove once the static (transaction) trace lifecycle is dropped; Replay's\n// `processSpan` then attaches the replay id to the streamed INP span instead.\nfunction getReplayAttributes(): SpanAttributes {\n const replay = getClient()?.getIntegrationByName<ReplayIntegration>('Replay');\n const replayId = replay?.getReplayId(true);\n if (!replayId) {\n return {};\n }\n\n return {\n [SENTRY_REPLAY_ID]: replayId,\n // Not the `SENTRY_REPLAY_IS_BUFFERING` convention: that one has no `sentry._internal.` prefix, and\n // the rest of the SDK sets the prefixed key (see `logs/internal.ts`, `metrics/internal.ts`).\n 'sentry._internal.replay_is_buffering': replay!.getRecordingMode() === 'buffer' ? true : undefined,\n };\n}\n"],"names":[],"mappings":";;;;;AAgEO,SAAS,kBAAkB,OAAA,EAAoC;AACpE,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,EAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA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AAO,iBAAA,CAAkB;AAAA,IAC7B,IAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA;AAAA,IAEA,YAAA,EAAc,UAAA,GAAa,EAAE,UAAA,EAAY,MAAK,GAAI;AAAA,GACnD,CAAA;AAED,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,IAAA,CAAK,GAAA,CAAI,WAAW,SAAS,CAAA;AAAA,EAC/B;AACF;AASA,SAAS,mBAAA,GAAsC;AAC7C,EAAA,MAAM,MAAA,GAAS,SAAA,EAAU,EAAG,oBAAA,CAAwC,QAAQ,CAAA;AAC5E,EAAA,MAAM,QAAA,GAAW,MAAA,EAAQ,WAAA,CAAY,IAAI,CAAA;AACzC,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,OAAO;AAAA,IACL,CAAC,gBAAgB,GAAG,QAAA;AAAA;AAAA;AAAA,IAGpB,sCAAA,EAAwC,MAAA,CAAQ,gBAAA,EAAiB,KAAM,WAAW,IAAA,GAAO;AAAA,GAC3F;AACF;;;;"}
@@ -1,5 +1,5 @@
1
- import { LRUMap, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_OP, debug } from '@sentry/core';
2
- import { BROWSER_NAVIGATION_ID } from '@sentry/conventions/attributes';
1
+ import { LRUMap, spanToJSON, debug } from '@sentry/core';
2
+ import { SENTRY_OP, BROWSER_NAVIGATION_ID } from '@sentry/conventions/attributes';
3
3
  import { DEBUG_BUILD } from '../debug-build.js';
4
4
  import { addPerformanceInstrumentationHandler, isPerformanceEventTiming } from '../instrumentation/performanceObserver.js';
5
5
  import { WINDOW } from '../types.js';
@@ -37,7 +37,7 @@ function startSoftNavigationCorrelation(client) {
37
37
  WINDOW.addEventListener("click", onInteraction, { capture: true, passive: true });
38
38
  WINDOW.addEventListener("keydown", onInteraction, { capture: true, passive: true });
39
39
  client.on("spanStart", (span) => {
40
- if (spanToJSON(span).attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== "navigation") {
40
+ if (spanToJSON(span).attributes?.[SENTRY_OP] !== "navigation") {
41
41
  return;
42
42
  }
43
43
  _pendingNavigation = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"softNavs.js","sources":["../../../src/web-vitals/softNavs.ts"],"sourcesContent":["import type { Client, Span } from '@sentry/core';\nimport { debug, LRUMap, SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON } from '@sentry/core';\nimport { BROWSER_NAVIGATION_ID } from '@sentry/conventions/attributes';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { PerformanceSoftNavigation } from '../instrumentation/performanceObserver';\nimport { addPerformanceInstrumentationHandler, isPerformanceEventTiming } from '../instrumentation/performanceObserver';\nimport { WINDOW } from '../types';\n\n/**\n * A page only ever needs its most recent navigations to still be joinable: web vitals for a soft\n * navigation are finalized at the next soft navigation or on pagehide, never later than that.\n */\nconst MAX_TRACKED_NAVIGATIONS = 5;\n\n/**\n * Tolerance when matching a DOM event's `timeStamp` against the `startTime` of its Event Timing\n * entry. Both are `DOMHighResTimeStamp`s from the same clock, so this only absorbs rounding.\n */\nconst INTERACTION_MATCH_TOLERANCE_MS = 5;\n\ninterface SoftNavMetric {\n navigationType: string;\n navigationId: number;\n navigationInteractionId?: number;\n}\n\ninterface PendingNavigation {\n span: Span;\n interactionTimestamp: number;\n}\n\ninterface PendingInteraction {\n interactionId: number;\n interactionTimestamp: number;\n}\n\n// The navigation span whose triggering interaction we haven't identified yet.\nlet _pendingNavigation: PendingNavigation | undefined;\n// The interaction whose Event Timing entry arrived before any navigation span claimed it.\nlet _pendingInteraction: PendingInteraction | undefined;\n// The timestamp of the most recent trusted click/keydown, i.e. our best guess at the interaction\n// that a history change happening right now was driven by.\nlet _lastInteractionTimestamp: number | undefined;\n\nconst _interactionIdToNavigationSpan = new LRUMap<number, Span>(MAX_TRACKED_NAVIGATIONS);\nconst _navigationIdToNavigationSpan = new LRUMap<number, Span>(MAX_TRACKED_NAVIGATIONS);\n\nlet _correlationStarted = false;\n\n/**\n * Whether an Event Timing entry's `startTime` and a DOM event's `timeStamp` name the same\n * interaction.\n */\nfunction interactionMatches(entryStartTime: number, interactionTimestamp: number): boolean {\n return Math.abs(entryStartTime - interactionTimestamp) <= INTERACTION_MATCH_TOLERANCE_MS;\n}\n\n/**\n * Whether the browser can report web vitals for soft navigations.\n *\n * This mirrors web-vitals' own feature detection: passing `reportSoftNavs` on a browser that fails\n * this check is a no-op there, so it has to be a no-op here too.\n */\nexport function supportsSoftNavigations(): boolean {\n try {\n return (\n PerformanceObserver.supportedEntryTypes.includes('soft-navigation') &&\n // Older implementations exposed this as an attribute rather than a method. Only the method\n // form shipped unflagged, so it's what web-vitals gates on.\n typeof (\n WINDOW as {\n PerformanceSoftNavigation?: { prototype?: { getLargestInteractionContentfulPaint?: unknown } };\n }\n ).PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint === 'function'\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Start correlating the browser's soft navigations with the SDK's navigation spans.\n *\n * A navigation span is created synchronously on the history change, but the browser only mints the\n * `soft-navigation` entry (and with it the `navigationId` that web vitals are reported against)\n * once the navigation has been confirmed by a paint. So the `navigationId` cannot be known at span\n * creation time and the two have to be joined after the fact.\n *\n * The join key is the `interactionId` of the interaction that drove the navigation: per the Soft\n * Navigations spec the `soft-navigation` entry carries the `interactionId` of the interaction that\n * triggered it, which is the same id the interaction's own `PerformanceEventTiming` entry carries.\n * So we bind a navigation span to the interaction it happened during, and the soft navigation\n * joins back to that span through the shared id.\n *\n * This is inherently partial. Navigations that don't meet the browser's soft navigation heuristic\n * (programmatic navigations, navigations that never paint, back/forward from the browser chrome)\n * produce no entry at all, so those navigation spans simply have no web vitals.\n */\nexport function startSoftNavigationCorrelation(client: Client): void {\n if (_correlationStarted || !supportsSoftNavigations()) {\n return;\n }\n _correlationStarted = true;\n\n const onInteraction = (event: Event): void => {\n if (event.isTrusted) {\n _lastInteractionTimestamp = event.timeStamp;\n }\n };\n // Only click and keydown can start a soft navigation, which is also what the SDK's redirect\n // detection listens for.\n WINDOW.addEventListener('click', onInteraction, { capture: true, passive: true });\n WINDOW.addEventListener('keydown', onInteraction, { capture: true, passive: true });\n\n client.on('spanStart', span => {\n if (spanToJSON(span).attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'navigation') {\n return;\n }\n\n // A navigation with no preceding interaction can't produce a soft navigation, so there is\n // nothing to wait for. Dropping the pending span here also keeps us from binding a stale one.\n _pendingNavigation = undefined;\n const interactionTimestamp = _lastInteractionTimestamp;\n if (interactionTimestamp == null) {\n return;\n }\n\n // The interaction's entry may already be here: the router code that starts this span races the\n // paint that flushes the entry, so either one can win.\n if (_pendingInteraction?.interactionTimestamp === interactionTimestamp) {\n _interactionIdToNavigationSpan.set(_pendingInteraction.interactionId, span);\n _pendingInteraction = undefined;\n return;\n }\n\n _pendingNavigation = { span, interactionTimestamp };\n });\n\n const bindInteractionToNavigationSpan = ({ entries }: { entries: PerformanceEntry[] }): void => {\n for (const entry of entries) {\n if (!isPerformanceEventTiming(entry) || !entry.interactionId) {\n continue;\n }\n\n const pending = _pendingNavigation;\n if (pending && interactionMatches(entry.startTime, pending.interactionTimestamp)) {\n _interactionIdToNavigationSpan.set(entry.interactionId, pending.span);\n _pendingNavigation = undefined;\n continue;\n }\n\n // Once a navigation span has claimed this interaction, only a span that is still waiting can\n // rebind it, which the check above already allows. Holding on to the interaction's remaining\n // entries would instead let an unrelated later navigation claim it.\n if (_interactionIdToNavigationSpan.get(entry.interactionId)) {\n continue;\n }\n\n // The navigation span this interaction drove may still be on its way, so hold on to the\n // interaction instead of dropping it. Only the most recent one is worth keeping:\n // `_lastInteractionTimestamp` is what `spanStart` matches against and it only moves forward,\n // so an entry that doesn't match it now can never match it later.\n if (_lastInteractionTimestamp != null && interactionMatches(entry.startTime, _lastInteractionTimestamp)) {\n _pendingInteraction = { interactionId: entry.interactionId, interactionTimestamp: _lastInteractionTimestamp };\n }\n }\n };\n\n // `durationThreshold: 0` is applied for `event` by the shared observer, which matters here:\n // interactions below the 104ms default would otherwise never surface an `interactionId`.\n addPerformanceInstrumentationHandler('event', bindInteractionToNavigationSpan);\n addPerformanceInstrumentationHandler('first-input', bindInteractionToNavigationSpan);\n\n addPerformanceInstrumentationHandler('soft-navigation', ({ entries }) => {\n for (const entry of entries as PerformanceSoftNavigation[]) {\n const span = _interactionIdToNavigationSpan.get(entry.interactionId);\n if (!span) {\n DEBUG_BUILD && debug.log(`[SoftNav] No navigation span found for soft navigation ${entry.navigationId}`, entry);\n continue;\n }\n\n _navigationIdToNavigationSpan.set(entry.navigationId, span);\n // Best effort: the soft navigation entry usually lands well within the navigation span's idle\n // window, but if the span has already been sent this attribute is dropped.\n span.setAttribute(BROWSER_NAVIGATION_ID, entry.navigationId);\n }\n });\n}\n\n/**\n * The navigation span a soft navigation web vital belongs to, or `undefined` if the metric isn't\n * for a soft navigation or we failed to correlate it.\n */\nexport function getNavigationSpanForMetric(metric: SoftNavMetric): Span | undefined {\n if (metric.navigationType !== 'soft-navigation') {\n return undefined;\n }\n\n const span = _navigationIdToNavigationSpan.get(metric.navigationId);\n if (span) {\n return span;\n }\n\n // The `soft-navigation` observer may not have run for this navigation yet - entries from\n // different observers aren't delivered in a guaranteed order - so fall back to the join key the\n // metric carries itself.\n return metric.navigationInteractionId != null\n ? _interactionIdToNavigationSpan.get(metric.navigationInteractionId)\n : undefined;\n}\n"],"names":[],"mappings":";;;;;;AAYA,MAAM,uBAAA,GAA0B,CAAA;AAMhC,MAAM,8BAAA,GAAiC,CAAA;AAmBvC,IAAI,kBAAA;AAEJ,IAAI,mBAAA;AAGJ,IAAI,yBAAA;AAEJ,MAAM,8BAAA,GAAiC,IAAI,MAAA,CAAqB,uBAAuB,CAAA;AACvF,MAAM,6BAAA,GAAgC,IAAI,MAAA,CAAqB,uBAAuB,CAAA;AAEtF,IAAI,mBAAA,GAAsB,KAAA;AAM1B,SAAS,kBAA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;AACvE,IAAA,KAAA,MAAW,SAAS,OAAA,EAAwC;AAC1D,MAAA,MAAM,IAAA,GAAO,8BAAA,CAA+B,GAAA,CAAI,KAAA,CAAM,aAAa,CAAA;AACnE,MAAA,IAAI,CAAC,IAAA,EAAM;AACT,QAAA,WAAA,IAAe,MAAM,GAAA,CAAI,CAAA,uDAAA,EAA0D,KAAA,CAAM,YAAY,IAAI,KAAK,CAAA;AAC9G,QAAA;AAAA,MACF;AAEA,MAAA,6BAAA,CAA8B,GAAA,CAAI,KAAA,CAAM,YAAA,EAAc,IAAI,CAAA;AAG1D,MAAA,IAAA,CAAK,YAAA,CAAa,qBAAA,EAAuB,KAAA,CAAM,YAAY,CAAA;AAAA,IAC7D;AAAA,EACF,CAAC,CAAA;AACH;AAMO,SAAS,2BAA2B,MAAA,EAAyC;AAClF,EAAA,IAAI,MAAA,CAAO,mBAAmB,iBAAA,EAAmB;AAC/C,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,IAAA,GAAO,6BAAA,CAA8B,GAAA,CAAI,MAAA,CAAO,YAAY,CAAA;AAClE,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,OAAO,IAAA;AAAA,EACT;AAKA,EAAA,OAAO,OAAO,uBAAA,IAA2B,IAAA,GACrC,+BAA+B,GAAA,CAAI,MAAA,CAAO,uBAAuB,CAAA,GACjE,MAAA;AACN;;;;"}
1
+ {"version":3,"file":"softNavs.js","sources":["../../../src/web-vitals/softNavs.ts"],"sourcesContent":["import type { Client, Span } from '@sentry/core';\nimport { debug, LRUMap, spanToJSON } from '@sentry/core';\nimport { BROWSER_NAVIGATION_ID, SENTRY_OP } from '@sentry/conventions/attributes';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { PerformanceSoftNavigation } from '../instrumentation/performanceObserver';\nimport { addPerformanceInstrumentationHandler, isPerformanceEventTiming } from '../instrumentation/performanceObserver';\nimport { WINDOW } from '../types';\n\n/**\n * A page only ever needs its most recent navigations to still be joinable: web vitals for a soft\n * navigation are finalized at the next soft navigation or on pagehide, never later than that.\n */\nconst MAX_TRACKED_NAVIGATIONS = 5;\n\n/**\n * Tolerance when matching a DOM event's `timeStamp` against the `startTime` of its Event Timing\n * entry. Both are `DOMHighResTimeStamp`s from the same clock, so this only absorbs rounding.\n */\nconst INTERACTION_MATCH_TOLERANCE_MS = 5;\n\ninterface SoftNavMetric {\n navigationType: string;\n navigationId: number;\n navigationInteractionId?: number;\n}\n\ninterface PendingNavigation {\n span: Span;\n interactionTimestamp: number;\n}\n\ninterface PendingInteraction {\n interactionId: number;\n interactionTimestamp: number;\n}\n\n// The navigation span whose triggering interaction we haven't identified yet.\nlet _pendingNavigation: PendingNavigation | undefined;\n// The interaction whose Event Timing entry arrived before any navigation span claimed it.\nlet _pendingInteraction: PendingInteraction | undefined;\n// The timestamp of the most recent trusted click/keydown, i.e. our best guess at the interaction\n// that a history change happening right now was driven by.\nlet _lastInteractionTimestamp: number | undefined;\n\nconst _interactionIdToNavigationSpan = new LRUMap<number, Span>(MAX_TRACKED_NAVIGATIONS);\nconst _navigationIdToNavigationSpan = new LRUMap<number, Span>(MAX_TRACKED_NAVIGATIONS);\n\nlet _correlationStarted = false;\n\n/**\n * Whether an Event Timing entry's `startTime` and a DOM event's `timeStamp` name the same\n * interaction.\n */\nfunction interactionMatches(entryStartTime: number, interactionTimestamp: number): boolean {\n return Math.abs(entryStartTime - interactionTimestamp) <= INTERACTION_MATCH_TOLERANCE_MS;\n}\n\n/**\n * Whether the browser can report web vitals for soft navigations.\n *\n * This mirrors web-vitals' own feature detection: passing `reportSoftNavs` on a browser that fails\n * this check is a no-op there, so it has to be a no-op here too.\n */\nexport function supportsSoftNavigations(): boolean {\n try {\n return (\n PerformanceObserver.supportedEntryTypes.includes('soft-navigation') &&\n // Older implementations exposed this as an attribute rather than a method. Only the method\n // form shipped unflagged, so it's what web-vitals gates on.\n typeof (\n WINDOW as {\n PerformanceSoftNavigation?: { prototype?: { getLargestInteractionContentfulPaint?: unknown } };\n }\n ).PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint === 'function'\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Start correlating the browser's soft navigations with the SDK's navigation spans.\n *\n * A navigation span is created synchronously on the history change, but the browser only mints the\n * `soft-navigation` entry (and with it the `navigationId` that web vitals are reported against)\n * once the navigation has been confirmed by a paint. So the `navigationId` cannot be known at span\n * creation time and the two have to be joined after the fact.\n *\n * The join key is the `interactionId` of the interaction that drove the navigation: per the Soft\n * Navigations spec the `soft-navigation` entry carries the `interactionId` of the interaction that\n * triggered it, which is the same id the interaction's own `PerformanceEventTiming` entry carries.\n * So we bind a navigation span to the interaction it happened during, and the soft navigation\n * joins back to that span through the shared id.\n *\n * This is inherently partial. Navigations that don't meet the browser's soft navigation heuristic\n * (programmatic navigations, navigations that never paint, back/forward from the browser chrome)\n * produce no entry at all, so those navigation spans simply have no web vitals.\n */\nexport function startSoftNavigationCorrelation(client: Client): void {\n if (_correlationStarted || !supportsSoftNavigations()) {\n return;\n }\n _correlationStarted = true;\n\n const onInteraction = (event: Event): void => {\n if (event.isTrusted) {\n _lastInteractionTimestamp = event.timeStamp;\n }\n };\n // Only click and keydown can start a soft navigation, which is also what the SDK's redirect\n // detection listens for.\n WINDOW.addEventListener('click', onInteraction, { capture: true, passive: true });\n WINDOW.addEventListener('keydown', onInteraction, { capture: true, passive: true });\n\n client.on('spanStart', span => {\n if (spanToJSON(span).attributes?.[SENTRY_OP] !== 'navigation') {\n return;\n }\n\n // A navigation with no preceding interaction can't produce a soft navigation, so there is\n // nothing to wait for. Dropping the pending span here also keeps us from binding a stale one.\n _pendingNavigation = undefined;\n const interactionTimestamp = _lastInteractionTimestamp;\n if (interactionTimestamp == null) {\n return;\n }\n\n // The interaction's entry may already be here: the router code that starts this span races the\n // paint that flushes the entry, so either one can win.\n if (_pendingInteraction?.interactionTimestamp === interactionTimestamp) {\n _interactionIdToNavigationSpan.set(_pendingInteraction.interactionId, span);\n _pendingInteraction = undefined;\n return;\n }\n\n _pendingNavigation = { span, interactionTimestamp };\n });\n\n const bindInteractionToNavigationSpan = ({ entries }: { entries: PerformanceEntry[] }): void => {\n for (const entry of entries) {\n if (!isPerformanceEventTiming(entry) || !entry.interactionId) {\n continue;\n }\n\n const pending = _pendingNavigation;\n if (pending && interactionMatches(entry.startTime, pending.interactionTimestamp)) {\n _interactionIdToNavigationSpan.set(entry.interactionId, pending.span);\n _pendingNavigation = undefined;\n continue;\n }\n\n // Once a navigation span has claimed this interaction, only a span that is still waiting can\n // rebind it, which the check above already allows. Holding on to the interaction's remaining\n // entries would instead let an unrelated later navigation claim it.\n if (_interactionIdToNavigationSpan.get(entry.interactionId)) {\n continue;\n }\n\n // The navigation span this interaction drove may still be on its way, so hold on to the\n // interaction instead of dropping it. Only the most recent one is worth keeping:\n // `_lastInteractionTimestamp` is what `spanStart` matches against and it only moves forward,\n // so an entry that doesn't match it now can never match it later.\n if (_lastInteractionTimestamp != null && interactionMatches(entry.startTime, _lastInteractionTimestamp)) {\n _pendingInteraction = { interactionId: entry.interactionId, interactionTimestamp: _lastInteractionTimestamp };\n }\n }\n };\n\n // `durationThreshold: 0` is applied for `event` by the shared observer, which matters here:\n // interactions below the 104ms default would otherwise never surface an `interactionId`.\n addPerformanceInstrumentationHandler('event', bindInteractionToNavigationSpan);\n addPerformanceInstrumentationHandler('first-input', bindInteractionToNavigationSpan);\n\n addPerformanceInstrumentationHandler('soft-navigation', ({ entries }) => {\n for (const entry of entries as PerformanceSoftNavigation[]) {\n const span = _interactionIdToNavigationSpan.get(entry.interactionId);\n if (!span) {\n DEBUG_BUILD && debug.log(`[SoftNav] No navigation span found for soft navigation ${entry.navigationId}`, entry);\n continue;\n }\n\n _navigationIdToNavigationSpan.set(entry.navigationId, span);\n // Best effort: the soft navigation entry usually lands well within the navigation span's idle\n // window, but if the span has already been sent this attribute is dropped.\n span.setAttribute(BROWSER_NAVIGATION_ID, entry.navigationId);\n }\n });\n}\n\n/**\n * The navigation span a soft navigation web vital belongs to, or `undefined` if the metric isn't\n * for a soft navigation or we failed to correlate it.\n */\nexport function getNavigationSpanForMetric(metric: SoftNavMetric): Span | undefined {\n if (metric.navigationType !== 'soft-navigation') {\n return undefined;\n }\n\n const span = _navigationIdToNavigationSpan.get(metric.navigationId);\n if (span) {\n return span;\n }\n\n // The `soft-navigation` observer may not have run for this navigation yet - entries from\n // different observers aren't delivered in a guaranteed order - so fall back to the join key the\n // metric carries itself.\n return metric.navigationInteractionId != null\n ? _interactionIdToNavigationSpan.get(metric.navigationInteractionId)\n : undefined;\n}\n"],"names":[],"mappings":";;;;;;AAYA,MAAM,uBAAA,GAA0B,CAAA;AAMhC,MAAM,8BAAA,GAAiC,CAAA;AAmBvC,IAAI,kBAAA;AAEJ,IAAI,mBAAA;AAGJ,IAAI,yBAAA;AAEJ,MAAM,8BAAA,GAAiC,IAAI,MAAA,CAAqB,uBAAuB,CAAA;AACvF,MAAM,6BAAA,GAAgC,IAAI,MAAA,CAAqB,uBAAuB,CAAA;AAEtF,IAAI,mBAAA,GAAsB,KAAA;AAM1B,SAAS,kBAAA,CAAmB,gBAAwB,oBAAA,EAAuC;AACzF,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,cAAA,GAAiB,oBAAoB,CAAA,IAAK,8BAAA;AAC5D;AAQO,SAAS,uBAAA,GAAmC;AACjD,EAAA,IAAI;AACF,IAAA,OACE,mBAAA,CAAoB,mBAAA,CAAoB,QAAA,CAAS,iBAAiB,CAAA;AAAA;AAAA,IAGlE,OACE,MAAA,CAGA,yBAAA,EAA2B,SAAA,EAAW,oCAAA,KAAyC,UAAA;AAAA,EAErF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAoBO,SAAS,+BAA+B,MAAA,EAAsB;AACnE,EAAA,IAAI,mBAAA,IAAuB,CAAC,uBAAA,EAAwB,EAAG;AACrD,IAAA;AAAA,EACF;AACA,EAAA,mBAAA,GAAsB,IAAA;AAEtB,EAAA,M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EAAmB;AAC/C,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,IAAA,GAAO,6BAAA,CAA8B,GAAA,CAAI,MAAA,CAAO,YAAY,CAAA;AAClE,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,OAAO,IAAA;AAAA,EACT;AAKA,EAAA,OAAO,OAAO,uBAAA,IAA2B,IAAA,GACrC,+BAA+B,GAAA,CAAI,MAAA,CAAO,uBAAuB,CAAA,GACjE,MAAA;AACN;;;;"}
@@ -1,10 +1,10 @@
1
- import { browserPerformanceTimeOrigin, hasSpanStreamingEnabled, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_OP, debug, getClient, timestampInSeconds, getActiveSpan, getRootSpan, UI_WEBVITAL_CLS_SPAN_NAME_FALLBACK, UI_INTERACTION_PRESS_SPAN_NAME_FALLBACK, UI_INTERACTION_DRAG_SPAN_NAME_FALLBACK, UI_INTERACTION_HOVER_SPAN_NAME_FALLBACK, UI_INTERACTION_CLICK_SPAN_NAME_FALLBACK, UI_WEBVITAL_LCP_SPAN_NAME_FALLBACK } from '@sentry/core';
1
+ import { browserPerformanceTimeOrigin, hasSpanStreamingEnabled, spanToJSON, debug, _INTERNAL_performanceTimeToSeconds, getClient, timestampInSeconds, getActiveSpan, getRootSpan, UI_WEBVITAL_CLS_SPAN_NAME_FALLBACK, UI_INTERACTION_PRESS_SPAN_NAME_FALLBACK, UI_INTERACTION_DRAG_SPAN_NAME_FALLBACK, UI_INTERACTION_HOVER_SPAN_NAME_FALLBACK, UI_INTERACTION_CLICK_SPAN_NAME_FALLBACK, UI_WEBVITAL_LCP_SPAN_NAME_FALLBACK } from '@sentry/core';
2
2
  import { DEBUG_BUILD } from '../debug-build.js';
3
3
  import { htmlTreeAsString } from '../htmlTreeAsString.js';
4
4
  import { getComponentName } from '../component-name.js';
5
5
  import { MAX_PLAUSIBLE_INP_DURATION, INP_ENTRY_MAP, getCachedInteractionContext, UNKNOWN_ELEMENT_NAME } from './inp.js';
6
6
  import { addClsInstrumentationHandler, addInpInstrumentationHandler, addLcpInstrumentationHandler } from '../instrumentation/performanceObserver.js';
7
- import { BROWSER_NAVIGATION_TYPE, UI_COMPONENT_NAME, SENTRY_EXCLUSIVE_TIME, BROWSER_WEB_VITAL_INP_TARGET, BROWSER_WEB_VITAL_INP_INTERACTION_TYPE } from '@sentry/conventions/attributes';
7
+ import { SENTRY_OP, BROWSER_NAVIGATION_TYPE, UI_COMPONENT_NAME, SENTRY_EXCLUSIVE_TIME, BROWSER_WEB_VITAL_INP_TARGET, BROWSER_WEB_VITAL_INP_INTERACTION_TYPE } from '@sentry/conventions/attributes';
8
8
  import { _emitWebVitalSpan } from './emitSpan.js';
9
9
  import { isValidLcpMetric } from './lcp.js';
10
10
  import { listenForWebVitalReportEvents } from './reportEvents.js';
@@ -32,7 +32,7 @@ function trackWebVitalPerNavigation(client, addInstrumentationHandler, send) {
32
32
  let bfcacheNavigationSpan;
33
33
  client.on("spanStart", (span) => {
34
34
  const attributes = spanToJSON(span).attributes;
35
- if (attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === NAVIGATION && attributes[BROWSER_NAVIGATION_TYPE] === "back-forward-cache") {
35
+ if (attributes?.[SENTRY_OP] === NAVIGATION && attributes[BROWSER_NAVIGATION_TYPE] === "back-forward-cache") {
36
36
  bfcacheNavigationSpan = span;
37
37
  }
38
38
  });
@@ -93,9 +93,9 @@ function _sendLcpSpan(lcpValue, entry, pageloadSpan, softNavigationId, navigatio
93
93
  return;
94
94
  }
95
95
  DEBUG_BUILD && debug.log(`Sending LCP span (${lcpValue})`);
96
- const performanceTimeOrigin = browserPerformanceTimeOrigin() || 0;
97
- const startTime = msToSec(performanceTimeOrigin + (navigationStartTime || 0));
98
- const endTime = entry ? msToSec(performanceTimeOrigin + entry.startTime) : startTime + msToSec(lcpValue);
96
+ const navigationStart = navigationStartTime || 0;
97
+ const startTime = _INTERNAL_performanceTimeToSeconds(navigationStart) ?? msToSec(navigationStart);
98
+ const endTime = entry ? _INTERNAL_performanceTimeToSeconds(entry.startTime, navigationStart) ?? msToSec(entry.startTime) : startTime + msToSec(lcpValue);
99
99
  const selector = entry ? htmlTreeAsString(entry.element) : void 0;
100
100
  const componentName = entry?.element ? getComponentName(entry.element) : null;
101
101
  const client = getClient();
@@ -164,9 +164,8 @@ function trackClsAsSpan(client, perNavigation = false) {
164
164
  }
165
165
  function _sendClsSpan(clsValue, entry, pageloadSpan, softNavigationId, navigationType, navigationStartTime) {
166
166
  DEBUG_BUILD && debug.log(`Sending CLS span (${clsValue})`);
167
- const performanceTimeOrigin = browserPerformanceTimeOrigin();
168
167
  const offset = entry?.startTime ?? navigationStartTime ?? 0;
169
- const startTime = performanceTimeOrigin ? msToSec(performanceTimeOrigin + offset) : timestampInSeconds();
168
+ const startTime = _INTERNAL_performanceTimeToSeconds(offset) ?? timestampInSeconds();
170
169
  const firstSourceNode = entry?.sources[0]?.node;
171
170
  const selector = entry ? htmlTreeAsString(firstSourceNode) : void 0;
172
171
  const componentName = firstSourceNode ? getComponentName(firstSourceNode) : null;
@@ -224,9 +223,10 @@ function findInpEntry(metric) {
224
223
  }
225
224
  function _sendInpSpan(inpValue, entry, standalone = false, attributedSpan, softNavigationId, metric) {
226
225
  DEBUG_BUILD && debug.log(`Sending INP span (${inpValue})`);
227
- const startTime = msToSec(
228
- browserPerformanceTimeOrigin() + (entry?.startTime ?? metric?.navigationStartTime ?? 0)
229
- );
226
+ const startTime = _INTERNAL_performanceTimeToSeconds(entry?.startTime ?? metric?.navigationStartTime ?? 0);
227
+ if (!startTime) {
228
+ return;
229
+ }
230
230
  const duration = msToSec(inpValue);
231
231
  const entryInteractionType = entry && INP_ENTRY_MAP[entry.name];
232
232
  const interactionType = entryInteractionType || "click";
@@ -1 +1 @@
1
- {"version":3,"file":"spans.js","sources":["../../../src/web-vitals/spans.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, Span, SpanAttributes } from '@sentry/core';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n getActiveSpan,\n getClient,\n getRootSpan,\n hasSpanStreamingEnabled,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n spanToJSON,\n timestampInSeconds,\n UI_INTERACTION_CLICK_SPAN_NAME_FALLBACK,\n UI_INTERACTION_DRAG_SPAN_NAME_FALLBACK,\n UI_INTERACTION_HOVER_SPAN_NAME_FALLBACK,\n UI_INTERACTION_PRESS_SPAN_NAME_FALLBACK,\n UI_WEBVITAL_CLS_SPAN_NAME_FALLBACK,\n UI_WEBVITAL_LCP_SPAN_NAME_FALLBACK,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { htmlTreeAsString } from '../htmlTreeAsString';\nimport { getComponentName } from '../component-name';\nimport type { InteractionType } from './inp';\nimport { getCachedInteractionContext, INP_ENTRY_MAP, MAX_PLAUSIBLE_INP_DURATION, UNKNOWN_ELEMENT_NAME } from './inp';\nimport type { InstrumentationHandlerCallback, MetricNavigationType } from '../instrumentation/performanceObserver';\nimport {\n addClsInstrumentationHandler,\n addInpInstrumentationHandler,\n addLcpInstrumentationHandler,\n} from '../instrumentation/performanceObserver';\nimport type { LargestContentfulPaint, LayoutShift } from './emitSpan';\nimport {\n SENTRY_EXCLUSIVE_TIME,\n BROWSER_NAVIGATION_TYPE,\n BROWSER_WEB_VITAL_INP_INTERACTION_TYPE,\n BROWSER_WEB_VITAL_INP_TARGET,\n UI_COMPONENT_NAME,\n} from '@sentry/conventions/attributes';\nimport { _emitWebVitalSpan } from './emitSpan';\nimport { isValidLcpMetric } from './lcp';\nimport { listenForWebVitalReportEvents } from './reportEvents';\nimport { getNavigationSpanForMetric } from './softNavs';\nimport { getBrowserPerformanceAPI, msToSec, supportsWebVital } from '../performance/utils';\nimport type { PerformanceEventTiming } from '../instrumentation/performanceObserver';\nimport {\n NAVIGATION,\n UI_INTERACTION_CLICK,\n UI_INTERACTION_DRAG,\n UI_INTERACTION_HOVER,\n UI_INTERACTION_PRESS,\n UI_WEBVITAL_CLS,\n UI_WEBVITAL_LCP,\n} from '@sentry/conventions/op';\n\nconst INTERACTION_TYPE_TO_SPAN_OP: Record<InteractionType, string> = {\n click: UI_INTERACTION_CLICK,\n hover: UI_INTERACTION_HOVER,\n drag: UI_INTERACTION_DRAG,\n press: UI_INTERACTION_PRESS,\n};\n\nconst INTERACTION_TYPE_TO_SPAN_NAME_FALLBACK: Record<InteractionType, string> = {\n click: UI_INTERACTION_CLICK_SPAN_NAME_FALLBACK,\n hover: UI_INTERACTION_HOVER_SPAN_NAME_FALLBACK,\n drag: UI_INTERACTION_DRAG_SPAN_NAME_FALLBACK,\n press: UI_INTERACTION_PRESS_SPAN_NAME_FALLBACK,\n};\n\ntype WebVitalMetric = Parameters<Parameters<typeof addLcpInstrumentationHandler>[0]>[0]['metric'];\ntype InpMetric = Parameters<InstrumentationHandlerCallback>[0]['metric'];\n\n/**\n * Reports a web vital once per navigation, rather than once per page load.\n *\n * web-vitals restarts the metric on every soft navigation and force-reports the previous one just\n * before it does (and again on pagehide), and re-reports every metric after a bfcache restore.\n * Since `reportAllChanges` is off in this mode, every value we're handed is already the final one\n * for its navigation, so there is nothing to accumulate: each report is a span.\n */\nfunction trackWebVitalPerNavigation<M extends WebVitalMetric>(\n client: Client,\n addInstrumentationHandler: (callback: (data: { metric: M }) => void) => unknown,\n send: (metric: M, parentSpan: Span | undefined, softNavigationId: number | undefined) => void,\n): void {\n let pageloadSpan: Span | undefined;\n client.on('afterStartPageLoadSpan', span => {\n pageloadSpan = span;\n });\n\n // Remembered when the restore happens rather than read back at report time: the restore\n // navigation span is an idle span, and CLS and INP are only finalized on pagehide, by which point\n // it has long ended and is no longer what is active.\n let bfcacheNavigationSpan: Span | undefined;\n client.on('spanStart', span => {\n // The op has to be checked too: the web vital spans emitted for a restore carry the same\n // `back-forward-cache` navigation type, so matching on that alone lets the first of them replace the\n // navigation span, and every later vital then hangs off a sibling vital instead.\n const attributes = spanToJSON(span).attributes;\n if (\n attributes?.[SEMANTIC_ATTRIBUTE_SENTRY_OP] === NAVIGATION &&\n attributes[BROWSER_NAVIGATION_TYPE] === 'back-forward-cache'\n ) {\n bfcacheNavigationSpan = span;\n }\n });\n\n addInstrumentationHandler(({ metric }) => {\n const navigationSpan = getNavigationSpanForMetric(metric);\n if (metric.navigationType === 'soft-navigation') {\n // Reporting an uncorrelated soft navigation vital would attribute it to the wrong route, so\n // it's dropped instead.\n if (navigationSpan) {\n send(metric, navigationSpan, metric.navigationId);\n } else {\n DEBUG_BUILD &&\n debug.log(`[SoftNav] Dropping ${metric.name} for uncorrelated soft navigation ${metric.navigationId}`);\n }\n return;\n }\n\n if (metric.navigationType === 'back-forward-cache') {\n // A restore reuses the frozen document, so the pageload span above belongs to the page view\n // from before the freeze. The navigation span started for the restore is the page view these\n // values were actually measured on.\n send(metric, bfcacheNavigationSpan, undefined);\n return;\n }\n\n send(metric, pageloadSpan, undefined);\n });\n}\n\n/**\n * Tracks LCP as a streamed span.\n */\nexport function trackLcpAsSpan(client: Client, perNavigation = false): void {\n if (!supportsWebVital('largest-contentful-paint')) {\n return;\n }\n\n if (perNavigation) {\n trackWebVitalPerNavigation(client, addLcpInstrumentationHandler, (metric, parentSpan, softNavigationId) => {\n const entry = metric.entries[metric.entries.length - 1] as LargestContentfulPaint | undefined;\n _sendLcpSpan(\n metric.value,\n entry,\n parentSpan,\n softNavigationId,\n metric.navigationType,\n metric.navigationStartTime,\n );\n });\n return;\n }\n\n let lcpValue = 0;\n let lcpEntry: LargestContentfulPaint | undefined;\n let lcpNavigationType: MetricNavigationType | undefined;\n\n const cleanupLcpHandler = addLcpInstrumentationHandler(({ metric }) => {\n // The navigation type describes the page, not the entry, so it is worth keeping even for a\n // report we otherwise discard.\n lcpNavigationType = metric.navigationType;\n\n const entry = metric.entries[metric.entries.length - 1] as LargestContentfulPaint | undefined;\n if (!entry || !isValidLcpMetric(metric.value)) {\n return;\n }\n lcpValue = metric.value;\n lcpEntry = entry;\n }, true);\n\n listenForWebVitalReportEvents(client, pageloadSpan => {\n _sendLcpSpan(lcpValue, lcpEntry, pageloadSpan, undefined, lcpNavigationType);\n cleanupLcpHandler();\n });\n}\n\n/**\n * Exported only for testing.\n */\nexport function _sendLcpSpan(\n lcpValue: number,\n entry: LargestContentfulPaint | undefined,\n pageloadSpan?: Span,\n softNavigationId?: number,\n navigationType?: MetricNavigationType,\n navigationStartTime?: number,\n): void {\n if (!isValidLcpMetric(lcpValue)) {\n return;\n }\n\n DEBUG_BUILD && debug.log(`Sending LCP span (${lcpValue})`);\n\n const performanceTimeOrigin = browserPerformanceTimeOrigin() || 0;\n // A soft navigation's LCP is measured from the triggering interaction, not the document time\n // origin. Starting the span there too keeps it inside the navigation span it is parented to and\n // keeps its duration equal to the value it reports.\n const startTime = msToSec(performanceTimeOrigin + (navigationStartTime || 0));\n // Without an entry there is no render time to end at, so the span lasts the value it reports,\n // like an entry-less INP does. Ending at the time origin instead would invert the span.\n const endTime = entry ? msToSec(performanceTimeOrigin + entry.startTime) : startTime + msToSec(lcpValue);\n const selector = entry ? htmlTreeAsString(entry.element) : undefined;\n const componentName = entry?.element ? getComponentName(entry.element) : null;\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const name = hasSpanStreaming\n ? componentName || UI_WEBVITAL_LCP_SPAN_NAME_FALLBACK\n : (selector ?? UI_WEBVITAL_LCP_SPAN_NAME_FALLBACK);\n\n const attributes: SpanAttributes = {};\n\n if (selector) {\n attributes['browser.web_vital.lcp.element'] = selector;\n }\n if (componentName) {\n attributes[UI_COMPONENT_NAME] = componentName;\n }\n entry?.id && (attributes['browser.web_vital.lcp.id'] = entry.id);\n entry?.url && (attributes['browser.web_vital.lcp.url'] = entry.url);\n entry?.loadTime != null && (attributes['browser.web_vital.lcp.load_time'] = entry.loadTime);\n entry?.renderTime != null && (attributes['browser.web_vital.lcp.render_time'] = entry.renderTime);\n entry?.size != null && (attributes['browser.web_vital.lcp.size'] = entry.size);\n\n _emitWebVitalSpan({\n name,\n op: UI_WEBVITAL_LCP,\n origin: 'auto.http.browser.lcp',\n metricName: 'lcp',\n value: lcpValue,\n attributes,\n parentSpan: pageloadSpan,\n startTime,\n endTime,\n softNavigationId,\n navigationType,\n });\n}\n\n/**\n * Tracks CLS as a streamed span.\n */\nexport function trackClsAsSpan(client: Client, perNavigation = false): void {\n if (!supportsWebVital('layout-shift')) {\n return;\n }\n\n if (perNavigation) {\n trackWebVitalPerNavigation(client, addClsInstrumentationHandler, (metric, parentSpan, softNavigationId) => {\n const entry = metric.entries[metric.entries.length - 1] as LayoutShift | undefined;\n _sendClsSpan(\n metric.value,\n entry,\n parentSpan,\n softNavigationId,\n metric.navigationType,\n metric.navigationStartTime,\n );\n });\n return;\n }\n\n let clsValue = 0;\n let clsEntry: LayoutShift | undefined;\n let clsNavigationType: MetricNavigationType | undefined;\n\n const cleanupClsHandler = addClsInstrumentationHandler(({ metric }) => {\n // A CLS of 0 is reported with no entries and still emits a span, so the navigation type has to\n // be captured before the entry check rather than alongside the value.\n clsNavigationType = metric.navigationType;\n\n const entry = metric.entries[metric.entries.length - 1] as LayoutShift | undefined;\n if (!entry) {\n return;\n }\n clsValue = metric.value;\n clsEntry = entry;\n }, true);\n\n listenForWebVitalReportEvents(client, pageloadSpan => {\n _sendClsSpan(clsValue, clsEntry, pageloadSpan, undefined, clsNavigationType);\n cleanupClsHandler();\n });\n}\n\n/**\n * Exported only for testing.\n */\nexport function _sendClsSpan(\n clsValue: number,\n entry: LayoutShift | undefined,\n pageloadSpan?: Span,\n softNavigationId?: number,\n navigationType?: MetricNavigationType,\n navigationStartTime?: number,\n): void {\n DEBUG_BUILD && debug.log(`Sending CLS span (${clsValue})`);\n\n const performanceTimeOrigin = browserPerformanceTimeOrigin();\n // A CLS of 0 has no shift to place the span at. It is reported when the navigation it was\n // measured on is already over - the next soft navigation, or pagehide - so the current time would\n // land it outside that navigation, on the route that follows it.\n const offset = entry?.startTime ?? navigationStartTime ?? 0;\n const startTime = performanceTimeOrigin ? msToSec(performanceTimeOrigin + offset) : timestampInSeconds();\n const firstSourceNode = entry?.sources[0]?.node;\n const selector = entry ? htmlTreeAsString(firstSourceNode) : undefined;\n const componentName = firstSourceNode ? getComponentName(firstSourceNode) : null;\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const name = hasSpanStreaming\n ? componentName || UI_WEBVITAL_CLS_SPAN_NAME_FALLBACK\n : (selector ?? UI_WEBVITAL_CLS_SPAN_NAME_FALLBACK);\n\n const attributes: SpanAttributes = {};\n\n if (componentName) {\n attributes[UI_COMPONENT_NAME] = componentName;\n }\n\n if (entry?.sources) {\n entry.sources.forEach((source, index) => {\n attributes[`browser.web_vital.cls.source.${index + 1}`] = htmlTreeAsString(source.node);\n });\n }\n\n _emitWebVitalSpan({\n name,\n op: UI_WEBVITAL_CLS,\n origin: 'auto.http.browser.cls',\n metricName: 'cls',\n value: clsValue,\n attributes,\n parentSpan: pageloadSpan,\n startTime,\n softNavigationId,\n navigationType,\n });\n}\n\n/**\n * Tracks INP and emits it as a web vital span, as a child of the interaction's root span.\n * Requires `registerInpInteractionListener()` to be called separately for cached element names and\n * root spans per interaction.\n */\nexport function trackInpAsSpan(client: Client, perNavigation = false): void {\n const performance = getBrowserPerformanceAPI();\n if (!performance || !browserPerformanceTimeOrigin()) {\n return;\n }\n\n // INP reports late (on pagehide, after the pageload span has ended). With span streaming enabled\n // it rides the streaming pipeline. With streaming disabled it would be dropped as a late span, so\n // it is emitted as its own standalone v2 span instead (see `_emitWebVitalSpan`), overriding the\n // static trace lifecycle for INP only.\n // TODO(standalone): once the static trace lifecycle is dropped, INP always streams; drop this flag.\n const standalone = !hasSpanStreamingEnabled(client);\n\n if (perNavigation) {\n // INP restarts per navigation and reports once that navigation is over, by which point the\n // navigation span has ended and the interaction cache no longer knows about it. The metric\n // says which navigation it belongs to, so INP is attributed exactly like LCP and CLS.\n trackWebVitalPerNavigation(client, addInpInstrumentationHandler, (metric, parentSpan, softNavigationId) => {\n if (isPlausibleInp(metric)) {\n _sendInpSpan(metric.value, findInpEntry(metric), standalone, parentSpan, softNavigationId, metric);\n }\n });\n return;\n }\n\n const onInp: InstrumentationHandlerCallback = ({ metric }) => {\n if (isPlausibleInp(metric)) {\n _sendInpSpan(metric.value, findInpEntry(metric), standalone, undefined, undefined, metric);\n }\n };\n\n addInpInstrumentationHandler(onInp);\n}\n\nfunction isPlausibleInp(metric: InpMetric): boolean {\n return metric.value != null && msToSec(metric.value) <= MAX_PLAUSIBLE_INP_DURATION;\n}\n\n/**\n * The entry an INP span is built from: the one whose duration the reported value came from.\n *\n * There isn't always one. When every interaction of a soft navigation stayed below the Event Timing\n * threshold, web-vitals reports a synthetic value with no entries at all - see\n * `_estimateP98LongestInteraction`. The span still gets reported in that case, just without the\n * element and interaction type an entry would have supplied.\n */\nfunction findInpEntry(metric: InpMetric): PerformanceEventTiming | undefined {\n return metric.entries.find(e => e.duration === metric.value && INP_ENTRY_MAP[e.name]);\n}\n\n/**\n * Exported only for testing.\n */\nexport function _sendInpSpan(\n inpValue: number,\n entry: PerformanceEventTiming | undefined,\n standalone = false,\n attributedSpan?: Span,\n softNavigationId?: number,\n metric?: InpMetric,\n): void {\n DEBUG_BUILD && debug.log(`Sending INP span (${inpValue})`);\n\n // A web vital span carries the metric, not a real interaction timing, so an INP without an entry\n // is still worth reporting. It just has no element or interaction type to describe, and is placed\n // at the start of the navigation it belongs to rather than at the interaction.\n const startTime = msToSec(\n (browserPerformanceTimeOrigin() as number) + (entry?.startTime ?? metric?.navigationStartTime ?? 0),\n );\n const duration = msToSec(inpValue);\n // An INP without an entry has no interaction type to report. It still has to land inside the\n // `ui.interaction.*` family, because falling outside it would hide exactly the fast navigations\n // that web-vitals synthesizes these values for (GoogleChrome/web-vitals#724), reintroducing the\n // reporting bias they were added to remove.\n const entryInteractionType = entry && INP_ENTRY_MAP[entry.name];\n const interactionType = entryInteractionType || 'click';\n\n const cachedContext = entry && getCachedInteractionContext(entry.interactionId);\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan ? getRootSpan(activeSpan) : undefined;\n\n // With soft navigations the caller knows exactly which navigation the metric belongs to. Without\n // them we fall back to the span that was active when the interaction was observed.\n const spanToUse = attributedSpan || cachedContext?.span || rootSpan;\n const selector = cachedContext?.elementName || (entry ? htmlTreeAsString(entry.target) : undefined);\n const componentName = entry?.target ? getComponentName(entry.target) : null;\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const fallbackName = INTERACTION_TYPE_TO_SPAN_NAME_FALLBACK[interactionType];\n const name = hasSpanStreaming ? componentName || fallbackName : (selector ?? 'Interaction to next paint');\n\n const attributes: SpanAttributes = {\n [SENTRY_EXCLUSIVE_TIME]: entry?.duration ?? inpValue,\n };\n\n // The span's name and op always have a value, even for an INP without an entry, so they can't\n // say whether there was an interaction to describe. These attributes can: they are only set for\n // what was actually observed. The name no longer holds the selector either, now that it is the\n // component name or the op's fallback under span streaming.\n selector && selector !== UNKNOWN_ELEMENT_NAME && (attributes[BROWSER_WEB_VITAL_INP_TARGET] = selector);\n entryInteractionType && (attributes[BROWSER_WEB_VITAL_INP_INTERACTION_TYPE] = entryInteractionType);\n\n if (componentName) {\n attributes[UI_COMPONENT_NAME] = componentName;\n }\n\n _emitWebVitalSpan({\n name,\n op: INTERACTION_TYPE_TO_SPAN_OP[interactionType],\n origin: 'auto.http.browser.inp',\n metricName: 'inp',\n value: inpValue,\n attributes,\n startTime,\n endTime: startTime + duration,\n navigationType: metric?.navigationType,\n parentSpan: spanToUse,\n standalone,\n softNavigationId,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsDA,MAAM,2BAAA,GAA+D;AAAA,EACnE,KAAA,EAAO,oBAAA;AAAA,EACP,KAAA,EAAO,oBAAA;AAAA,EACP,IAAA,EAAM,mBAAA;AAAA,EACN,KAAA,EAAO;AACT,CAAA;AAEA,MAAM,sCAAA,GAA0E;AAAA,EAC9E,KAAA,EAAO,uCAAA;AAAA,EACP,KAAA,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AC7F,EAAA,oBAAA,KAAyB,UAAA,CAAW,sCAAsC,CAAA,GAAI,oBAAA,CAAA;AAE9E,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,UAAA,CAAW,iBAAiB,CAAA,GAAI,aAAA;AAAA,EAClC;AAEA,EAAA,iBAAA,CAAkB;AAAA,IAChB,IAAA;AAAA,IACA,EAAA,EAAI,4BAA4B,eAAe,CAAA;AAAA,IAC/C,MAAA,EAAQ,uBAAA;AAAA,IACR,UAAA,EAAY,KAAA;AAAA,IACZ,KAAA,EAAO,QAAA;AAAA,IACP,UAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAS,SAAA,GAAY,QAAA;AAAA,IACrB,gBAAgB,MAAA,EAAQ,cAAA;AAAA,IACxB,UAAA,EAAY,SAAA;AAAA,IACZ,UAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"spans.js","sources":["../../../src/web-vitals/spans.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, Span, SpanAttributes } from '@sentry/core';\nimport {\n browserPerformanceTimeOrigin,\n debug,\n getActiveSpan,\n getClient,\n getRootSpan,\n hasSpanStreamingEnabled,\n _INTERNAL_performanceTimeToSeconds,\n spanToJSON,\n timestampInSeconds,\n UI_INTERACTION_CLICK_SPAN_NAME_FALLBACK,\n UI_INTERACTION_DRAG_SPAN_NAME_FALLBACK,\n UI_INTERACTION_HOVER_SPAN_NAME_FALLBACK,\n UI_INTERACTION_PRESS_SPAN_NAME_FALLBACK,\n UI_WEBVITAL_CLS_SPAN_NAME_FALLBACK,\n UI_WEBVITAL_LCP_SPAN_NAME_FALLBACK,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { htmlTreeAsString } from '../htmlTreeAsString';\nimport { getComponentName } from '../component-name';\nimport type { InteractionType } from './inp';\nimport { getCachedInteractionContext, INP_ENTRY_MAP, MAX_PLAUSIBLE_INP_DURATION, UNKNOWN_ELEMENT_NAME } from './inp';\nimport type { InstrumentationHandlerCallback, MetricNavigationType } from '../instrumentation/performanceObserver';\nimport {\n addClsInstrumentationHandler,\n addInpInstrumentationHandler,\n addLcpInstrumentationHandler,\n} from '../instrumentation/performanceObserver';\nimport type { LargestContentfulPaint, LayoutShift } from './emitSpan';\nimport {\n SENTRY_EXCLUSIVE_TIME,\n BROWSER_NAVIGATION_TYPE,\n BROWSER_WEB_VITAL_INP_INTERACTION_TYPE,\n BROWSER_WEB_VITAL_INP_TARGET,\n UI_COMPONENT_NAME,\n SENTRY_OP,\n} from '@sentry/conventions/attributes';\nimport { _emitWebVitalSpan } from './emitSpan';\nimport { isValidLcpMetric } from './lcp';\nimport { listenForWebVitalReportEvents } from './reportEvents';\nimport { getNavigationSpanForMetric } from './softNavs';\nimport { getBrowserPerformanceAPI, msToSec, supportsWebVital } from '../performance/utils';\nimport type { PerformanceEventTiming } from '../instrumentation/performanceObserver';\nimport {\n NAVIGATION,\n UI_INTERACTION_CLICK,\n UI_INTERACTION_DRAG,\n UI_INTERACTION_HOVER,\n UI_INTERACTION_PRESS,\n UI_WEBVITAL_CLS,\n UI_WEBVITAL_LCP,\n} from '@sentry/conventions/op';\n\nconst INTERACTION_TYPE_TO_SPAN_OP: Record<InteractionType, string> = {\n click: UI_INTERACTION_CLICK,\n hover: UI_INTERACTION_HOVER,\n drag: UI_INTERACTION_DRAG,\n press: UI_INTERACTION_PRESS,\n};\n\nconst INTERACTION_TYPE_TO_SPAN_NAME_FALLBACK: Record<InteractionType, string> = {\n click: UI_INTERACTION_CLICK_SPAN_NAME_FALLBACK,\n hover: UI_INTERACTION_HOVER_SPAN_NAME_FALLBACK,\n drag: UI_INTERACTION_DRAG_SPAN_NAME_FALLBACK,\n press: UI_INTERACTION_PRESS_SPAN_NAME_FALLBACK,\n};\n\ntype WebVitalMetric = Parameters<Parameters<typeof addLcpInstrumentationHandler>[0]>[0]['metric'];\ntype InpMetric = Parameters<InstrumentationHandlerCallback>[0]['metric'];\n\n/**\n * Reports a web vital once per navigation, rather than once per page load.\n *\n * web-vitals restarts the metric on every soft navigation and force-reports the previous one just\n * before it does (and again on pagehide), and re-reports every metric after a bfcache restore.\n * Since `reportAllChanges` is off in this mode, every value we're handed is already the final one\n * for its navigation, so there is nothing to accumulate: each report is a span.\n */\nfunction trackWebVitalPerNavigation<M extends WebVitalMetric>(\n client: Client,\n addInstrumentationHandler: (callback: (data: { metric: M }) => void) => unknown,\n send: (metric: M, parentSpan: Span | undefined, softNavigationId: number | undefined) => void,\n): void {\n let pageloadSpan: Span | undefined;\n client.on('afterStartPageLoadSpan', span => {\n pageloadSpan = span;\n });\n\n // Remembered when the restore happens rather than read back at report time: the restore\n // navigation span is an idle span, and CLS and INP are only finalized on pagehide, by which point\n // it has long ended and is no longer what is active.\n let bfcacheNavigationSpan: Span | undefined;\n client.on('spanStart', span => {\n // The op has to be checked too: the web vital spans emitted for a restore carry the same\n // `back-forward-cache` navigation type, so matching on that alone lets the first of them replace the\n // navigation span, and every later vital then hangs off a sibling vital instead.\n const attributes = spanToJSON(span).attributes;\n if (attributes?.[SENTRY_OP] === NAVIGATION && attributes[BROWSER_NAVIGATION_TYPE] === 'back-forward-cache') {\n bfcacheNavigationSpan = span;\n }\n });\n\n addInstrumentationHandler(({ metric }) => {\n const navigationSpan = getNavigationSpanForMetric(metric);\n if (metric.navigationType === 'soft-navigation') {\n // Reporting an uncorrelated soft navigation vital would attribute it to the wrong route, so\n // it's dropped instead.\n if (navigationSpan) {\n send(metric, navigationSpan, metric.navigationId);\n } else {\n DEBUG_BUILD &&\n debug.log(`[SoftNav] Dropping ${metric.name} for uncorrelated soft navigation ${metric.navigationId}`);\n }\n return;\n }\n\n if (metric.navigationType === 'back-forward-cache') {\n // A restore reuses the frozen document, so the pageload span above belongs to the page view\n // from before the freeze. The navigation span started for the restore is the page view these\n // values were actually measured on.\n send(metric, bfcacheNavigationSpan, undefined);\n return;\n }\n\n send(metric, pageloadSpan, undefined);\n });\n}\n\n/**\n * Tracks LCP as a streamed span.\n */\nexport function trackLcpAsSpan(client: Client, perNavigation = false): void {\n if (!supportsWebVital('largest-contentful-paint')) {\n return;\n }\n\n if (perNavigation) {\n trackWebVitalPerNavigation(client, addLcpInstrumentationHandler, (metric, parentSpan, softNavigationId) => {\n const entry = metric.entries[metric.entries.length - 1] as LargestContentfulPaint | undefined;\n _sendLcpSpan(\n metric.value,\n entry,\n parentSpan,\n softNavigationId,\n metric.navigationType,\n metric.navigationStartTime,\n );\n });\n return;\n }\n\n let lcpValue = 0;\n let lcpEntry: LargestContentfulPaint | undefined;\n let lcpNavigationType: MetricNavigationType | undefined;\n\n const cleanupLcpHandler = addLcpInstrumentationHandler(({ metric }) => {\n // The navigation type describes the page, not the entry, so it is worth keeping even for a\n // report we otherwise discard.\n lcpNavigationType = metric.navigationType;\n\n const entry = metric.entries[metric.entries.length - 1] as LargestContentfulPaint | undefined;\n if (!entry || !isValidLcpMetric(metric.value)) {\n return;\n }\n lcpValue = metric.value;\n lcpEntry = entry;\n }, true);\n\n listenForWebVitalReportEvents(client, pageloadSpan => {\n _sendLcpSpan(lcpValue, lcpEntry, pageloadSpan, undefined, lcpNavigationType);\n cleanupLcpHandler();\n });\n}\n\n/**\n * Exported only for testing.\n */\nexport function _sendLcpSpan(\n lcpValue: number,\n entry: LargestContentfulPaint | undefined,\n pageloadSpan?: Span,\n softNavigationId?: number,\n navigationType?: MetricNavigationType,\n navigationStartTime?: number,\n): void {\n if (!isValidLcpMetric(lcpValue)) {\n return;\n }\n\n DEBUG_BUILD && debug.log(`Sending LCP span (${lcpValue})`);\n\n // A soft navigation's LCP is measured from the triggering interaction, not the document time\n // origin. Starting the span there too keeps it inside the navigation span it is parented to and\n // keeps its duration equal to the reported value. The span's end uses the same origin, even if\n // the time origin was corrected in between.\n const navigationStart = navigationStartTime || 0;\n const startTime = _INTERNAL_performanceTimeToSeconds(navigationStart) ?? msToSec(navigationStart);\n // Without an entry there is no render time to end at, so the span lasts the value it reports,\n // like an entry-less INP does. Ending at the time origin instead would invert the span.\n const endTime = entry\n ? (_INTERNAL_performanceTimeToSeconds(entry.startTime, navigationStart) ?? msToSec(entry.startTime))\n : startTime + msToSec(lcpValue);\n const selector = entry ? htmlTreeAsString(entry.element) : undefined;\n const componentName = entry?.element ? getComponentName(entry.element) : null;\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const name = hasSpanStreaming\n ? componentName || UI_WEBVITAL_LCP_SPAN_NAME_FALLBACK\n : (selector ?? UI_WEBVITAL_LCP_SPAN_NAME_FALLBACK);\n\n const attributes: SpanAttributes = {};\n\n if (selector) {\n attributes['browser.web_vital.lcp.element'] = selector;\n }\n if (componentName) {\n attributes[UI_COMPONENT_NAME] = componentName;\n }\n entry?.id && (attributes['browser.web_vital.lcp.id'] = entry.id);\n entry?.url && (attributes['browser.web_vital.lcp.url'] = entry.url);\n entry?.loadTime != null && (attributes['browser.web_vital.lcp.load_time'] = entry.loadTime);\n entry?.renderTime != null && (attributes['browser.web_vital.lcp.render_time'] = entry.renderTime);\n entry?.size != null && (attributes['browser.web_vital.lcp.size'] = entry.size);\n\n _emitWebVitalSpan({\n name,\n op: UI_WEBVITAL_LCP,\n origin: 'auto.http.browser.lcp',\n metricName: 'lcp',\n value: lcpValue,\n attributes,\n parentSpan: pageloadSpan,\n startTime,\n endTime,\n softNavigationId,\n navigationType,\n });\n}\n\n/**\n * Tracks CLS as a streamed span.\n */\nexport function trackClsAsSpan(client: Client, perNavigation = false): void {\n if (!supportsWebVital('layout-shift')) {\n return;\n }\n\n if (perNavigation) {\n trackWebVitalPerNavigation(client, addClsInstrumentationHandler, (metric, parentSpan, softNavigationId) => {\n const entry = metric.entries[metric.entries.length - 1] as LayoutShift | undefined;\n _sendClsSpan(\n metric.value,\n entry,\n parentSpan,\n softNavigationId,\n metric.navigationType,\n metric.navigationStartTime,\n );\n });\n return;\n }\n\n let clsValue = 0;\n let clsEntry: LayoutShift | undefined;\n let clsNavigationType: MetricNavigationType | undefined;\n\n const cleanupClsHandler = addClsInstrumentationHandler(({ metric }) => {\n // A CLS of 0 is reported with no entries and still emits a span, so the navigation type has to\n // be captured before the entry check rather than alongside the value.\n clsNavigationType = metric.navigationType;\n\n const entry = metric.entries[metric.entries.length - 1] as LayoutShift | undefined;\n if (!entry) {\n return;\n }\n clsValue = metric.value;\n clsEntry = entry;\n }, true);\n\n listenForWebVitalReportEvents(client, pageloadSpan => {\n _sendClsSpan(clsValue, clsEntry, pageloadSpan, undefined, clsNavigationType);\n cleanupClsHandler();\n });\n}\n\n/**\n * Exported only for testing.\n */\nexport function _sendClsSpan(\n clsValue: number,\n entry: LayoutShift | undefined,\n pageloadSpan?: Span,\n softNavigationId?: number,\n navigationType?: MetricNavigationType,\n navigationStartTime?: number,\n): void {\n DEBUG_BUILD && debug.log(`Sending CLS span (${clsValue})`);\n\n // A CLS of 0 has no shift to place the span at. It is reported when the navigation it was\n // measured on is already over - the next soft navigation, or pagehide - so the current time would\n // land it outside that navigation, on the route that follows it.\n const offset = entry?.startTime ?? navigationStartTime ?? 0;\n // CLS is only reported on pagehide, so we use the time origin from when the layout shift happened.\n const startTime = _INTERNAL_performanceTimeToSeconds(offset) ?? timestampInSeconds();\n const firstSourceNode = entry?.sources[0]?.node;\n const selector = entry ? htmlTreeAsString(firstSourceNode) : undefined;\n const componentName = firstSourceNode ? getComponentName(firstSourceNode) : null;\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const name = hasSpanStreaming\n ? componentName || UI_WEBVITAL_CLS_SPAN_NAME_FALLBACK\n : (selector ?? UI_WEBVITAL_CLS_SPAN_NAME_FALLBACK);\n\n const attributes: SpanAttributes = {};\n\n if (componentName) {\n attributes[UI_COMPONENT_NAME] = componentName;\n }\n\n if (entry?.sources) {\n entry.sources.forEach((source, index) => {\n attributes[`browser.web_vital.cls.source.${index + 1}`] = htmlTreeAsString(source.node);\n });\n }\n\n _emitWebVitalSpan({\n name,\n op: UI_WEBVITAL_CLS,\n origin: 'auto.http.browser.cls',\n metricName: 'cls',\n value: clsValue,\n attributes,\n parentSpan: pageloadSpan,\n startTime,\n softNavigationId,\n navigationType,\n });\n}\n\n/**\n * Tracks INP and emits it as a web vital span, as a child of the interaction's root span.\n * Requires `registerInpInteractionListener()` to be called separately for cached element names and\n * root spans per interaction.\n */\nexport function trackInpAsSpan(client: Client, perNavigation = false): void {\n const performance = getBrowserPerformanceAPI();\n if (!performance || !browserPerformanceTimeOrigin()) {\n return;\n }\n\n // INP reports late (on pagehide, after the pageload span has ended). With span streaming enabled\n // it rides the streaming pipeline. With streaming disabled it would be dropped as a late span, so\n // it is emitted as its own standalone v2 span instead (see `_emitWebVitalSpan`), overriding the\n // static trace lifecycle for INP only.\n // TODO(standalone): once the static trace lifecycle is dropped, INP always streams; drop this flag.\n const standalone = !hasSpanStreamingEnabled(client);\n\n if (perNavigation) {\n // INP restarts per navigation and reports once that navigation is over, by which point the\n // navigation span has ended and the interaction cache no longer knows about it. The metric\n // says which navigation it belongs to, so INP is attributed exactly like LCP and CLS.\n trackWebVitalPerNavigation(client, addInpInstrumentationHandler, (metric, parentSpan, softNavigationId) => {\n if (isPlausibleInp(metric)) {\n _sendInpSpan(metric.value, findInpEntry(metric), standalone, parentSpan, softNavigationId, metric);\n }\n });\n return;\n }\n\n const onInp: InstrumentationHandlerCallback = ({ metric }) => {\n if (isPlausibleInp(metric)) {\n _sendInpSpan(metric.value, findInpEntry(metric), standalone, undefined, undefined, metric);\n }\n };\n\n addInpInstrumentationHandler(onInp);\n}\n\nfunction isPlausibleInp(metric: InpMetric): boolean {\n return metric.value != null && msToSec(metric.value) <= MAX_PLAUSIBLE_INP_DURATION;\n}\n\n/**\n * The entry an INP span is built from: the one whose duration the reported value came from.\n *\n * There isn't always one. When every interaction of a soft navigation stayed below the Event Timing\n * threshold, web-vitals reports a synthetic value with no entries at all - see\n * `_estimateP98LongestInteraction`. The span still gets reported in that case, just without the\n * element and interaction type an entry would have supplied.\n */\nfunction findInpEntry(metric: InpMetric): PerformanceEventTiming | undefined {\n return metric.entries.find(e => e.duration === metric.value && INP_ENTRY_MAP[e.name]);\n}\n\n/**\n * Exported only for testing.\n */\nexport function _sendInpSpan(\n inpValue: number,\n entry: PerformanceEventTiming | undefined,\n standalone = false,\n attributedSpan?: Span,\n softNavigationId?: number,\n metric?: InpMetric,\n): void {\n DEBUG_BUILD && debug.log(`Sending INP span (${inpValue})`);\n\n // A web vital span carries the metric, not a real interaction timing, so an INP without an entry\n // is still worth reporting. It just has no element or interaction type to describe, and is placed\n // at the start of the navigation it belongs to rather than at the interaction.\n // INP is reported on pagehide, often long after the interaction, so we use the time origin from when the\n // interaction happened.\n const startTime = _INTERNAL_performanceTimeToSeconds(entry?.startTime ?? metric?.navigationStartTime ?? 0);\n if (!startTime) {\n return;\n }\n const duration = msToSec(inpValue);\n // An INP without an entry has no interaction type to report. It still has to land inside the\n // `ui.interaction.*` family, because falling outside it would hide exactly the fast navigations\n // that web-vitals synthesizes these values for (GoogleChrome/web-vitals#724), reintroducing the\n // reporting bias they were added to remove.\n const entryInteractionType = entry && INP_ENTRY_MAP[entry.name];\n const interactionType = entryInteractionType || 'click';\n\n const cachedContext = entry && getCachedInteractionContext(entry.interactionId);\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan ? getRootSpan(activeSpan) : undefined;\n\n // With soft navigations the caller knows exactly which navigation the metric belongs to. Without\n // them we fall back to the span that was active when the interaction was observed.\n const spanToUse = attributedSpan || cachedContext?.span || rootSpan;\n const selector = cachedContext?.elementName || (entry ? htmlTreeAsString(entry.target) : undefined);\n const componentName = entry?.target ? getComponentName(entry.target) : null;\n const client = getClient();\n const hasSpanStreaming = !!client && hasSpanStreamingEnabled(client);\n const fallbackName = INTERACTION_TYPE_TO_SPAN_NAME_FALLBACK[interactionType];\n const name = hasSpanStreaming ? componentName || fallbackName : (selector ?? 'Interaction to next paint');\n\n const attributes: SpanAttributes = {\n [SENTRY_EXCLUSIVE_TIME]: entry?.duration ?? inpValue,\n };\n\n // The span's name and op always have a value, even for an INP without an entry, so they can't\n // say whether there was an interaction to describe. These attributes can: they are only set for\n // what was actually observed. The name no longer holds the selector either, now that it is the\n // component name or the op's fallback under span streaming.\n selector && selector !== UNKNOWN_ELEMENT_NAME && (attributes[BROWSER_WEB_VITAL_INP_TARGET] = selector);\n entryInteractionType && (attributes[BROWSER_WEB_VITAL_INP_INTERACTION_TYPE] = entryInteractionType);\n\n if (componentName) {\n attributes[UI_COMPONENT_NAME] = componentName;\n }\n\n _emitWebVitalSpan({\n name,\n op: INTERACTION_TYPE_TO_SPAN_OP[interactionType],\n origin: 'auto.http.browser.inp',\n metricName: 'inp',\n value: inpValue,\n attributes,\n startTime,\n endTime: startTime + duration,\n navigationType: metric?.navigationType,\n parentSpan: spanToUse,\n standalone,\n softNavigationId,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAuDA,MAAM,2BAAA,GAA+D;AAAA,EACnE,KAAA,EAAO,oBAAA;AAAA,EACP,KAAA,EAAO,oBAAA;AAAA,EACP,IAAA,EAAM,mBAAA;AAAA,EACN,KAAA,EAAO;AACT,CAAA;AAEA,MAAM,sCAAA,GAA0E;AAAA,EAC9E,KAAA,EAAO,uCAAA;AAAA,EACP,KAAA,EAAO,uCAAA;AAAA,EACP,IAAA,EAAM,sCAAA;AAAA,EACN,KAAA,EAAO;AACT,CAAA;AAaA,SAAS,0BAAA,CACP,MAAA,EACA,yBAAA,EACA,IAAA,EACM;AACN,EAAA,IAAI,YAAA;AACJ,EAAA,MAAA,CAAO,EAAA,CAAG,0BAA0B,CAAA,IAAA,KAAQ;AAC1C,IAAA,YAAA,GAAe,IAAA;AAAA,EACjB,CAAC,CAAA;AAKD,EAAA,IAAI,qBAAA;AACJ,EAAA,MAAA,CAAO,EAAA,CAAG,aAAa,CAAA,IAAA,KAAQ;AAI7B,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,IAAI,CAAA,CAAE,UAAA;AACpC,IAAA,IAAI,aAAa,SAAS,C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,UAAA,EAAY,SAAA;AAAA,IACZ,UAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getNativeImplementation.d.ts","sourceRoot":"","sources":["../../src/getNativeImplementation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC;;;;GAIG;AAEH,UAAU,wBAAwB;IAChC,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,CAAC;IACrC,KAAK,EAAE,OAAO,MAAM,CAAC,KAAK,CAAC;CAC5B;AAID;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,wBAAwB,EAC9E,IAAI,EAAE,CAAC,GACN,wBAAwB,CAAC,CAAC,CAAC,CAsC7B;AAED,qCAAqC;AACrC,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,wBAAwB,GAAG,IAAI,CAEpF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,CAE/F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,CAE9G"}
1
+ {"version":3,"file":"getNativeImplementation.d.ts","sourceRoot":"","sources":["../../src/getNativeImplementation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC;;;;GAIG;AAEH,UAAU,wBAAwB;IAChC,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,CAAC;IACrC,KAAK,EAAE,OAAO,MAAM,CAAC,KAAK,CAAC;CAC5B;AAID;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,wBAAwB,EAC9E,IAAI,EAAE,CAAC,GACN,wBAAwB,CAAC,CAAC,CAAC,CAsC7B;AAED,qCAAqC;AACrC,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,wBAAwB,GAAG,IAAI,CAEpF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,CAE/F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,UAAU,CAAC,CAY9G"}
@@ -25,17 +25,17 @@ export declare function addPerformanceEntries(span: Span, options: AddPerformanc
25
25
  * Create a span for a browser paint performance entry.
26
26
  * Exported only for tests.
27
27
  */
28
- export declare function _addPaintSpan(span: Span, entry: PerformanceEntry, startTime: number, duration: number, timeOrigin: number): void;
28
+ export declare function _addPaintSpan(span: Span, entry: PerformanceEntry, startTimestamp: number, duration: number): void;
29
29
  /**
30
30
  * Instrument navigation entries
31
31
  * exported only for tests
32
32
  */
33
- export declare function _addNavigationSpans(span: Span, entry: PerformanceNavigationTiming, timeOrigin: number, spanStreamingEnabled?: boolean): void;
33
+ export declare function _addNavigationSpans(span: Span, entry: PerformanceNavigationTiming, spanStreamingEnabled?: boolean): void;
34
34
  /**
35
35
  * Create resource-related spans.
36
36
  * Exported only for tests.
37
37
  */
38
- export declare function _addResourceSpans(span: Span, entry: PerformanceResourceTiming, resourceUrl: string, startTime: number, duration: number, timeOrigin: number, ignoredResourceSpanOps?: Array<string>, spanStreamingEnabled?: boolean): void;
38
+ export declare function _addResourceSpans(span: Span, entry: PerformanceResourceTiming, resourceUrl: string, startTimestamp: number, duration: number, ignoredResourceSpanOps?: Array<string>, spanStreamingEnabled?: boolean): void;
39
39
  type ExperimentalResourceTimingProperty = 'renderBlockingStatus' | 'deliveryType' | 'responseStatus';
40
40
  /**
41
41
  * Use this to set any attributes we can take directly form the PerformanceResourceTiming entry.
@@ -1 +1 @@
1
- {"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../../src/performance/entries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAgGzD;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CA8B7C;AAED;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,IAAI,CAyDvD;AAED,UAAU,4BAA4B;IACpC;;;;OAIG;IACH,mBAAmB,EAAE,KAAK,CAAC,iBAAiB,GAAG,cAAc,GAAG,cAAc,GAAG,gBAAgB,GAAG,MAAM,CAAC,CAAC;IAE5G;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,4BAA4B,GAAG,IAAI,CA+D7F;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,IAAI,CAaN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,2BAA2B,EAClC,UAAU,EAAE,MAAM,EAClB,oBAAoB,CAAC,EAAE,OAAO,GAC7B,IAAI,CAWN;AA8GD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,yBAAyB,EAChC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ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B,CACjC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,2BAA2B,EAClC,oBAAoB,CAAC,EAAE,OAAO,GAC7B,IAAI,CAWN;AAiHD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,yBAAyB,EAChC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EACtC,oBAAoB,CAAC,EAAE,OAAO,GAC7B,IAAI,CAmEN;AAsDD,KAAK,kCAAkC,GACnC,sBAAsB,GACtB,cAAc,GAKd,gBAAgB,CAAC;AAErB;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,kCAAkC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,EAChH,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,CAAC,MAAM,yBAAyB,GAAG,kCAAkC,EAAE,MAAM,CAAC,EAAE,GAC3F,IAAI,CAUN"}
@@ -1 +1 @@
1
- {"version":3,"file":"resourceTiming.d.ts","sourceRoot":"","sources":["../../../src/performance/resourceTiming.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAUnD;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAAC,cAAc,EAAE,yBAAyB,GAAG,cAAc,CA0CxG"}
1
+ {"version":3,"file":"resourceTiming.d.ts","sourceRoot":"","sources":["../../../src/performance/resourceTiming.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAInD;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAAC,cAAc,EAAE,yBAAyB,GAAG,cAAc,CAgDxG"}
@@ -32,6 +32,6 @@ export declare const userTimingIntegration: (options?: UserTimingOptions | undef
32
32
  * Creates a span for a browser User Timing entry.
33
33
  * Exported only for tests.
34
34
  */
35
- export declare function _addUserTimingSpan(parentSpan: Span, entry: PerformanceEntry, startTime: number, duration: number, timeOrigin: number, requestTime: number, ignore: Array<string | RegExp>): void;
35
+ export declare function _addUserTimingSpan(parentSpan: Span, entry: PerformanceEntry, startTimestamp: number, endTimestamp: number, requestTimestamp: number, ignore: Array<string | RegExp>): void;
36
36
  export {};
37
37
  //# sourceMappingURL=userTiming.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"userTiming.d.ts","sourceRoot":"","sources":["../../../src/performance/userTiming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,IAAI,EAAsC,MAAM,cAAc,CAAC;AAW5F,UAAU,iBAAiB;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACjC;AAwDD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB;;CAA4C,CAAC;AAE/E;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,IAAI,EAChB,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAC7B,IAAI,CA6BN"}
1
+ {"version":3,"file":"userTiming.d.ts","sourceRoot":"","sources":["../../../src/performance/userTiming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,IAAI,EAAsC,MAAM,cAAc,CAAC;AAW5F,UAAU,iBAAiB;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACjC;AAyDD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB;;CAA4C,CAAC;AAE/E;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