@opentelemetry/sdk-trace-web 2.11.0-development.0 → 3.0.0-development.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 (117) hide show
  1. package/dist/StackContextManager.cjs +89 -0
  2. package/dist/StackContextManager.cjs.map +1 -0
  3. package/dist/StackContextManager.d.cts +53 -0
  4. package/dist/StackContextManager.d.cts.map +1 -0
  5. package/dist/StackContextManager.d.mts +53 -0
  6. package/dist/StackContextManager.d.mts.map +1 -0
  7. package/dist/StackContextManager.mjs +89 -0
  8. package/dist/StackContextManager.mjs.map +1 -0
  9. package/dist/WebTracerProvider.cjs +52 -0
  10. package/dist/WebTracerProvider.cjs.map +1 -0
  11. package/dist/WebTracerProvider.d.cts +27 -0
  12. package/dist/WebTracerProvider.d.cts.map +1 -0
  13. package/dist/WebTracerProvider.d.mts +27 -0
  14. package/dist/WebTracerProvider.d.mts.map +1 -0
  15. package/dist/WebTracerProvider.mjs +52 -0
  16. package/dist/WebTracerProvider.mjs.map +1 -0
  17. package/dist/enums/PerformanceTimingNames.cjs +31 -0
  18. package/dist/enums/PerformanceTimingNames.cjs.map +1 -0
  19. package/dist/enums/PerformanceTimingNames.d.cts +29 -0
  20. package/dist/enums/PerformanceTimingNames.d.cts.map +1 -0
  21. package/dist/enums/PerformanceTimingNames.d.mts +29 -0
  22. package/dist/enums/PerformanceTimingNames.d.mts.map +1 -0
  23. package/dist/enums/PerformanceTimingNames.mjs +31 -0
  24. package/dist/enums/PerformanceTimingNames.mjs.map +1 -0
  25. package/dist/index.cjs +90 -0
  26. package/dist/index.d.cts +7 -0
  27. package/dist/index.d.mts +7 -0
  28. package/dist/index.mjs +6 -0
  29. package/dist/semconv.cjs +26 -0
  30. package/dist/semconv.cjs.map +1 -0
  31. package/dist/semconv.mjs +25 -0
  32. package/dist/semconv.mjs.map +1 -0
  33. package/dist/types.d.cts +49 -0
  34. package/dist/types.d.cts.map +1 -0
  35. package/dist/types.d.mts +49 -0
  36. package/dist/types.d.mts.map +1 -0
  37. package/dist/utils.cjs +237 -0
  38. package/dist/utils.cjs.map +1 -0
  39. package/dist/utils.d.cts +83 -0
  40. package/dist/utils.d.cts.map +1 -0
  41. package/dist/utils.d.mts +83 -0
  42. package/dist/utils.d.mts.map +1 -0
  43. package/dist/utils.mjs +229 -0
  44. package/dist/utils.mjs.map +1 -0
  45. package/package.json +31 -29
  46. package/build/esm/StackContextManager.d.ts +0 -50
  47. package/build/esm/StackContextManager.js +0 -98
  48. package/build/esm/StackContextManager.js.map +0 -1
  49. package/build/esm/WebTracerProvider.d.ts +0 -25
  50. package/build/esm/WebTracerProvider.js +0 -65
  51. package/build/esm/WebTracerProvider.js.map +0 -1
  52. package/build/esm/enums/PerformanceTimingNames.d.ts +0 -26
  53. package/build/esm/enums/PerformanceTimingNames.js +0 -31
  54. package/build/esm/enums/PerformanceTimingNames.js.map +0 -1
  55. package/build/esm/index.d.ts +0 -10
  56. package/build/esm/index.js +0 -10
  57. package/build/esm/index.js.map +0 -1
  58. package/build/esm/semconv.d.ts +0 -21
  59. package/build/esm/semconv.js +0 -30
  60. package/build/esm/semconv.js.map +0 -1
  61. package/build/esm/types.d.ts +0 -47
  62. package/build/esm/types.js +0 -2
  63. package/build/esm/types.js.map +0 -1
  64. package/build/esm/utils.d.ts +0 -80
  65. package/build/esm/utils.js +0 -316
  66. package/build/esm/utils.js.map +0 -1
  67. package/build/esm/version.d.ts +0 -2
  68. package/build/esm/version.js +0 -7
  69. package/build/esm/version.js.map +0 -1
  70. package/build/esnext/StackContextManager.d.ts +0 -50
  71. package/build/esnext/StackContextManager.js +0 -98
  72. package/build/esnext/StackContextManager.js.map +0 -1
  73. package/build/esnext/WebTracerProvider.d.ts +0 -25
  74. package/build/esnext/WebTracerProvider.js +0 -65
  75. package/build/esnext/WebTracerProvider.js.map +0 -1
  76. package/build/esnext/enums/PerformanceTimingNames.d.ts +0 -26
  77. package/build/esnext/enums/PerformanceTimingNames.js +0 -31
  78. package/build/esnext/enums/PerformanceTimingNames.js.map +0 -1
  79. package/build/esnext/index.d.ts +0 -10
  80. package/build/esnext/index.js +0 -10
  81. package/build/esnext/index.js.map +0 -1
  82. package/build/esnext/semconv.d.ts +0 -21
  83. package/build/esnext/semconv.js +0 -30
  84. package/build/esnext/semconv.js.map +0 -1
  85. package/build/esnext/types.d.ts +0 -47
  86. package/build/esnext/types.js +0 -2
  87. package/build/esnext/types.js.map +0 -1
  88. package/build/esnext/utils.d.ts +0 -80
  89. package/build/esnext/utils.js +0 -316
  90. package/build/esnext/utils.js.map +0 -1
  91. package/build/esnext/version.d.ts +0 -2
  92. package/build/esnext/version.js +0 -7
  93. package/build/esnext/version.js.map +0 -1
  94. package/build/src/StackContextManager.d.ts +0 -50
  95. package/build/src/StackContextManager.js +0 -102
  96. package/build/src/StackContextManager.js.map +0 -1
  97. package/build/src/WebTracerProvider.d.ts +0 -25
  98. package/build/src/WebTracerProvider.js +0 -69
  99. package/build/src/WebTracerProvider.js.map +0 -1
  100. package/build/src/enums/PerformanceTimingNames.d.ts +0 -26
  101. package/build/src/enums/PerformanceTimingNames.js +0 -34
  102. package/build/src/enums/PerformanceTimingNames.js.map +0 -1
  103. package/build/src/index.d.ts +0 -10
  104. package/build/src/index.js +0 -37
  105. package/build/src/index.js.map +0 -1
  106. package/build/src/semconv.d.ts +0 -21
  107. package/build/src/semconv.js +0 -33
  108. package/build/src/semconv.js.map +0 -1
  109. package/build/src/types.d.ts +0 -47
  110. package/build/src/types.js +0 -3
  111. package/build/src/types.js.map +0 -1
  112. package/build/src/utils.d.ts +0 -80
  113. package/build/src/utils.js +0 -328
  114. package/build/src/utils.js.map +0 -1
  115. package/build/src/version.d.ts +0 -2
  116. package/build/src/version.js +0 -10
  117. package/build/src/version.js.map +0 -1
@@ -1,26 +0,0 @@
1
- export declare enum PerformanceTimingNames {
2
- CONNECT_END = "connectEnd",
3
- CONNECT_START = "connectStart",
4
- DECODED_BODY_SIZE = "decodedBodySize",
5
- DOM_COMPLETE = "domComplete",
6
- DOM_CONTENT_LOADED_EVENT_END = "domContentLoadedEventEnd",
7
- DOM_CONTENT_LOADED_EVENT_START = "domContentLoadedEventStart",
8
- DOM_INTERACTIVE = "domInteractive",
9
- DOMAIN_LOOKUP_END = "domainLookupEnd",
10
- DOMAIN_LOOKUP_START = "domainLookupStart",
11
- ENCODED_BODY_SIZE = "encodedBodySize",
12
- FETCH_START = "fetchStart",
13
- LOAD_EVENT_END = "loadEventEnd",
14
- LOAD_EVENT_START = "loadEventStart",
15
- NAVIGATION_START = "navigationStart",
16
- REDIRECT_END = "redirectEnd",
17
- REDIRECT_START = "redirectStart",
18
- REQUEST_START = "requestStart",
19
- RESPONSE_END = "responseEnd",
20
- RESPONSE_START = "responseStart",
21
- SECURE_CONNECTION_START = "secureConnectionStart",
22
- START_TIME = "startTime",
23
- UNLOAD_EVENT_END = "unloadEventEnd",
24
- UNLOAD_EVENT_START = "unloadEventStart"
25
- }
26
- //# sourceMappingURL=PerformanceTimingNames.d.ts.map
@@ -1,31 +0,0 @@
1
- /*
2
- * Copyright The OpenTelemetry Authors
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- export var PerformanceTimingNames;
6
- (function (PerformanceTimingNames) {
7
- PerformanceTimingNames["CONNECT_END"] = "connectEnd";
8
- PerformanceTimingNames["CONNECT_START"] = "connectStart";
9
- PerformanceTimingNames["DECODED_BODY_SIZE"] = "decodedBodySize";
10
- PerformanceTimingNames["DOM_COMPLETE"] = "domComplete";
11
- PerformanceTimingNames["DOM_CONTENT_LOADED_EVENT_END"] = "domContentLoadedEventEnd";
12
- PerformanceTimingNames["DOM_CONTENT_LOADED_EVENT_START"] = "domContentLoadedEventStart";
13
- PerformanceTimingNames["DOM_INTERACTIVE"] = "domInteractive";
14
- PerformanceTimingNames["DOMAIN_LOOKUP_END"] = "domainLookupEnd";
15
- PerformanceTimingNames["DOMAIN_LOOKUP_START"] = "domainLookupStart";
16
- PerformanceTimingNames["ENCODED_BODY_SIZE"] = "encodedBodySize";
17
- PerformanceTimingNames["FETCH_START"] = "fetchStart";
18
- PerformanceTimingNames["LOAD_EVENT_END"] = "loadEventEnd";
19
- PerformanceTimingNames["LOAD_EVENT_START"] = "loadEventStart";
20
- PerformanceTimingNames["NAVIGATION_START"] = "navigationStart";
21
- PerformanceTimingNames["REDIRECT_END"] = "redirectEnd";
22
- PerformanceTimingNames["REDIRECT_START"] = "redirectStart";
23
- PerformanceTimingNames["REQUEST_START"] = "requestStart";
24
- PerformanceTimingNames["RESPONSE_END"] = "responseEnd";
25
- PerformanceTimingNames["RESPONSE_START"] = "responseStart";
26
- PerformanceTimingNames["SECURE_CONNECTION_START"] = "secureConnectionStart";
27
- PerformanceTimingNames["START_TIME"] = "startTime";
28
- PerformanceTimingNames["UNLOAD_EVENT_END"] = "unloadEventEnd";
29
- PerformanceTimingNames["UNLOAD_EVENT_START"] = "unloadEventStart";
30
- })(PerformanceTimingNames || (PerformanceTimingNames = {}));
31
- //# sourceMappingURL=PerformanceTimingNames.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PerformanceTimingNames.js","sourceRoot":"","sources":["../../../src/enums/PerformanceTimingNames.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAN,IAAY,sBAwBX;AAxBD,WAAY,sBAAsB;IAChC,oDAA0B,CAAA;IAC1B,wDAA8B,CAAA;IAC9B,+DAAqC,CAAA;IACrC,sDAA4B,CAAA;IAC5B,mFAAyD,CAAA;IACzD,uFAA6D,CAAA;IAC7D,4DAAkC,CAAA;IAClC,+DAAqC,CAAA;IACrC,mEAAyC,CAAA;IACzC,+DAAqC,CAAA;IACrC,oDAA0B,CAAA;IAC1B,yDAA+B,CAAA;IAC/B,6DAAmC,CAAA;IACnC,8DAAoC,CAAA;IACpC,sDAA4B,CAAA;IAC5B,0DAAgC,CAAA;IAChC,wDAA8B,CAAA;IAC9B,sDAA4B,CAAA;IAC5B,0DAAgC,CAAA;IAChC,2EAAiD,CAAA;IACjD,kDAAwB,CAAA;IACxB,6DAAmC,CAAA;IACnC,iEAAuC,CAAA;AACzC,CAAC,EAxBW,sBAAsB,KAAtB,sBAAsB,QAwBjC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport enum PerformanceTimingNames {\n CONNECT_END = 'connectEnd',\n CONNECT_START = 'connectStart',\n DECODED_BODY_SIZE = 'decodedBodySize',\n DOM_COMPLETE = 'domComplete',\n DOM_CONTENT_LOADED_EVENT_END = 'domContentLoadedEventEnd',\n DOM_CONTENT_LOADED_EVENT_START = 'domContentLoadedEventStart',\n DOM_INTERACTIVE = 'domInteractive',\n DOMAIN_LOOKUP_END = 'domainLookupEnd',\n DOMAIN_LOOKUP_START = 'domainLookupStart',\n ENCODED_BODY_SIZE = 'encodedBodySize',\n FETCH_START = 'fetchStart',\n LOAD_EVENT_END = 'loadEventEnd',\n LOAD_EVENT_START = 'loadEventStart',\n NAVIGATION_START = 'navigationStart',\n REDIRECT_END = 'redirectEnd',\n REDIRECT_START = 'redirectStart',\n REQUEST_START = 'requestStart',\n RESPONSE_END = 'responseEnd',\n RESPONSE_START = 'responseStart',\n SECURE_CONNECTION_START = 'secureConnectionStart',\n START_TIME = 'startTime',\n UNLOAD_EVENT_END = 'unloadEventEnd',\n UNLOAD_EVENT_START = 'unloadEventStart',\n}\n"]}
@@ -1,10 +0,0 @@
1
- export { WebTracerProvider } from './WebTracerProvider';
2
- export type { WebTracerConfig } from './WebTracerProvider';
3
- export { StackContextManager } from './StackContextManager';
4
- export { PerformanceTimingNames } from './enums/PerformanceTimingNames';
5
- export type { PerformanceEntries, PerformanceLegacy, PerformanceResourceTimingInfo, PropagateTraceHeaderCorsUrls, } from './types';
6
- export { addSpanNetworkEvent, addSpanNetworkEvents, getElementXPath, getResource, hasKey, normalizeUrl, parseUrl, shouldPropagateTraceHeaders, sortResources, } from './utils';
7
- export type { URLLike } from './utils';
8
- export { AlwaysOffSampler, AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor, ConsoleSpanExporter, InMemorySpanExporter, NoopSpanProcessor, ParentBasedSampler, RandomIdGenerator, SamplingDecision, SimpleSpanProcessor, TraceIdRatioBasedSampler, } from '@opentelemetry/sdk-trace-base';
9
- export type { BatchSpanProcessorBrowserConfig, BufferConfig, GeneralLimits, IdGenerator, ReadableSpan, Sampler, SamplingResult, SDKRegistrationConfig, Span, SpanExporter, SpanLimits, SpanProcessor, TimedEvent, TracerConfig, } from '@opentelemetry/sdk-trace-base';
10
- //# sourceMappingURL=index.d.ts.map
@@ -1,10 +0,0 @@
1
- /*
2
- * Copyright The OpenTelemetry Authors
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- export { WebTracerProvider } from './WebTracerProvider';
6
- export { StackContextManager } from './StackContextManager';
7
- export { PerformanceTimingNames } from './enums/PerformanceTimingNames';
8
- export { addSpanNetworkEvent, addSpanNetworkEvents, getElementXPath, getResource, hasKey, normalizeUrl, parseUrl, shouldPropagateTraceHeaders, sortResources, } from './utils';
9
- export { AlwaysOffSampler, AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor, ConsoleSpanExporter, InMemorySpanExporter, NoopSpanProcessor, ParentBasedSampler, RandomIdGenerator, SamplingDecision, SimpleSpanProcessor, TraceIdRatioBasedSampler, } from '@opentelemetry/sdk-trace-base';
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAOxE,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,2BAA2B,EAC3B,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { WebTracerProvider } from './WebTracerProvider';\nexport type { WebTracerConfig } from './WebTracerProvider';\nexport { StackContextManager } from './StackContextManager';\nexport { PerformanceTimingNames } from './enums/PerformanceTimingNames';\nexport type {\n PerformanceEntries,\n PerformanceLegacy,\n PerformanceResourceTimingInfo,\n PropagateTraceHeaderCorsUrls,\n} from './types';\nexport {\n addSpanNetworkEvent,\n addSpanNetworkEvents,\n getElementXPath,\n getResource,\n hasKey,\n normalizeUrl,\n parseUrl,\n shouldPropagateTraceHeaders,\n sortResources,\n} from './utils';\nexport type { URLLike } from './utils';\nexport {\n AlwaysOffSampler,\n AlwaysOnSampler,\n BasicTracerProvider,\n BatchSpanProcessor,\n ConsoleSpanExporter,\n InMemorySpanExporter,\n NoopSpanProcessor,\n ParentBasedSampler,\n RandomIdGenerator,\n SamplingDecision,\n SimpleSpanProcessor,\n TraceIdRatioBasedSampler,\n} from '@opentelemetry/sdk-trace-base';\nexport type {\n BatchSpanProcessorBrowserConfig,\n BufferConfig,\n GeneralLimits,\n IdGenerator,\n ReadableSpan,\n Sampler,\n SamplingResult,\n SDKRegistrationConfig,\n Span,\n SpanExporter,\n SpanLimits,\n SpanProcessor,\n TimedEvent,\n TracerConfig,\n} from '@opentelemetry/sdk-trace-base';\n"]}
@@ -1,21 +0,0 @@
1
- /**
2
- * Deprecated, use `http.response.header.<key>` instead.
3
- *
4
- * @example 3495
5
- *
6
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
7
- *
8
- * @deprecated Replaced by `http.response.header.<key>`.
9
- */
10
- export declare const ATTR_HTTP_RESPONSE_CONTENT_LENGTH: "http.response_content_length";
11
- /**
12
- * Deprecated, use `http.response.body.size` instead.
13
- *
14
- * @example 5493
15
- *
16
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
17
- *
18
- * @deprecated Replace by `http.response.body.size`.
19
- */
20
- export declare const ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED: "http.response_content_length_uncompressed";
21
- //# sourceMappingURL=semconv.d.ts.map
@@ -1,30 +0,0 @@
1
- /*
2
- * Copyright The OpenTelemetry Authors
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- /*
6
- * This file contains a copy of unstable semantic convention definitions
7
- * used by this package.
8
- * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
9
- */
10
- /**
11
- * Deprecated, use `http.response.header.<key>` instead.
12
- *
13
- * @example 3495
14
- *
15
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
16
- *
17
- * @deprecated Replaced by `http.response.header.<key>`.
18
- */
19
- export const ATTR_HTTP_RESPONSE_CONTENT_LENGTH = 'http.response_content_length';
20
- /**
21
- * Deprecated, use `http.response.body.size` instead.
22
- *
23
- * @example 5493
24
- *
25
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
26
- *
27
- * @deprecated Replace by `http.response.body.size`.
28
- */
29
- export const ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = 'http.response_content_length_uncompressed';
30
- //# sourceMappingURL=semconv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAC5C,8BAAuC,CAAC;AAE1C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,8CAA8C,GACzD,2CAAoD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * Deprecated, use `http.response.header.<key>` instead.\n *\n * @example 3495\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `http.response.header.<key>`.\n */\nexport const ATTR_HTTP_RESPONSE_CONTENT_LENGTH =\n 'http.response_content_length' as const;\n\n/**\n * Deprecated, use `http.response.body.size` instead.\n *\n * @example 5493\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replace by `http.response.body.size`.\n */\nexport const ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED =\n 'http.response_content_length_uncompressed' as const;\n"]}
@@ -1,47 +0,0 @@
1
- import type { PerformanceTimingNames } from './enums/PerformanceTimingNames';
2
- export type PerformanceEntries = {
3
- [PerformanceTimingNames.CONNECT_END]?: number;
4
- [PerformanceTimingNames.CONNECT_START]?: number;
5
- [PerformanceTimingNames.DECODED_BODY_SIZE]?: number;
6
- [PerformanceTimingNames.DOM_COMPLETE]?: number;
7
- [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END]?: number;
8
- [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START]?: number;
9
- [PerformanceTimingNames.DOM_INTERACTIVE]?: number;
10
- [PerformanceTimingNames.DOMAIN_LOOKUP_END]?: number;
11
- [PerformanceTimingNames.DOMAIN_LOOKUP_START]?: number;
12
- [PerformanceTimingNames.ENCODED_BODY_SIZE]?: number;
13
- [PerformanceTimingNames.FETCH_START]?: number;
14
- [PerformanceTimingNames.LOAD_EVENT_END]?: number;
15
- [PerformanceTimingNames.LOAD_EVENT_START]?: number;
16
- [PerformanceTimingNames.REDIRECT_END]?: number;
17
- [PerformanceTimingNames.REDIRECT_START]?: number;
18
- [PerformanceTimingNames.REQUEST_START]?: number;
19
- [PerformanceTimingNames.RESPONSE_END]?: number;
20
- [PerformanceTimingNames.RESPONSE_START]?: number;
21
- [PerformanceTimingNames.SECURE_CONNECTION_START]?: number;
22
- [PerformanceTimingNames.START_TIME]?: number;
23
- [PerformanceTimingNames.UNLOAD_EVENT_END]?: number;
24
- [PerformanceTimingNames.UNLOAD_EVENT_START]?: number;
25
- };
26
- /**
27
- * This interface defines a fallback to read performance metrics,
28
- * this happens for example on Safari Mac
29
- */
30
- export interface PerformanceLegacy {
31
- timing?: PerformanceEntries;
32
- }
33
- /**
34
- * This interface is used in {@link getResource} function to return
35
- * main request and it's corresponding PreFlight request
36
- */
37
- export interface PerformanceResourceTimingInfo {
38
- corsPreFlightRequest?: PerformanceResourceTiming;
39
- mainRequest?: PerformanceResourceTiming;
40
- }
41
- type PropagateTraceHeaderCorsUrl = string | RegExp;
42
- /**
43
- * urls which should include trace headers when origin doesn't match
44
- */
45
- export type PropagateTraceHeaderCorsUrls = PropagateTraceHeaderCorsUrl | PropagateTraceHeaderCorsUrl[];
46
- export {};
47
- //# sourceMappingURL=types.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { PerformanceTimingNames } from './enums/PerformanceTimingNames';\n\nexport type PerformanceEntries = {\n [PerformanceTimingNames.CONNECT_END]?: number;\n [PerformanceTimingNames.CONNECT_START]?: number;\n [PerformanceTimingNames.DECODED_BODY_SIZE]?: number;\n [PerformanceTimingNames.DOM_COMPLETE]?: number;\n [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END]?: number;\n [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START]?: number;\n [PerformanceTimingNames.DOM_INTERACTIVE]?: number;\n [PerformanceTimingNames.DOMAIN_LOOKUP_END]?: number;\n [PerformanceTimingNames.DOMAIN_LOOKUP_START]?: number;\n [PerformanceTimingNames.ENCODED_BODY_SIZE]?: number;\n [PerformanceTimingNames.FETCH_START]?: number;\n [PerformanceTimingNames.LOAD_EVENT_END]?: number;\n [PerformanceTimingNames.LOAD_EVENT_START]?: number;\n [PerformanceTimingNames.REDIRECT_END]?: number;\n [PerformanceTimingNames.REDIRECT_START]?: number;\n [PerformanceTimingNames.REQUEST_START]?: number;\n [PerformanceTimingNames.RESPONSE_END]?: number;\n [PerformanceTimingNames.RESPONSE_START]?: number;\n [PerformanceTimingNames.SECURE_CONNECTION_START]?: number;\n [PerformanceTimingNames.START_TIME]?: number;\n [PerformanceTimingNames.UNLOAD_EVENT_END]?: number;\n [PerformanceTimingNames.UNLOAD_EVENT_START]?: number;\n};\n\n/**\n * This interface defines a fallback to read performance metrics,\n * this happens for example on Safari Mac\n */\nexport interface PerformanceLegacy {\n timing?: PerformanceEntries;\n}\n\n/**\n * This interface is used in {@link getResource} function to return\n * main request and it's corresponding PreFlight request\n */\nexport interface PerformanceResourceTimingInfo {\n corsPreFlightRequest?: PerformanceResourceTiming;\n mainRequest?: PerformanceResourceTiming;\n}\n\ntype PropagateTraceHeaderCorsUrl = string | RegExp;\n\n/**\n * urls which should include trace headers when origin doesn't match\n */\nexport type PropagateTraceHeaderCorsUrls =\n | PropagateTraceHeaderCorsUrl\n | PropagateTraceHeaderCorsUrl[];\n"]}
@@ -1,80 +0,0 @@
1
- import type { PerformanceEntries, PerformanceResourceTimingInfo, PropagateTraceHeaderCorsUrls } from './types';
2
- import type * as api from '@opentelemetry/api';
3
- /**
4
- * Helper function to be able to use enum as typed key in type and in interface when using forEach
5
- * @param obj
6
- * @param key
7
- */
8
- export declare function hasKey<O extends object>(obj: O, key: PropertyKey): key is keyof O;
9
- /**
10
- * Helper function for starting an event on span based on {@link PerformanceEntries}
11
- * @param span
12
- * @param performanceName name of performance entry for time start
13
- * @param entries
14
- * @param ignoreZeros
15
- */
16
- export declare function addSpanNetworkEvent(span: api.Span, performanceName: string, entries: PerformanceEntries, ignoreZeros?: boolean): api.Span | undefined;
17
- /**
18
- * Helper function for adding network events and content length attributes.
19
- */
20
- export declare function addSpanNetworkEvents(span: api.Span, resource: PerformanceEntries, ignoreNetworkEvents?: boolean, ignoreZeros?: boolean, skipOldSemconvContentLengthAttrs?: boolean): void;
21
- /**
22
- * sort resources by startTime
23
- * @param filteredResources
24
- */
25
- export declare function sortResources(filteredResources: PerformanceResourceTiming[]): PerformanceResourceTiming[];
26
- /**
27
- * Get closest performance resource ignoring the resources that have been
28
- * already used.
29
- * @param spanUrl
30
- * @param startTimeHR
31
- * @param endTimeHR
32
- * @param resources
33
- * @param ignoredResources
34
- * @param initiatorType
35
- */
36
- export declare function getResource(spanUrl: string, startTimeHR: api.HrTime, endTimeHR: api.HrTime, resources: PerformanceResourceTiming[], ignoredResources?: WeakSet<PerformanceResourceTiming>, initiatorType?: string): PerformanceResourceTimingInfo;
37
- /**
38
- * The URLLike interface represents an URL and HTMLAnchorElement compatible fields.
39
- */
40
- export interface URLLike {
41
- hash: string;
42
- host: string;
43
- hostname: string;
44
- href: string;
45
- readonly origin: string;
46
- password: string;
47
- pathname: string;
48
- port: string;
49
- protocol: string;
50
- search: string;
51
- username: string;
52
- }
53
- /**
54
- * Parses url using URL constructor or fallback to anchor element.
55
- * @param url
56
- */
57
- export declare function parseUrl(url: string): URLLike;
58
- /**
59
- * Parses url using URL constructor or fallback to anchor element and serialize
60
- * it to a string.
61
- *
62
- * Performs the steps described in https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
63
- *
64
- * @param url
65
- */
66
- export declare function normalizeUrl(url: string): string;
67
- /**
68
- * Get element XPath
69
- * @param target - target element
70
- * @param optimised - when id attribute of element is present the xpath can be
71
- * simplified to contain id
72
- */
73
- export declare function getElementXPath(target: any, optimised?: boolean): string;
74
- /**
75
- * Checks if trace headers should be propagated
76
- * @param spanUrl
77
- * @private
78
- */
79
- export declare function shouldPropagateTraceHeaders(spanUrl: string, propagateTraceHeaderCorsUrls?: PropagateTraceHeaderCorsUrls): boolean;
80
- //# sourceMappingURL=utils.d.ts.map
@@ -1,316 +0,0 @@
1
- /*
2
- * Copyright The OpenTelemetry Authors
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { PerformanceTimingNames as PTN } from './enums/PerformanceTimingNames';
6
- import { hrTimeToNanoseconds, timeInputToHrTime, urlMatches, } from '@opentelemetry/core';
7
- import { ATTR_HTTP_RESPONSE_CONTENT_LENGTH, ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED, } from './semconv';
8
- // Used to normalize relative URLs
9
- let urlNormalizingAnchor;
10
- function getUrlNormalizingAnchor() {
11
- if (!urlNormalizingAnchor) {
12
- urlNormalizingAnchor = document.createElement('a');
13
- }
14
- return urlNormalizingAnchor;
15
- }
16
- /**
17
- * Helper function to be able to use enum as typed key in type and in interface when using forEach
18
- * @param obj
19
- * @param key
20
- */
21
- export function hasKey(obj, key) {
22
- return key in obj;
23
- }
24
- /**
25
- * Helper function for starting an event on span based on {@link PerformanceEntries}
26
- * @param span
27
- * @param performanceName name of performance entry for time start
28
- * @param entries
29
- * @param ignoreZeros
30
- */
31
- export function addSpanNetworkEvent(span, performanceName, entries, ignoreZeros = true) {
32
- if (hasKey(entries, performanceName) &&
33
- typeof entries[performanceName] === 'number' &&
34
- !(ignoreZeros && entries[performanceName] === 0)) {
35
- return span.addEvent(performanceName, entries[performanceName]);
36
- }
37
- return undefined;
38
- }
39
- /**
40
- * Helper function for adding network events and content length attributes.
41
- */
42
- export function addSpanNetworkEvents(span, resource, ignoreNetworkEvents = false, ignoreZeros, skipOldSemconvContentLengthAttrs) {
43
- if (ignoreZeros === undefined) {
44
- ignoreZeros = resource[PTN.START_TIME] !== 0;
45
- }
46
- if (!ignoreNetworkEvents) {
47
- addSpanNetworkEvent(span, PTN.FETCH_START, resource, ignoreZeros);
48
- addSpanNetworkEvent(span, PTN.DOMAIN_LOOKUP_START, resource, ignoreZeros);
49
- addSpanNetworkEvent(span, PTN.DOMAIN_LOOKUP_END, resource, ignoreZeros);
50
- addSpanNetworkEvent(span, PTN.CONNECT_START, resource, ignoreZeros);
51
- addSpanNetworkEvent(span, PTN.SECURE_CONNECTION_START, resource, ignoreZeros);
52
- addSpanNetworkEvent(span, PTN.CONNECT_END, resource, ignoreZeros);
53
- addSpanNetworkEvent(span, PTN.REQUEST_START, resource, ignoreZeros);
54
- addSpanNetworkEvent(span, PTN.RESPONSE_START, resource, ignoreZeros);
55
- addSpanNetworkEvent(span, PTN.RESPONSE_END, resource, ignoreZeros);
56
- }
57
- if (!skipOldSemconvContentLengthAttrs) {
58
- // This block adds content-length-related span attributes using the
59
- // *old* HTTP semconv (v1.7.0).
60
- const encodedLength = resource[PTN.ENCODED_BODY_SIZE];
61
- if (encodedLength !== undefined) {
62
- span.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH, encodedLength);
63
- }
64
- const decodedLength = resource[PTN.DECODED_BODY_SIZE];
65
- // Spec: Not set if transport encoding not used (in which case encoded and decoded sizes match)
66
- if (decodedLength !== undefined && encodedLength !== decodedLength) {
67
- span.setAttribute(ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED, decodedLength);
68
- }
69
- }
70
- }
71
- /**
72
- * sort resources by startTime
73
- * @param filteredResources
74
- */
75
- export function sortResources(filteredResources) {
76
- return filteredResources.slice().sort((a, b) => {
77
- const valueA = a[PTN.FETCH_START];
78
- const valueB = b[PTN.FETCH_START];
79
- if (valueA > valueB) {
80
- return 1;
81
- }
82
- else if (valueA < valueB) {
83
- return -1;
84
- }
85
- return 0;
86
- });
87
- }
88
- /** Returns the origin if present (if in browser context). */
89
- function getOrigin() {
90
- return typeof location !== 'undefined' ? location.origin : undefined;
91
- }
92
- /**
93
- * Get closest performance resource ignoring the resources that have been
94
- * already used.
95
- * @param spanUrl
96
- * @param startTimeHR
97
- * @param endTimeHR
98
- * @param resources
99
- * @param ignoredResources
100
- * @param initiatorType
101
- */
102
- export function getResource(spanUrl, startTimeHR, endTimeHR, resources, ignoredResources = new WeakSet(), initiatorType) {
103
- // de-relativize the URL before usage (does no harm to absolute URLs)
104
- const parsedSpanUrl = parseUrl(spanUrl);
105
- spanUrl = parsedSpanUrl.toString();
106
- const filteredResources = filterResourcesForSpan(spanUrl, startTimeHR, endTimeHR, resources, ignoredResources, initiatorType);
107
- if (filteredResources.length === 0) {
108
- return {
109
- mainRequest: undefined,
110
- };
111
- }
112
- if (filteredResources.length === 1) {
113
- return {
114
- mainRequest: filteredResources[0],
115
- };
116
- }
117
- const sorted = sortResources(filteredResources);
118
- if (parsedSpanUrl.origin !== getOrigin() && sorted.length > 1) {
119
- let corsPreFlightRequest = sorted[0];
120
- let mainRequest = findMainRequest(sorted, corsPreFlightRequest[PTN.RESPONSE_END], endTimeHR);
121
- const responseEnd = corsPreFlightRequest[PTN.RESPONSE_END];
122
- const fetchStart = mainRequest[PTN.FETCH_START];
123
- // no corsPreFlightRequest
124
- if (fetchStart < responseEnd) {
125
- mainRequest = corsPreFlightRequest;
126
- corsPreFlightRequest = undefined;
127
- }
128
- return {
129
- corsPreFlightRequest,
130
- mainRequest,
131
- };
132
- }
133
- else {
134
- return {
135
- mainRequest: filteredResources[0],
136
- };
137
- }
138
- }
139
- /**
140
- * Will find the main request skipping the cors pre flight requests
141
- * @param resources
142
- * @param corsPreFlightRequestEndTime
143
- * @param spanEndTimeHR
144
- */
145
- function findMainRequest(resources, corsPreFlightRequestEndTime, spanEndTimeHR) {
146
- const spanEndTime = hrTimeToNanoseconds(spanEndTimeHR);
147
- const minTime = hrTimeToNanoseconds(timeInputToHrTime(corsPreFlightRequestEndTime));
148
- let mainRequest = resources[1];
149
- let bestGap;
150
- const length = resources.length;
151
- for (let i = 1; i < length; i++) {
152
- const resource = resources[i];
153
- const resourceStartTime = hrTimeToNanoseconds(timeInputToHrTime(resource[PTN.FETCH_START]));
154
- const resourceEndTime = hrTimeToNanoseconds(timeInputToHrTime(resource[PTN.RESPONSE_END]));
155
- const currentGap = spanEndTime - resourceEndTime;
156
- if (resourceStartTime >= minTime && (!bestGap || currentGap < bestGap)) {
157
- bestGap = currentGap;
158
- mainRequest = resource;
159
- }
160
- }
161
- return mainRequest;
162
- }
163
- /**
164
- * Filter all resources that has started and finished according to span start time and end time.
165
- * It will return the closest resource to a start time
166
- * @param spanUrl
167
- * @param startTimeHR
168
- * @param endTimeHR
169
- * @param resources
170
- * @param ignoredResources
171
- */
172
- function filterResourcesForSpan(spanUrl, startTimeHR, endTimeHR, resources, ignoredResources, initiatorType) {
173
- const startTime = hrTimeToNanoseconds(startTimeHR);
174
- const endTime = hrTimeToNanoseconds(endTimeHR);
175
- let filteredResources = resources.filter(resource => {
176
- const resourceStartTime = hrTimeToNanoseconds(timeInputToHrTime(resource[PTN.FETCH_START]));
177
- const resourceEndTime = hrTimeToNanoseconds(timeInputToHrTime(resource[PTN.RESPONSE_END]));
178
- return (resource.initiatorType.toLowerCase() ===
179
- (initiatorType || 'xmlhttprequest') &&
180
- resource.name === spanUrl &&
181
- resourceStartTime >= startTime &&
182
- resourceEndTime <= endTime);
183
- });
184
- if (filteredResources.length > 0) {
185
- filteredResources = filteredResources.filter(resource => {
186
- return !ignoredResources.has(resource);
187
- });
188
- }
189
- return filteredResources;
190
- }
191
- /**
192
- * Parses url using URL constructor or fallback to anchor element.
193
- * @param url
194
- */
195
- export function parseUrl(url) {
196
- if (typeof URL === 'function') {
197
- return new URL(url, typeof document !== 'undefined'
198
- ? document.baseURI
199
- : typeof location !== 'undefined' // Some JS runtimes (e.g. Deno) don't define this
200
- ? location.href
201
- : undefined);
202
- }
203
- const element = getUrlNormalizingAnchor();
204
- element.href = url;
205
- return element;
206
- }
207
- /**
208
- * Parses url using URL constructor or fallback to anchor element and serialize
209
- * it to a string.
210
- *
211
- * Performs the steps described in https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
212
- *
213
- * @param url
214
- */
215
- export function normalizeUrl(url) {
216
- const urlLike = parseUrl(url);
217
- return urlLike.href;
218
- }
219
- /**
220
- * Get element XPath
221
- * @param target - target element
222
- * @param optimised - when id attribute of element is present the xpath can be
223
- * simplified to contain id
224
- */
225
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
- export function getElementXPath(target, optimised) {
227
- if (target.nodeType === Node.DOCUMENT_NODE) {
228
- return '/';
229
- }
230
- const targetValue = getNodeValue(target, optimised);
231
- if (optimised && targetValue.indexOf('@id') > 0) {
232
- return targetValue;
233
- }
234
- let xpath = '';
235
- if (target.parentNode) {
236
- xpath += getElementXPath(target.parentNode, optimised);
237
- }
238
- xpath += targetValue;
239
- return xpath;
240
- }
241
- /**
242
- * get node index within the siblings
243
- * @param target
244
- */
245
- function getNodeIndex(target) {
246
- if (!target.parentNode) {
247
- return 0;
248
- }
249
- const allowedTypes = [target.nodeType];
250
- if (target.nodeType === Node.CDATA_SECTION_NODE) {
251
- allowedTypes.push(Node.TEXT_NODE);
252
- }
253
- let elements = Array.from(target.parentNode.childNodes);
254
- elements = elements.filter((element) => {
255
- const localName = element.localName;
256
- return (allowedTypes.indexOf(element.nodeType) >= 0 &&
257
- localName === target.localName);
258
- });
259
- if (elements.length >= 1) {
260
- return elements.indexOf(target) + 1; // xpath starts from 1
261
- }
262
- // if there are no other similar child xpath doesn't need index
263
- return 0;
264
- }
265
- /**
266
- * get node value for xpath
267
- * @param target
268
- * @param optimised
269
- */
270
- function getNodeValue(target, optimised) {
271
- const nodeType = target.nodeType;
272
- const index = getNodeIndex(target);
273
- let nodeValue;
274
- if (nodeType === Node.ELEMENT_NODE) {
275
- const id = target.getAttribute('id');
276
- if (optimised && id) {
277
- return `//*[@id="${id}"]`;
278
- }
279
- nodeValue = target.localName;
280
- }
281
- else if (nodeType === Node.TEXT_NODE ||
282
- nodeType === Node.CDATA_SECTION_NODE) {
283
- nodeValue = 'text()';
284
- }
285
- else if (nodeType === Node.COMMENT_NODE) {
286
- nodeValue = 'comment()';
287
- }
288
- else {
289
- return '';
290
- }
291
- // if index is 1 it can be omitted in xpath
292
- if (nodeValue && index > 1) {
293
- return `/${nodeValue}[${index}]`;
294
- }
295
- return `/${nodeValue}`;
296
- }
297
- /**
298
- * Checks if trace headers should be propagated
299
- * @param spanUrl
300
- * @private
301
- */
302
- export function shouldPropagateTraceHeaders(spanUrl, propagateTraceHeaderCorsUrls) {
303
- let propagateTraceHeaderUrls = propagateTraceHeaderCorsUrls || [];
304
- if (typeof propagateTraceHeaderUrls === 'string' ||
305
- propagateTraceHeaderUrls instanceof RegExp) {
306
- propagateTraceHeaderUrls = [propagateTraceHeaderUrls];
307
- }
308
- const parsedSpanUrl = parseUrl(spanUrl);
309
- if (parsedSpanUrl.origin === getOrigin()) {
310
- return true;
311
- }
312
- else {
313
- return propagateTraceHeaderUrls.some(propagateTraceHeaderUrl => urlMatches(spanUrl, propagateTraceHeaderUrl));
314
- }
315
- }
316
- //# sourceMappingURL=utils.js.map