@elastic/opentelemetry-browser 0.2.0 → 0.3.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.
@@ -128,11 +128,11 @@
128
128
  }
129
129
  };
130
130
  function logProxy(funcName, namespace, args) {
131
- const logger3 = getGlobal("diag");
132
- if (!logger3) {
131
+ const logger4 = getGlobal("diag");
132
+ if (!logger4) {
133
133
  return;
134
134
  }
135
- return logger3[funcName](namespace, ...args);
135
+ return logger4[funcName](namespace, ...args);
136
136
  }
137
137
 
138
138
  // node_modules/@opentelemetry/api/build/esnext/diag/types.js
@@ -148,17 +148,17 @@
148
148
  })(DiagLogLevel || (DiagLogLevel = {}));
149
149
 
150
150
  // node_modules/@opentelemetry/api/build/esnext/diag/internal/logLevelLogger.js
151
- function createLogLevelDiagLogger(maxLevel, logger3) {
151
+ function createLogLevelDiagLogger(maxLevel, logger4) {
152
152
  if (maxLevel < DiagLogLevel.NONE) {
153
153
  maxLevel = DiagLogLevel.NONE;
154
154
  } else if (maxLevel > DiagLogLevel.ALL) {
155
155
  maxLevel = DiagLogLevel.ALL;
156
156
  }
157
- logger3 = logger3 || {};
157
+ logger4 = logger4 || {};
158
158
  function _filterFunc(funcName, theLevel) {
159
- const theFunc = logger3[funcName];
159
+ const theFunc = logger4[funcName];
160
160
  if (typeof theFunc === "function" && maxLevel >= theLevel) {
161
- return theFunc.bind(logger3);
161
+ return theFunc.bind(logger4);
162
162
  }
163
163
  return function() {
164
164
  };
@@ -189,16 +189,16 @@
189
189
  constructor() {
190
190
  function _logProxy(funcName) {
191
191
  return function(...args) {
192
- const logger3 = getGlobal("diag");
193
- if (!logger3)
192
+ const logger4 = getGlobal("diag");
193
+ if (!logger4)
194
194
  return;
195
- return logger3[funcName](...args);
195
+ return logger4[funcName](...args);
196
196
  };
197
197
  }
198
198
  const self2 = this;
199
- const setLogger = (logger3, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
199
+ const setLogger = (logger4, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
200
200
  var _a, _b, _c;
201
- if (logger3 === self2) {
201
+ if (logger4 === self2) {
202
202
  const err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
203
203
  self2.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
204
204
  return false;
@@ -209,7 +209,7 @@
209
209
  };
210
210
  }
211
211
  const oldLogger = getGlobal("diag");
212
- const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger3);
212
+ const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger4);
213
213
  if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
214
214
  const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
215
215
  oldLogger.warn(`Current logger will be overwritten from ${stack}`);
@@ -1079,32 +1079,32 @@
1079
1079
 
1080
1080
  // node_modules/@opentelemetry/api-logs/build/esm/types/LogRecord.js
1081
1081
  var SeverityNumber;
1082
- (function(SeverityNumber2) {
1083
- SeverityNumber2[SeverityNumber2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
1084
- SeverityNumber2[SeverityNumber2["TRACE"] = 1] = "TRACE";
1085
- SeverityNumber2[SeverityNumber2["TRACE2"] = 2] = "TRACE2";
1086
- SeverityNumber2[SeverityNumber2["TRACE3"] = 3] = "TRACE3";
1087
- SeverityNumber2[SeverityNumber2["TRACE4"] = 4] = "TRACE4";
1088
- SeverityNumber2[SeverityNumber2["DEBUG"] = 5] = "DEBUG";
1089
- SeverityNumber2[SeverityNumber2["DEBUG2"] = 6] = "DEBUG2";
1090
- SeverityNumber2[SeverityNumber2["DEBUG3"] = 7] = "DEBUG3";
1091
- SeverityNumber2[SeverityNumber2["DEBUG4"] = 8] = "DEBUG4";
1092
- SeverityNumber2[SeverityNumber2["INFO"] = 9] = "INFO";
1093
- SeverityNumber2[SeverityNumber2["INFO2"] = 10] = "INFO2";
1094
- SeverityNumber2[SeverityNumber2["INFO3"] = 11] = "INFO3";
1095
- SeverityNumber2[SeverityNumber2["INFO4"] = 12] = "INFO4";
1096
- SeverityNumber2[SeverityNumber2["WARN"] = 13] = "WARN";
1097
- SeverityNumber2[SeverityNumber2["WARN2"] = 14] = "WARN2";
1098
- SeverityNumber2[SeverityNumber2["WARN3"] = 15] = "WARN3";
1099
- SeverityNumber2[SeverityNumber2["WARN4"] = 16] = "WARN4";
1100
- SeverityNumber2[SeverityNumber2["ERROR"] = 17] = "ERROR";
1101
- SeverityNumber2[SeverityNumber2["ERROR2"] = 18] = "ERROR2";
1102
- SeverityNumber2[SeverityNumber2["ERROR3"] = 19] = "ERROR3";
1103
- SeverityNumber2[SeverityNumber2["ERROR4"] = 20] = "ERROR4";
1104
- SeverityNumber2[SeverityNumber2["FATAL"] = 21] = "FATAL";
1105
- SeverityNumber2[SeverityNumber2["FATAL2"] = 22] = "FATAL2";
1106
- SeverityNumber2[SeverityNumber2["FATAL3"] = 23] = "FATAL3";
1107
- SeverityNumber2[SeverityNumber2["FATAL4"] = 24] = "FATAL4";
1082
+ (function(SeverityNumber3) {
1083
+ SeverityNumber3[SeverityNumber3["UNSPECIFIED"] = 0] = "UNSPECIFIED";
1084
+ SeverityNumber3[SeverityNumber3["TRACE"] = 1] = "TRACE";
1085
+ SeverityNumber3[SeverityNumber3["TRACE2"] = 2] = "TRACE2";
1086
+ SeverityNumber3[SeverityNumber3["TRACE3"] = 3] = "TRACE3";
1087
+ SeverityNumber3[SeverityNumber3["TRACE4"] = 4] = "TRACE4";
1088
+ SeverityNumber3[SeverityNumber3["DEBUG"] = 5] = "DEBUG";
1089
+ SeverityNumber3[SeverityNumber3["DEBUG2"] = 6] = "DEBUG2";
1090
+ SeverityNumber3[SeverityNumber3["DEBUG3"] = 7] = "DEBUG3";
1091
+ SeverityNumber3[SeverityNumber3["DEBUG4"] = 8] = "DEBUG4";
1092
+ SeverityNumber3[SeverityNumber3["INFO"] = 9] = "INFO";
1093
+ SeverityNumber3[SeverityNumber3["INFO2"] = 10] = "INFO2";
1094
+ SeverityNumber3[SeverityNumber3["INFO3"] = 11] = "INFO3";
1095
+ SeverityNumber3[SeverityNumber3["INFO4"] = 12] = "INFO4";
1096
+ SeverityNumber3[SeverityNumber3["WARN"] = 13] = "WARN";
1097
+ SeverityNumber3[SeverityNumber3["WARN2"] = 14] = "WARN2";
1098
+ SeverityNumber3[SeverityNumber3["WARN3"] = 15] = "WARN3";
1099
+ SeverityNumber3[SeverityNumber3["WARN4"] = 16] = "WARN4";
1100
+ SeverityNumber3[SeverityNumber3["ERROR"] = 17] = "ERROR";
1101
+ SeverityNumber3[SeverityNumber3["ERROR2"] = 18] = "ERROR2";
1102
+ SeverityNumber3[SeverityNumber3["ERROR3"] = 19] = "ERROR3";
1103
+ SeverityNumber3[SeverityNumber3["ERROR4"] = 20] = "ERROR4";
1104
+ SeverityNumber3[SeverityNumber3["FATAL"] = 21] = "FATAL";
1105
+ SeverityNumber3[SeverityNumber3["FATAL2"] = 22] = "FATAL2";
1106
+ SeverityNumber3[SeverityNumber3["FATAL3"] = 23] = "FATAL3";
1107
+ SeverityNumber3[SeverityNumber3["FATAL4"] = 24] = "FATAL4";
1108
1108
  })(SeverityNumber || (SeverityNumber = {}));
1109
1109
 
1110
1110
  // node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js
@@ -1116,6 +1116,9 @@
1116
1116
  }
1117
1117
  };
1118
1118
  var NOOP_LOGGER = new NoopLogger();
1119
+ function createNoopLogger() {
1120
+ return NOOP_LOGGER;
1121
+ }
1119
1122
 
1120
1123
  // node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js
1121
1124
  var GLOBAL_LOGS_API_KEY = /* @__PURE__ */ Symbol.for("io.opentelemetry.js.api.logs");
@@ -1160,11 +1163,11 @@
1160
1163
  if (this._delegate) {
1161
1164
  return this._delegate;
1162
1165
  }
1163
- const logger3 = this._provider._getDelegateLogger(this.name, this.version, this.options);
1164
- if (!logger3) {
1166
+ const logger4 = this._provider._getDelegateLogger(this.name, this.version, this.options);
1167
+ if (!logger4) {
1165
1168
  return NOOP_LOGGER;
1166
1169
  }
1167
- this._delegate = logger3;
1170
+ this._delegate = logger4;
1168
1171
  return this._delegate;
1169
1172
  }
1170
1173
  };
@@ -1229,9 +1232,17 @@
1229
1232
  return (_b = (_a = _global2[GLOBAL_LOGS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(_global2, API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : this._proxyLoggerProvider;
1230
1233
  }
1231
1234
  /**
1232
- * Returns a logger from the global logger provider.
1235
+ * Returns a Logger, creating one if one with the given name, version,
1236
+ * schemaUrl, and attributes is not already created.
1233
1237
  *
1234
- * @returns Logger
1238
+ * Getting a Logger may be expensive, especially when `attributes` are
1239
+ * provided. Reuse Logger instances where possible instead of calling
1240
+ * `getLogger()` on hot paths.
1241
+ *
1242
+ * @param name The name of the logger or instrumentation library.
1243
+ * @param version The version of the logger or instrumentation library.
1244
+ * @param options The options of the logger or instrumentation library.
1245
+ * @returns {@link Logger}
1235
1246
  */
1236
1247
  getLogger(name, version2, options) {
1237
1248
  return this.getLoggerProvider().getLogger(name, version2, options);
@@ -1401,6 +1412,29 @@
1401
1412
  }
1402
1413
  return { key, value, metadata };
1403
1414
  }
1415
+ function parseBaggageHeaderString(value, baggage, count, totalSize) {
1416
+ let start = 0;
1417
+ while (start < value.length && count < BAGGAGE_MAX_NAME_VALUE_PAIRS) {
1418
+ const end = value.indexOf(BAGGAGE_ITEMS_SEPARATOR, start);
1419
+ const entryEnd = end === -1 ? value.length : end;
1420
+ const entryLength = entryEnd - start;
1421
+ if (entryLength <= BAGGAGE_MAX_PER_NAME_VALUE_PAIRS) {
1422
+ const keyPair = parsePairKeyValue(value.substring(start, entryEnd));
1423
+ if (keyPair) {
1424
+ const entrySize = (count === 0 ? 0 : 1) + entryLength;
1425
+ if (totalSize + entrySize > BAGGAGE_MAX_TOTAL_LENGTH)
1426
+ break;
1427
+ baggage[keyPair.key] = keyPair.metadata ? { value: keyPair.value, metadata: keyPair.metadata } : { value: keyPair.value };
1428
+ count++;
1429
+ totalSize += entrySize;
1430
+ }
1431
+ }
1432
+ if (end === -1)
1433
+ break;
1434
+ start = end + 1;
1435
+ }
1436
+ return [count, totalSize];
1437
+ }
1404
1438
 
1405
1439
  // node_modules/@opentelemetry/core/build/esm/baggage/propagation/W3CBaggagePropagator.js
1406
1440
  var W3CBaggagePropagator = class {
@@ -1418,25 +1452,20 @@
1418
1452
  }
1419
1453
  extract(context2, carrier, getter) {
1420
1454
  const headerValue = getter.get(carrier, BAGGAGE_HEADER);
1421
- const baggageString = Array.isArray(headerValue) ? headerValue.join(BAGGAGE_ITEMS_SEPARATOR) : headerValue;
1422
- if (!baggageString)
1423
- return context2;
1424
- const baggage = {};
1425
- if (baggageString.length === 0) {
1455
+ if (!headerValue) {
1426
1456
  return context2;
1427
1457
  }
1428
- const pairs = baggageString.split(BAGGAGE_ITEMS_SEPARATOR);
1429
- pairs.forEach((entry) => {
1430
- const keyPair = parsePairKeyValue(entry);
1431
- if (keyPair) {
1432
- const baggageEntry = { value: keyPair.value };
1433
- if (keyPair.metadata) {
1434
- baggageEntry.metadata = keyPair.metadata;
1435
- }
1436
- baggage[keyPair.key] = baggageEntry;
1458
+ const baggage = {};
1459
+ let count = 0;
1460
+ let totalSize = 0;
1461
+ if (Array.isArray(headerValue)) {
1462
+ for (let i2 = 0; i2 < headerValue.length; i2++) {
1463
+ [count, totalSize] = parseBaggageHeaderString(headerValue[i2], baggage, count, totalSize);
1437
1464
  }
1438
- });
1439
- if (Object.entries(baggage).length === 0) {
1465
+ } else {
1466
+ [count] = parseBaggageHeaderString(headerValue, baggage, count, totalSize);
1467
+ }
1468
+ if (count === 0) {
1440
1469
  return context2;
1441
1470
  }
1442
1471
  return propagation.setBaggage(context2, propagation.createBaggage(baggage));
@@ -1566,7 +1595,7 @@
1566
1595
  }
1567
1596
 
1568
1597
  // node_modules/@opentelemetry/core/build/esm/version.js
1569
- var VERSION2 = "2.7.0";
1598
+ var VERSION2 = "2.8.0";
1570
1599
 
1571
1600
  // node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.js
1572
1601
  var ATTR_ERROR_TYPE = "error.type";
@@ -1646,6 +1675,9 @@
1646
1675
  function hrTimeToMicroseconds(time) {
1647
1676
  return time[0] * 1e6 + time[1] / 1e3;
1648
1677
  }
1678
+ function hrTimeToSeconds(time) {
1679
+ return time[0] + time[1] / SECOND_TO_NANOSECONDS;
1680
+ }
1649
1681
  function isTimeInputHrTime(value) {
1650
1682
  return Array.isArray(value) && value.length === 2 && typeof value[0] === "number" && typeof value[1] === "number";
1651
1683
  }
@@ -1679,7 +1711,14 @@
1679
1711
  */
1680
1712
  constructor(config = {}) {
1681
1713
  this._propagators = config.propagators ?? [];
1682
- this._fields = Array.from(new Set(this._propagators.map((p2) => typeof p2.fields === "function" ? p2.fields() : []).reduce((x2, y2) => x2.concat(y2), [])));
1714
+ const fields = /* @__PURE__ */ new Set();
1715
+ for (const propagator of this._propagators) {
1716
+ const propagatorFields = typeof propagator.fields === "function" ? propagator.fields() : [];
1717
+ for (const field of propagatorFields) {
1718
+ fields.add(field);
1719
+ }
1720
+ }
1721
+ this._fields = Array.from(fields);
1683
1722
  }
1684
1723
  /**
1685
1724
  * Run each of the configured propagators with the given context and carrier.
@@ -1743,59 +1782,99 @@
1743
1782
  var LIST_MEMBERS_SEPARATOR = ",";
1744
1783
  var LIST_MEMBER_KEY_VALUE_SPLITTER = "=";
1745
1784
  var TraceState = class _TraceState {
1746
- _internalState = /* @__PURE__ */ new Map();
1785
+ _length;
1786
+ _rawTraceState;
1787
+ _internalState;
1747
1788
  constructor(rawTraceState) {
1748
- if (rawTraceState)
1749
- this._parse(rawTraceState);
1789
+ this._rawTraceState = typeof rawTraceState === "string" ? rawTraceState : "";
1790
+ this._length = this._rawTraceState.length;
1750
1791
  }
1751
1792
  set(key, value) {
1752
- const traceState = this._clone();
1753
- if (traceState._internalState.has(key)) {
1754
- traceState._internalState.delete(key);
1793
+ if (!validateKey(key) || !validateValue(value)) {
1794
+ return this;
1755
1795
  }
1756
- traceState._internalState.set(key, value);
1757
- return traceState;
1796
+ const currState = this._getState();
1797
+ const currValue = currState.get(key);
1798
+ let newLength = this._length;
1799
+ if (typeof currValue === "string") {
1800
+ newLength += value.length - currValue.length;
1801
+ } else {
1802
+ newLength += key.length + value.length + (currState.size > 0 ? 2 : 1);
1803
+ }
1804
+ if (newLength > MAX_TRACE_STATE_LEN) {
1805
+ return this;
1806
+ }
1807
+ const newState = new Map(currState);
1808
+ newState.delete(key);
1809
+ newState.set(key, value);
1810
+ return this._fromState(newState, newLength);
1758
1811
  }
1759
1812
  unset(key) {
1760
- const traceState = this._clone();
1761
- traceState._internalState.delete(key);
1762
- return traceState;
1813
+ const currState = this._getState();
1814
+ const currValue = currState.get(key);
1815
+ if (typeof currValue !== "string") {
1816
+ return this;
1817
+ }
1818
+ let newLength = this._length - (key.length + currValue.length + 1);
1819
+ if (currState.size > 1) {
1820
+ newLength = newLength - 1;
1821
+ }
1822
+ const newState = new Map(currState);
1823
+ newState.delete(key);
1824
+ return this._fromState(newState, newLength);
1763
1825
  }
1764
1826
  get(key) {
1765
- return this._internalState.get(key);
1827
+ const currState = this._getState();
1828
+ return currState.get(key);
1766
1829
  }
1767
1830
  serialize() {
1768
- return this._keys().reduce((agg, key) => {
1769
- agg.push(key + LIST_MEMBER_KEY_VALUE_SPLITTER + this.get(key));
1770
- return agg;
1771
- }, []).join(LIST_MEMBERS_SEPARATOR);
1772
- }
1773
- _parse(rawTraceState) {
1774
- if (rawTraceState.length > MAX_TRACE_STATE_LEN)
1775
- return;
1776
- this._internalState = rawTraceState.split(LIST_MEMBERS_SEPARATOR).reverse().reduce((agg, part) => {
1777
- const listMember = part.trim();
1778
- const i2 = listMember.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
1779
- if (i2 !== -1) {
1780
- const key = listMember.slice(0, i2);
1781
- const value = listMember.slice(i2 + 1, part.length);
1782
- if (validateKey(key) && validateValue(value)) {
1783
- agg.set(key, value);
1784
- } else {
1785
- }
1831
+ let serialized = "";
1832
+ let index = 0;
1833
+ for (const entry of this._getState()) {
1834
+ if (index > 0) {
1835
+ serialized = LIST_MEMBERS_SEPARATOR + serialized;
1836
+ }
1837
+ serialized = `${entry[0]}${LIST_MEMBER_KEY_VALUE_SPLITTER}${entry[1]}` + serialized;
1838
+ index++;
1839
+ }
1840
+ return serialized;
1841
+ }
1842
+ _getState() {
1843
+ if (this._internalState) {
1844
+ return this._internalState;
1845
+ }
1846
+ const vendorMembers = this._rawTraceState.split(LIST_MEMBERS_SEPARATOR);
1847
+ const vendorEntries = /* @__PURE__ */ new Map();
1848
+ let currentLength = 0;
1849
+ for (const member of vendorMembers) {
1850
+ const m2 = member.trim();
1851
+ const idx = m2.indexOf(LIST_MEMBER_KEY_VALUE_SPLITTER);
1852
+ if (idx === -1) {
1853
+ continue;
1854
+ }
1855
+ const key = m2.slice(0, idx);
1856
+ const value = m2.slice(idx + 1);
1857
+ if (!validateKey(key) || !validateValue(value)) {
1858
+ continue;
1859
+ }
1860
+ const futureLength = currentLength + m2.length + (vendorEntries.size > 0 ? 1 : 0);
1861
+ if (futureLength > MAX_TRACE_STATE_LEN) {
1862
+ continue;
1863
+ }
1864
+ vendorEntries.set(key, value);
1865
+ currentLength = futureLength;
1866
+ if (vendorEntries.size >= MAX_TRACE_STATE_ITEMS) {
1867
+ break;
1786
1868
  }
1787
- return agg;
1788
- }, /* @__PURE__ */ new Map());
1789
- if (this._internalState.size > MAX_TRACE_STATE_ITEMS) {
1790
- this._internalState = new Map(Array.from(this._internalState.entries()).reverse().slice(0, MAX_TRACE_STATE_ITEMS));
1791
1869
  }
1870
+ this._length = currentLength;
1871
+ this._internalState = new Map(Array.from(vendorEntries.entries()).reverse());
1872
+ return this._internalState;
1792
1873
  }
1793
- _keys() {
1794
- return Array.from(this._internalState.keys()).reverse();
1795
- }
1796
- _clone() {
1797
- const traceState = new _TraceState();
1798
- traceState._internalState = new Map(this._internalState);
1874
+ _fromState(state, length) {
1875
+ const traceState = Object.create(_TraceState.prototype);
1876
+ traceState._internalState = state;
1877
+ traceState._length = length;
1799
1878
  return traceState;
1800
1879
  }
1801
1880
  };
@@ -3659,6 +3738,42 @@
3659
3738
  };
3660
3739
  var DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR = (_instrumentType) => AggregationTemporality.CUMULATIVE;
3661
3740
 
3741
+ // node_modules/@opentelemetry/sdk-metrics/build/esm/semconv.js
3742
+ var ATTR_OTEL_COMPONENT_NAME = "otel.component.name";
3743
+ var ATTR_OTEL_COMPONENT_TYPE = "otel.component.type";
3744
+ var OTEL_COMPONENT_TYPE_VALUE_PERIODIC_METRIC_READER = "periodic_metric_reader";
3745
+ var METRIC_OTEL_SDK_METRIC_READER_COLLECTION_DURATION = "otel.sdk.metric_reader.collection.duration";
3746
+ var ATTR_ERROR_TYPE2 = "error.type";
3747
+
3748
+ // node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReaderMetrics.js
3749
+ var componentCounter = /* @__PURE__ */ new Map();
3750
+ var MetricReaderMetrics = class {
3751
+ collectionDuration;
3752
+ standardAttrs;
3753
+ constructor(componentType, meter) {
3754
+ const counter = componentCounter.get(componentType) ?? 0;
3755
+ componentCounter.set(componentType, counter + 1);
3756
+ this.standardAttrs = {
3757
+ [ATTR_OTEL_COMPONENT_TYPE]: componentType,
3758
+ [ATTR_OTEL_COMPONENT_NAME]: `${componentType}/${counter}`
3759
+ };
3760
+ this.collectionDuration = meter.createHistogram(METRIC_OTEL_SDK_METRIC_READER_COLLECTION_DURATION, {
3761
+ unit: "s",
3762
+ description: "The duration of the collect operation of the metric reader.",
3763
+ advice: {
3764
+ explicitBucketBoundaries: []
3765
+ }
3766
+ });
3767
+ }
3768
+ recordCollection(durationSecs, error) {
3769
+ const attrs = error ? { ...this.standardAttrs, [ATTR_ERROR_TYPE2]: error } : this.standardAttrs;
3770
+ this.collectionDuration.record(durationSecs, attrs);
3771
+ }
3772
+ };
3773
+
3774
+ // node_modules/@opentelemetry/sdk-metrics/build/esm/version.js
3775
+ var VERSION4 = "2.8.0";
3776
+
3662
3777
  // node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.js
3663
3778
  var MetricReader = class {
3664
3779
  // Tracks the shutdown state.
@@ -3668,14 +3783,19 @@
3668
3783
  _metricProducers;
3669
3784
  // MetricProducer used by this instance which produces metrics from the SDK
3670
3785
  _sdkMetricProducer;
3786
+ // Metrics about the MetricReader itself
3787
+ _selfObsMetrics;
3671
3788
  _aggregationTemporalitySelector;
3672
3789
  _aggregationSelector;
3673
3790
  _cardinalitySelector;
3791
+ _otelComponentType;
3674
3792
  constructor(options) {
3675
3793
  this._aggregationSelector = options?.aggregationSelector ?? DEFAULT_AGGREGATION_SELECTOR;
3676
3794
  this._aggregationTemporalitySelector = options?.aggregationTemporalitySelector ?? DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR;
3677
3795
  this._metricProducers = options?.metricProducers ?? [];
3678
3796
  this._cardinalitySelector = options?.cardinalitySelector;
3797
+ this._otelComponentType = options?.otelComponentType ?? this.constructor.name;
3798
+ this._selfObsMetrics = new MetricReaderMetrics(this._otelComponentType, createNoopMeter());
3679
3799
  }
3680
3800
  setMetricProducer(metricProducer) {
3681
3801
  if (this._sdkMetricProducer) {
@@ -3684,6 +3804,10 @@
3684
3804
  this._sdkMetricProducer = metricProducer;
3685
3805
  this.onInitialized();
3686
3806
  }
3807
+ _setSelfObsMeterProvider(meterProvider) {
3808
+ const meter = meterProvider.getMeter("@opentelemetry/sdk-metrics", VERSION4);
3809
+ this._selfObsMetrics = new MetricReaderMetrics(this._otelComponentType, meter);
3810
+ }
3687
3811
  selectAggregation(instrumentType) {
3688
3812
  return this._aggregationSelector(instrumentType);
3689
3813
  }
@@ -3706,6 +3830,7 @@
3706
3830
  if (this._shutdown) {
3707
3831
  throw new Error("MetricReader is shutdown");
3708
3832
  }
3833
+ const startTime = hrTime();
3709
3834
  const [sdkCollectionResults, ...additionalCollectionResults] = await Promise.all([
3710
3835
  this._sdkMetricProducer.collect({
3711
3836
  timeoutMillis: options?.timeoutMillis
@@ -3714,7 +3839,10 @@
3714
3839
  timeoutMillis: options?.timeoutMillis
3715
3840
  }))
3716
3841
  ]);
3842
+ const endTime = hrTime();
3717
3843
  const errors = sdkCollectionResults.errors.concat(additionalCollectionResults.flatMap((result) => result.errors));
3844
+ const collectDuration = hrTimeToSeconds(hrTimeDuration(startTime, endTime));
3845
+ this._selfObsMetrics.recordCollection(collectDuration, errors.length > 0 ? errors[0].name ?? "collect_error" : void 0);
3718
3846
  const resource = sdkCollectionResults.resourceMetrics.resource;
3719
3847
  const scopeMetrics = sdkCollectionResults.resourceMetrics.scopeMetrics.concat(additionalCollectionResults.flatMap((result) => result.resourceMetrics.scopeMetrics));
3720
3848
  return {
@@ -3762,6 +3890,7 @@
3762
3890
  super({
3763
3891
  aggregationSelector: exporter.selectAggregation?.bind(exporter),
3764
3892
  aggregationTemporalitySelector: exporter.selectAggregationTemporality?.bind(exporter),
3893
+ otelComponentType: OTEL_COMPONENT_TYPE_VALUE_PERIODIC_METRIC_READER,
3765
3894
  metricProducers,
3766
3895
  cardinalitySelector: (instrumentType) => {
3767
3896
  const limits = {
@@ -4336,7 +4465,9 @@
4336
4465
  accumulation?.record(value);
4337
4466
  }
4338
4467
  batchCumulate(measurements, collectionTime) {
4339
- Array.from(measurements.entries()).forEach(([attributes, value, hashCode]) => {
4468
+ for (const [originalAttributes, value, originalHashCode] of measurements.entries()) {
4469
+ let attributes = originalAttributes;
4470
+ let hashCode = originalHashCode;
4340
4471
  const accumulation = this._aggregator.createAccumulation(collectionTime);
4341
4472
  accumulation?.record(value);
4342
4473
  let delta = accumulation;
@@ -4359,7 +4490,7 @@
4359
4490
  }
4360
4491
  this._cumulativeMemoStorage.set(attributes, accumulation, hashCode);
4361
4492
  this._activeCollectionStorage.set(attributes, delta, hashCode);
4362
- });
4493
+ }
4363
4494
  }
4364
4495
  /**
4365
4496
  * Returns a collection of delta metrics. Start time is the when first
@@ -4497,9 +4628,9 @@
4497
4628
  }
4498
4629
  record(measurements, observationTime) {
4499
4630
  const processed = new AttributeHashMap();
4500
- Array.from(measurements.entries()).forEach(([attributes, value]) => {
4631
+ for (const [attributes, value] of measurements.entries()) {
4501
4632
  processed.set(this._attributesProcessor.process(attributes), value);
4502
- });
4633
+ }
4503
4634
  this._deltaMetricStorage.batchCumulate(processed, observationTime);
4504
4635
  }
4505
4636
  /**
@@ -4663,9 +4794,10 @@
4663
4794
  this._backingStorages = backingStorages;
4664
4795
  }
4665
4796
  record(value, attributes, context2, recordTime) {
4666
- this._backingStorages.forEach((it) => {
4667
- it.record(value, attributes, context2, recordTime);
4668
- });
4797
+ const storages = this._backingStorages;
4798
+ for (let i2 = 0; i2 < storages.length; i2++) {
4799
+ storages[i2].record(value, attributes, context2, recordTime);
4800
+ }
4669
4801
  }
4670
4802
  };
4671
4803
 
@@ -5260,6 +5392,9 @@
5260
5392
  const collector = new MetricCollector(this._sharedState, metricReader);
5261
5393
  metricReader.setMetricProducer(collector);
5262
5394
  this._sharedState.metricCollectors.push(collector);
5395
+ if (options.sdkMetricsEnabled && metricReader instanceof MetricReader) {
5396
+ metricReader._setSelfObsMeterProvider(this);
5397
+ }
5263
5398
  }
5264
5399
  }
5265
5400
  }
@@ -5309,14 +5444,6 @@
5309
5444
  }
5310
5445
  };
5311
5446
 
5312
- // node_modules/@opentelemetry/otlp-transformer/build/esm/metrics/internal-types.js
5313
- var EAggregationTemporality;
5314
- (function(EAggregationTemporality2) {
5315
- EAggregationTemporality2[EAggregationTemporality2["AGGREGATION_TEMPORALITY_UNSPECIFIED"] = 0] = "AGGREGATION_TEMPORALITY_UNSPECIFIED";
5316
- EAggregationTemporality2[EAggregationTemporality2["AGGREGATION_TEMPORALITY_DELTA"] = 1] = "AGGREGATION_TEMPORALITY_DELTA";
5317
- EAggregationTemporality2[EAggregationTemporality2["AGGREGATION_TEMPORALITY_CUMULATIVE"] = 2] = "AGGREGATION_TEMPORALITY_CUMULATIVE";
5318
- })(EAggregationTemporality || (EAggregationTemporality = {}));
5319
-
5320
5447
  // node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js
5321
5448
  function createResource(resource, encoder) {
5322
5449
  const result = {
@@ -5328,11 +5455,16 @@
5328
5455
  result.schemaUrl = schemaUrl;
5329
5456
  return result;
5330
5457
  }
5331
- function createInstrumentationScope(scope) {
5332
- return {
5458
+ function createInstrumentationScope(scope, encoder) {
5459
+ const result = {
5333
5460
  name: scope.name,
5334
5461
  version: scope.version
5335
5462
  };
5463
+ if (scope.attributes && Object.keys(scope.attributes).length > 0) {
5464
+ result.attributes = toAttributes(scope.attributes, encoder);
5465
+ result.droppedAttributesCount = scope.droppedAttributesCount ?? 0;
5466
+ }
5467
+ return result;
5336
5468
  }
5337
5469
  function toAttributes(attributes, encoder) {
5338
5470
  return Object.keys(attributes).map((key) => toKeyValue(key, attributes[key], encoder));
@@ -5377,6 +5509,124 @@
5377
5509
  return {};
5378
5510
  }
5379
5511
 
5512
+ // node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js
5513
+ function createExportLogsServiceRequest(logRecords, encoder) {
5514
+ return {
5515
+ resourceLogs: logRecordsToResourceLogs(logRecords, encoder)
5516
+ };
5517
+ }
5518
+ function createResourceMap(logRecords) {
5519
+ const resourceMap = /* @__PURE__ */ new Map();
5520
+ for (const record of logRecords) {
5521
+ const { resource, instrumentationScope } = record;
5522
+ let ismMap = resourceMap.get(resource);
5523
+ if (!ismMap) {
5524
+ ismMap = /* @__PURE__ */ new Map();
5525
+ resourceMap.set(resource, ismMap);
5526
+ }
5527
+ let records = ismMap.get(instrumentationScope);
5528
+ if (!records) {
5529
+ records = [];
5530
+ ismMap.set(instrumentationScope, records);
5531
+ }
5532
+ records.push(record);
5533
+ }
5534
+ return resourceMap;
5535
+ }
5536
+ function logRecordsToResourceLogs(logRecords, encoder) {
5537
+ const resourceMap = createResourceMap(logRecords);
5538
+ return Array.from(resourceMap, ([resource, ismMap]) => {
5539
+ const processedResource = createResource(resource, encoder);
5540
+ return {
5541
+ resource: processedResource,
5542
+ scopeLogs: Array.from(ismMap, ([, scopeLogs]) => {
5543
+ return {
5544
+ scope: createInstrumentationScope(scopeLogs[0].instrumentationScope, encoder),
5545
+ logRecords: scopeLogs.map((log) => toLogRecord(log, encoder)),
5546
+ schemaUrl: scopeLogs[0].instrumentationScope.schemaUrl
5547
+ };
5548
+ }),
5549
+ schemaUrl: processedResource.schemaUrl
5550
+ };
5551
+ });
5552
+ }
5553
+ function toLogRecord(log, encoder) {
5554
+ return {
5555
+ timeUnixNano: encoder.encodeHrTime(log.hrTime),
5556
+ observedTimeUnixNano: encoder.encodeHrTime(log.hrTimeObserved),
5557
+ severityNumber: toSeverityNumber(log.severityNumber),
5558
+ severityText: log.severityText,
5559
+ body: toAnyValue(log.body, encoder),
5560
+ eventName: log.eventName,
5561
+ attributes: toAttributes(log.attributes, encoder),
5562
+ droppedAttributesCount: log.droppedAttributesCount,
5563
+ flags: log.spanContext?.traceFlags,
5564
+ traceId: encoder.encodeOptionalSpanContext(log.spanContext?.traceId),
5565
+ spanId: encoder.encodeOptionalSpanContext(log.spanContext?.spanId)
5566
+ };
5567
+ }
5568
+ function toSeverityNumber(severityNumber) {
5569
+ return severityNumber;
5570
+ }
5571
+
5572
+ // node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js
5573
+ function hrTimeToNanos(hrTime2) {
5574
+ const NANOSECONDS = BigInt(1e9);
5575
+ return BigInt(Math.trunc(hrTime2[0])) * NANOSECONDS + BigInt(Math.trunc(hrTime2[1]));
5576
+ }
5577
+ function encodeAsString(hrTime2) {
5578
+ const nanos = hrTimeToNanos(hrTime2);
5579
+ return nanos.toString();
5580
+ }
5581
+ var encodeTimestamp = typeof BigInt !== "undefined" ? encodeAsString : hrTimeToNanoseconds;
5582
+ function identity(value) {
5583
+ return value;
5584
+ }
5585
+ var JSON_ENCODER = {
5586
+ encodeHrTime: encodeTimestamp,
5587
+ encodeSpanContext: identity,
5588
+ encodeOptionalSpanContext: identity,
5589
+ encodeUint8Array: (bytes) => {
5590
+ if (typeof Buffer !== "undefined") {
5591
+ return Buffer.from(bytes).toString("base64");
5592
+ }
5593
+ const chars = new Array(bytes.length);
5594
+ for (let i2 = 0; i2 < bytes.length; i2++) {
5595
+ chars[i2] = String.fromCharCode(bytes[i2]);
5596
+ }
5597
+ return btoa(chars.join(""));
5598
+ }
5599
+ };
5600
+
5601
+ // node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/logs.js
5602
+ var JsonLogsSerializer = {
5603
+ serializeRequest: (arg) => {
5604
+ const request = createExportLogsServiceRequest(arg, JSON_ENCODER);
5605
+ const encoder = new TextEncoder();
5606
+ return encoder.encode(JSON.stringify(request));
5607
+ },
5608
+ deserializeResponse: (arg) => {
5609
+ if (arg.length === 0) {
5610
+ return {};
5611
+ }
5612
+ const decoder = new TextDecoder();
5613
+ try {
5614
+ return JSON.parse(decoder.decode(arg));
5615
+ } catch (err) {
5616
+ diag2.warn(`Failed to parse logs export response: ${err.message}. Returning empty response`);
5617
+ return {};
5618
+ }
5619
+ }
5620
+ };
5621
+
5622
+ // node_modules/@opentelemetry/otlp-transformer/build/esm/metrics/internal-types.js
5623
+ var EAggregationTemporality;
5624
+ (function(EAggregationTemporality2) {
5625
+ EAggregationTemporality2[EAggregationTemporality2["AGGREGATION_TEMPORALITY_UNSPECIFIED"] = 0] = "AGGREGATION_TEMPORALITY_UNSPECIFIED";
5626
+ EAggregationTemporality2[EAggregationTemporality2["AGGREGATION_TEMPORALITY_DELTA"] = 1] = "AGGREGATION_TEMPORALITY_DELTA";
5627
+ EAggregationTemporality2[EAggregationTemporality2["AGGREGATION_TEMPORALITY_CUMULATIVE"] = 2] = "AGGREGATION_TEMPORALITY_CUMULATIVE";
5628
+ })(EAggregationTemporality || (EAggregationTemporality = {}));
5629
+
5380
5630
  // node_modules/@opentelemetry/otlp-transformer/build/esm/metrics/internal.js
5381
5631
  function toResourceMetrics(resourceMetrics, encoder) {
5382
5632
  const processedResource = createResource(resourceMetrics.resource, encoder);
@@ -5388,7 +5638,7 @@
5388
5638
  }
5389
5639
  function toScopeMetrics(scopeMetrics, encoder) {
5390
5640
  return Array.from(scopeMetrics.map((metrics2) => ({
5391
- scope: createInstrumentationScope(metrics2.scope),
5641
+ scope: createInstrumentationScope(metrics2.scope, encoder),
5392
5642
  metrics: metrics2.metrics.map((metricData) => toMetric(metricData, encoder)),
5393
5643
  schemaUrl: metrics2.scope.schemaUrl
5394
5644
  })));
@@ -5503,32 +5753,24 @@
5503
5753
  };
5504
5754
  }
5505
5755
 
5506
- // node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js
5507
- function hrTimeToNanos(hrTime2) {
5508
- const NANOSECONDS = BigInt(1e9);
5509
- return BigInt(Math.trunc(hrTime2[0])) * NANOSECONDS + BigInt(Math.trunc(hrTime2[1]));
5510
- }
5511
- function encodeAsString(hrTime2) {
5512
- const nanos = hrTimeToNanos(hrTime2);
5513
- return nanos.toString();
5514
- }
5515
- var encodeTimestamp = typeof BigInt !== "undefined" ? encodeAsString : hrTimeToNanoseconds;
5516
- function identity(value) {
5517
- return value;
5518
- }
5519
- var JSON_ENCODER = {
5520
- encodeHrTime: encodeTimestamp,
5521
- encodeSpanContext: identity,
5522
- encodeOptionalSpanContext: identity,
5523
- encodeUint8Array: (bytes) => {
5524
- if (typeof Buffer !== "undefined") {
5525
- return Buffer.from(bytes).toString("base64");
5756
+ // node_modules/@opentelemetry/otlp-transformer/build/esm/metrics/json/metrics.js
5757
+ var JsonMetricsSerializer = {
5758
+ serializeRequest: (arg) => {
5759
+ const request = createExportMetricsServiceRequest([arg], JSON_ENCODER);
5760
+ const encoder = new TextEncoder();
5761
+ return encoder.encode(JSON.stringify(request));
5762
+ },
5763
+ deserializeResponse: (arg) => {
5764
+ if (arg.length === 0) {
5765
+ return {};
5526
5766
  }
5527
- const chars = new Array(bytes.length);
5528
- for (let i2 = 0; i2 < bytes.length; i2++) {
5529
- chars[i2] = String.fromCharCode(bytes[i2]);
5767
+ const decoder = new TextDecoder();
5768
+ try {
5769
+ return JSON.parse(decoder.decode(arg));
5770
+ } catch (err) {
5771
+ diag2.warn(`Failed to parse metrics export response: ${err.message}. Returning empty response`);
5772
+ return {};
5530
5773
  }
5531
- return btoa(chars.join(""));
5532
5774
  }
5533
5775
  };
5534
5776
 
@@ -5593,7 +5835,7 @@
5593
5835
  resourceSpans: spanRecordsToResourceSpans(spans, encoder)
5594
5836
  };
5595
5837
  }
5596
- function createResourceMap(readableSpans) {
5838
+ function createResourceMap2(readableSpans) {
5597
5839
  const resourceMap = /* @__PURE__ */ new Map();
5598
5840
  for (const record of readableSpans) {
5599
5841
  let ilsMap = resourceMap.get(record.resource);
@@ -5612,7 +5854,7 @@
5612
5854
  return resourceMap;
5613
5855
  }
5614
5856
  function spanRecordsToResourceSpans(readableSpans, encoder) {
5615
- const resourceMap = createResourceMap(readableSpans);
5857
+ const resourceMap = createResourceMap2(readableSpans);
5616
5858
  const out = [];
5617
5859
  const entryIterator = resourceMap.entries();
5618
5860
  let entry = entryIterator.next();
@@ -5626,7 +5868,7 @@
5626
5868
  if (scopeSpans.length > 0) {
5627
5869
  const spans = scopeSpans.map((readableSpan) => sdkSpanToOtlpSpan(readableSpan, encoder));
5628
5870
  scopeResourceSpans.push({
5629
- scope: createInstrumentationScope(scopeSpans[0].instrumentationScope),
5871
+ scope: createInstrumentationScope(scopeSpans[0].instrumentationScope, encoder),
5630
5872
  spans,
5631
5873
  schemaUrl: scopeSpans[0].instrumentationScope.schemaUrl
5632
5874
  });
@@ -5645,129 +5887,23 @@
5645
5887
  return out;
5646
5888
  }
5647
5889
 
5648
- // node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js
5649
- function createExportLogsServiceRequest(logRecords, encoder) {
5650
- return {
5651
- resourceLogs: logRecordsToResourceLogs(logRecords, encoder)
5652
- };
5653
- }
5654
- function createResourceMap2(logRecords) {
5655
- const resourceMap = /* @__PURE__ */ new Map();
5656
- for (const record of logRecords) {
5657
- const { resource, instrumentationScope: { name, version: version2 = "", schemaUrl = "" } } = record;
5658
- let ismMap = resourceMap.get(resource);
5659
- if (!ismMap) {
5660
- ismMap = /* @__PURE__ */ new Map();
5661
- resourceMap.set(resource, ismMap);
5890
+ // node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js
5891
+ var JsonTraceSerializer = {
5892
+ serializeRequest: (arg) => {
5893
+ const request = createExportTraceServiceRequest(arg, JSON_ENCODER);
5894
+ const encoder = new TextEncoder();
5895
+ return encoder.encode(JSON.stringify(request));
5896
+ },
5897
+ deserializeResponse: (arg) => {
5898
+ if (arg.length === 0) {
5899
+ return {};
5662
5900
  }
5663
- const ismKey = `${name}@${version2}:${schemaUrl}`;
5664
- let records = ismMap.get(ismKey);
5665
- if (!records) {
5666
- records = [];
5667
- ismMap.set(ismKey, records);
5668
- }
5669
- records.push(record);
5670
- }
5671
- return resourceMap;
5672
- }
5673
- function logRecordsToResourceLogs(logRecords, encoder) {
5674
- const resourceMap = createResourceMap2(logRecords);
5675
- return Array.from(resourceMap, ([resource, ismMap]) => {
5676
- const processedResource = createResource(resource, encoder);
5677
- return {
5678
- resource: processedResource,
5679
- scopeLogs: Array.from(ismMap, ([, scopeLogs]) => {
5680
- return {
5681
- scope: createInstrumentationScope(scopeLogs[0].instrumentationScope),
5682
- logRecords: scopeLogs.map((log) => toLogRecord(log, encoder)),
5683
- schemaUrl: scopeLogs[0].instrumentationScope.schemaUrl
5684
- };
5685
- }),
5686
- schemaUrl: processedResource.schemaUrl
5687
- };
5688
- });
5689
- }
5690
- function toLogRecord(log, encoder) {
5691
- return {
5692
- timeUnixNano: encoder.encodeHrTime(log.hrTime),
5693
- observedTimeUnixNano: encoder.encodeHrTime(log.hrTimeObserved),
5694
- severityNumber: toSeverityNumber(log.severityNumber),
5695
- severityText: log.severityText,
5696
- body: toAnyValue(log.body, encoder),
5697
- eventName: log.eventName,
5698
- attributes: toLogAttributes(log.attributes, encoder),
5699
- droppedAttributesCount: log.droppedAttributesCount,
5700
- flags: log.spanContext?.traceFlags,
5701
- traceId: encoder.encodeOptionalSpanContext(log.spanContext?.traceId),
5702
- spanId: encoder.encodeOptionalSpanContext(log.spanContext?.spanId)
5703
- };
5704
- }
5705
- function toSeverityNumber(severityNumber) {
5706
- return severityNumber;
5707
- }
5708
- function toLogAttributes(attributes, encoder) {
5709
- return Object.keys(attributes).map((key) => toKeyValue(key, attributes[key], encoder));
5710
- }
5711
-
5712
- // node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/logs.js
5713
- var JsonLogsSerializer = {
5714
- serializeRequest: (arg) => {
5715
- const request = createExportLogsServiceRequest(arg, JSON_ENCODER);
5716
- const encoder = new TextEncoder();
5717
- return encoder.encode(JSON.stringify(request));
5718
- },
5719
- deserializeResponse: (arg) => {
5720
- if (arg.length === 0) {
5721
- return {};
5722
- }
5723
- const decoder = new TextDecoder();
5724
- try {
5725
- return JSON.parse(decoder.decode(arg));
5726
- } catch (err) {
5727
- diag2.warn(`Failed to parse logs export response: ${err.message}. Returning empty response`);
5728
- return {};
5729
- }
5730
- }
5731
- };
5732
-
5733
- // node_modules/@opentelemetry/otlp-transformer/build/esm/metrics/json/metrics.js
5734
- var JsonMetricsSerializer = {
5735
- serializeRequest: (arg) => {
5736
- const request = createExportMetricsServiceRequest([arg], JSON_ENCODER);
5737
- const encoder = new TextEncoder();
5738
- return encoder.encode(JSON.stringify(request));
5739
- },
5740
- deserializeResponse: (arg) => {
5741
- if (arg.length === 0) {
5742
- return {};
5743
- }
5744
- const decoder = new TextDecoder();
5745
- try {
5746
- return JSON.parse(decoder.decode(arg));
5747
- } catch (err) {
5748
- diag2.warn(`Failed to parse metrics export response: ${err.message}. Returning empty response`);
5749
- return {};
5750
- }
5751
- }
5752
- };
5753
-
5754
- // node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js
5755
- var JsonTraceSerializer = {
5756
- serializeRequest: (arg) => {
5757
- const request = createExportTraceServiceRequest(arg, JSON_ENCODER);
5758
- const encoder = new TextEncoder();
5759
- return encoder.encode(JSON.stringify(request));
5760
- },
5761
- deserializeResponse: (arg) => {
5762
- if (arg.length === 0) {
5763
- return {};
5764
- }
5765
- const decoder = new TextDecoder();
5766
- try {
5767
- return JSON.parse(decoder.decode(arg));
5768
- } catch (err) {
5769
- diag2.warn(`Failed to parse trace export response: ${err.message}. Returning empty response`);
5770
- return {};
5901
+ const decoder = new TextDecoder();
5902
+ try {
5903
+ return JSON.parse(decoder.decode(arg));
5904
+ } catch (err) {
5905
+ diag2.warn(`Failed to parse trace export response: ${err.message}. Returning empty response`);
5906
+ return {};
5771
5907
  }
5772
5908
  }
5773
5909
  };
@@ -6147,16 +6283,104 @@
6147
6283
  }
6148
6284
  visited.add(val);
6149
6285
  if (Array.isArray(val)) {
6150
- return val.every((item) => isLogAttributeValueInternal(item, visited));
6286
+ for (const item of val) {
6287
+ if (!isLogAttributeValueInternal(item, visited)) {
6288
+ return false;
6289
+ }
6290
+ }
6291
+ return true;
6151
6292
  }
6152
6293
  const obj = val;
6153
6294
  if (obj.constructor !== Object && obj.constructor !== void 0) {
6154
6295
  return false;
6155
6296
  }
6156
- return Object.values(obj).every((item) => isLogAttributeValueInternal(item, visited));
6297
+ for (const key in obj) {
6298
+ if (Object.prototype.hasOwnProperty.call(obj, key) && !isLogAttributeValueInternal(obj[key], visited)) {
6299
+ return false;
6300
+ }
6301
+ }
6302
+ return true;
6157
6303
  }
6158
6304
  return false;
6159
6305
  }
6306
+ var AddAttributeDecision;
6307
+ (function(AddAttributeDecision2) {
6308
+ AddAttributeDecision2[AddAttributeDecision2["DROP_INVALID"] = 0] = "DROP_INVALID";
6309
+ AddAttributeDecision2[AddAttributeDecision2["DROP_LIMIT_REACHED"] = 1] = "DROP_LIMIT_REACHED";
6310
+ AddAttributeDecision2[AddAttributeDecision2["ADD_NEW"] = 2] = "ADD_NEW";
6311
+ AddAttributeDecision2[AddAttributeDecision2["ADD_OVERWRITE_EXISTING"] = 3] = "ADD_OVERWRITE_EXISTING";
6312
+ })(AddAttributeDecision || (AddAttributeDecision = {}));
6313
+ function addAttribute(attributes, limits, currentAttributesCount, key, value) {
6314
+ if (key.length === 0) {
6315
+ diag2.warn(`Invalid attribute key: ${key}`);
6316
+ return AddAttributeDecision.DROP_INVALID;
6317
+ }
6318
+ if (!isLogAttributeValue(value)) {
6319
+ diag2.warn(`Invalid attribute value set for key: ${key}`);
6320
+ return AddAttributeDecision.DROP_INVALID;
6321
+ }
6322
+ const isNewKey = !Object.prototype.hasOwnProperty.call(attributes, key);
6323
+ if (isNewKey && currentAttributesCount >= limits.attributeCountLimit) {
6324
+ return AddAttributeDecision.DROP_LIMIT_REACHED;
6325
+ }
6326
+ attributes[key] = truncateToSize(value, limits.attributeValueLengthLimit);
6327
+ if (isNewKey) {
6328
+ return AddAttributeDecision.ADD_NEW;
6329
+ }
6330
+ return AddAttributeDecision.ADD_OVERWRITE_EXISTING;
6331
+ }
6332
+ function truncateToSize(value, limit) {
6333
+ if (limit <= 0) {
6334
+ diag2.warn(`Attribute value limit must be positive, got ${limit}`);
6335
+ return value;
6336
+ }
6337
+ if (value == null) {
6338
+ return value;
6339
+ }
6340
+ if (typeof value === "string") {
6341
+ if (value.length <= limit) {
6342
+ return value;
6343
+ }
6344
+ return value.substring(0, limit);
6345
+ }
6346
+ if (value instanceof Uint8Array) {
6347
+ return value;
6348
+ }
6349
+ if (Array.isArray(value)) {
6350
+ return value.map((val) => truncateToSize(val, limit));
6351
+ }
6352
+ if (typeof value === "object") {
6353
+ const truncatedObj = {};
6354
+ for (const [k2, v2] of Object.entries(value)) {
6355
+ truncatedObj[k2] = truncateToSize(v2, limit);
6356
+ }
6357
+ return truncatedObj;
6358
+ }
6359
+ return value;
6360
+ }
6361
+ function normalizeScopeAttributes(limits, attributes) {
6362
+ if (attributes == null) {
6363
+ return {};
6364
+ }
6365
+ const normalizedAttributes = {};
6366
+ let currentAttributesCount = 0;
6367
+ let droppedAttributesCount = 0;
6368
+ for (const [key, value] of Object.entries(attributes)) {
6369
+ const decision = addAttribute(normalizedAttributes, limits, currentAttributesCount, key, value);
6370
+ if (decision === AddAttributeDecision.ADD_NEW) {
6371
+ currentAttributesCount += 1;
6372
+ } else if (decision === AddAttributeDecision.DROP_INVALID) {
6373
+ droppedAttributesCount += 1;
6374
+ } else if (decision === AddAttributeDecision.DROP_LIMIT_REACHED) {
6375
+ droppedAttributesCount += 1;
6376
+ } else {
6377
+ }
6378
+ }
6379
+ return {
6380
+ attributes: currentAttributesCount > 0 ? normalizedAttributes : void 0,
6381
+ droppedAttributesCount
6382
+ };
6383
+ }
6160
6384
 
6161
6385
  // node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js
6162
6386
  var LogRecordImpl = class {
@@ -6240,24 +6464,13 @@
6240
6464
  if (this._isLogRecordReadonly()) {
6241
6465
  return this;
6242
6466
  }
6243
- if (key.length === 0) {
6244
- diag2.warn(`Invalid attribute key: ${key}`);
6245
- return this;
6246
- }
6247
- if (!isLogAttributeValue(value)) {
6248
- diag2.warn(`Invalid attribute value set for key: ${key}`);
6249
- return this;
6250
- }
6251
- const isNewKey = !Object.prototype.hasOwnProperty.call(this.attributes, key);
6252
- if (isNewKey && this._attributesCount >= this._logRecordLimits.attributeCountLimit) {
6467
+ const decision = addAttribute(this.attributes, this._logRecordLimits, this._attributesCount, key, value);
6468
+ if (decision === AddAttributeDecision.DROP_LIMIT_REACHED) {
6253
6469
  this._droppedAttributesCount++;
6254
6470
  if (this._droppedAttributesCount === 1) {
6255
6471
  diag2.warn("Dropping extra attributes.");
6256
6472
  }
6257
- return this;
6258
- }
6259
- this.attributes[key] = this._truncateToSize(value);
6260
- if (isNewKey) {
6473
+ } else if (decision === AddAttributeDecision.ADD_NEW) {
6261
6474
  this._attributesCount++;
6262
6475
  }
6263
6476
  return this;
@@ -6292,33 +6505,6 @@
6292
6505
  _makeReadonly() {
6293
6506
  this._isReadonly = true;
6294
6507
  }
6295
- _truncateToSize(value) {
6296
- const limit = this._logRecordLimits.attributeValueLengthLimit;
6297
- if (limit <= 0) {
6298
- diag2.warn(`Attribute value limit must be positive, got ${limit}`);
6299
- return value;
6300
- }
6301
- if (value == null) {
6302
- return value;
6303
- }
6304
- if (typeof value === "string") {
6305
- return this._truncateToLimitUtil(value, limit);
6306
- }
6307
- if (value instanceof Uint8Array) {
6308
- return value;
6309
- }
6310
- if (Array.isArray(value)) {
6311
- return value.map((val) => this._truncateToSize(val));
6312
- }
6313
- if (typeof value === "object") {
6314
- const truncatedObj = {};
6315
- for (const [k2, v2] of Object.entries(value)) {
6316
- truncatedObj[k2] = this._truncateToSize(v2);
6317
- }
6318
- return truncatedObj;
6319
- }
6320
- return value;
6321
- }
6322
6508
  _setException(exception) {
6323
6509
  let hasMinimumAttributes = false;
6324
6510
  if (typeof exception === "string" || typeof exception === "number") {
@@ -6356,12 +6542,6 @@
6356
6542
  diag2.warn(`Failed to record an exception ${exception}`);
6357
6543
  }
6358
6544
  }
6359
- _truncateToLimitUtil(value, limit) {
6360
- if (value.length <= limit) {
6361
- return value;
6362
- }
6363
- return value.substring(0, limit);
6364
- }
6365
6545
  _isLogRecordReadonly() {
6366
6546
  if (this._isReadonly) {
6367
6547
  diag2.warn("Can not execute the operation on emitted log record");
@@ -6372,31 +6552,20 @@
6372
6552
 
6373
6553
  // node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js
6374
6554
  var Logger = class {
6375
- instrumentationScope;
6555
+ _instrumentationScope;
6376
6556
  _sharedState;
6377
6557
  _loggerConfig;
6378
6558
  constructor(instrumentationScope, sharedState) {
6379
- this.instrumentationScope = instrumentationScope;
6559
+ this._instrumentationScope = instrumentationScope;
6380
6560
  this._sharedState = sharedState;
6381
- this._loggerConfig = this._sharedState.getLoggerConfig(this.instrumentationScope);
6561
+ this._loggerConfig = this._sharedState.getLoggerConfig(this._instrumentationScope);
6382
6562
  }
6383
6563
  emit(logRecord) {
6384
- const loggerConfig = this._loggerConfig;
6385
6564
  const currentContext = logRecord.context || context.active();
6386
- const recordSeverity = logRecord.severityNumber ?? SeverityNumber.UNSPECIFIED;
6387
- if (recordSeverity !== SeverityNumber.UNSPECIFIED && recordSeverity < loggerConfig.minimumSeverity) {
6565
+ if (!this.enabled(logRecord)) {
6388
6566
  return;
6389
6567
  }
6390
- if (loggerConfig.traceBased) {
6391
- const spanContext = trace.getSpanContext(currentContext);
6392
- if (spanContext && isSpanContextValid(spanContext)) {
6393
- const isSampled = (spanContext.traceFlags & TraceFlags.SAMPLED) === TraceFlags.SAMPLED;
6394
- if (!isSampled) {
6395
- return;
6396
- }
6397
- }
6398
- }
6399
- const logRecordInstance = new LogRecordImpl(this._sharedState, this.instrumentationScope, {
6568
+ const logRecordInstance = new LogRecordImpl(this._sharedState, this._instrumentationScope, {
6400
6569
  context: currentContext,
6401
6570
  ...logRecord
6402
6571
  });
@@ -6425,7 +6594,7 @@
6425
6594
  }
6426
6595
  const enabledOpts = {
6427
6596
  context: currentContext,
6428
- instrumentationScope: this.instrumentationScope,
6597
+ instrumentationScope: this._instrumentationScope,
6429
6598
  severityNumber: options?.severityNumber,
6430
6599
  eventName: options?.eventName
6431
6600
  };
@@ -6482,8 +6651,53 @@
6482
6651
  };
6483
6652
 
6484
6653
  // node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js
6654
+ function normalizeAnyValue(value) {
6655
+ if (value === void 0) {
6656
+ return ["u", null];
6657
+ }
6658
+ if (value === null) {
6659
+ return ["n", null];
6660
+ }
6661
+ const valueType = typeof value;
6662
+ if (valueType === "string") {
6663
+ return ["s", value];
6664
+ }
6665
+ if (valueType === "boolean") {
6666
+ return ["b", value];
6667
+ }
6668
+ if (valueType === "number") {
6669
+ if (Number.isNaN(value))
6670
+ return ["nan", null];
6671
+ if (value === Infinity)
6672
+ return ["inf", null];
6673
+ if (value === -Infinity)
6674
+ return ["-inf", null];
6675
+ if (Object.is(value, -0))
6676
+ return ["n0", null];
6677
+ return ["d", value];
6678
+ }
6679
+ if (value instanceof Uint8Array) {
6680
+ return ["bytes", Array.from(value)];
6681
+ }
6682
+ if (Array.isArray(value)) {
6683
+ return ["arr", value.map(normalizeAnyValue)];
6684
+ }
6685
+ return [
6686
+ "map",
6687
+ Object.entries(value).sort(([a2], [b2]) => a2.localeCompare(b2)).map(([k2, v2]) => [k2, normalizeAnyValue(v2)])
6688
+ ];
6689
+ }
6485
6690
  function getInstrumentationScopeKey(scope) {
6486
- return `${scope.name}@${scope.version || ""}:${scope.schemaUrl || ""}`;
6691
+ return JSON.stringify([
6692
+ scope.name,
6693
+ scope.version || "",
6694
+ scope.schemaUrl || "",
6695
+ normalizeAnyValue(scope.attributes),
6696
+ // we include the dropped attributes count to avoid collisions between scopes with the same identifying
6697
+ // characteristics, but different dropped counts. While there still can be collisions this is the best we can do if
6698
+ // we want to resolve the same logger without relying on object identity.
6699
+ scope.droppedAttributesCount ?? 0
6700
+ ]);
6487
6701
  }
6488
6702
 
6489
6703
  // node_modules/@opentelemetry/sdk-logs/build/esm/semconv.js
@@ -6504,7 +6718,7 @@
6504
6718
  };
6505
6719
 
6506
6720
  // node_modules/@opentelemetry/sdk-logs/build/esm/version.js
6507
- var VERSION4 = "0.215.0";
6721
+ var VERSION5 = "0.219.0";
6508
6722
 
6509
6723
  // node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js
6510
6724
  var DEFAULT_LOGGER_CONFIG = {
@@ -6538,7 +6752,7 @@
6538
6752
  this.activeProcessor = new NoopLogRecordProcessor();
6539
6753
  }
6540
6754
  this._loggerConfigurator = loggerConfigurator ?? DEFAULT_LOGGER_CONFIGURATOR;
6541
- const meter = meterProvider ? meterProvider.getMeter("@opentelemetry/sdk-logs", VERSION4) : createNoopMeter();
6755
+ const meter = meterProvider ? meterProvider.getMeter("@opentelemetry/sdk-logs", VERSION5) : createNoopMeter();
6542
6756
  this.loggerMetrics = new LoggerMetrics(meter);
6543
6757
  }
6544
6758
  /**
@@ -6586,15 +6800,21 @@
6586
6800
  getLogger(name, version2, options) {
6587
6801
  if (this._shutdownOnce.isCalled) {
6588
6802
  diag2.warn("A shutdown LoggerProvider cannot provide a Logger");
6589
- return NOOP_LOGGER;
6803
+ return createNoopLogger();
6590
6804
  }
6591
6805
  if (!name) {
6592
6806
  diag2.warn("Logger requested without instrumentation scope name.");
6593
6807
  }
6594
6808
  const loggerName = name || DEFAULT_LOGGER_NAME;
6595
- const key = `${loggerName}@${version2 || ""}:${options?.schemaUrl || ""}`;
6809
+ const instrumentationScope = {
6810
+ name: loggerName,
6811
+ version: version2,
6812
+ schemaUrl: options?.schemaUrl,
6813
+ ...normalizeScopeAttributes(this._sharedState.logRecordLimits, options?.attributes)
6814
+ };
6815
+ const key = getInstrumentationScopeKey(instrumentationScope);
6596
6816
  if (!this._sharedState.loggers.has(key)) {
6597
- this._sharedState.loggers.set(key, new Logger({ name: loggerName, version: version2, schemaUrl: options?.schemaUrl }, this._sharedState));
6817
+ this._sharedState.loggers.set(key, new Logger(instrumentationScope, this._sharedState));
6598
6818
  }
6599
6819
  return this._sharedState.loggers.get(key);
6600
6820
  }
@@ -6751,9 +6971,10 @@
6751
6971
  let toFlush = this._finishedLogRecords;
6752
6972
  this._finishedLogRecords = [];
6753
6973
  this._clearTimer();
6754
- if (this._currentExport !== null) {
6974
+ const inFlight = this._currentExport;
6975
+ if (inFlight !== null) {
6755
6976
  await this._exporter.forceFlush();
6756
- await this._currentExport.exportCompleted;
6977
+ await inFlight.exportCompleted;
6757
6978
  this._currentExport = null;
6758
6979
  }
6759
6980
  while (toFlush.length > 0) {
@@ -6887,6 +7108,35 @@
6887
7108
  // node_modules/@opentelemetry/sdk-trace-base/build/esm/enums.js
6888
7109
  var ExceptionEventName = "exception";
6889
7110
 
7111
+ // node_modules/@opentelemetry/sdk-trace-base/build/esm/inspect.js
7112
+ var inspectCustom = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
7113
+ function settledResourceAttributes(resource) {
7114
+ const attrs = {};
7115
+ for (const [k2, v2] of resource.getRawAttributes()) {
7116
+ if (typeof v2?.then === "function") {
7117
+ continue;
7118
+ }
7119
+ if (v2 != null) {
7120
+ attrs[k2] ??= v2;
7121
+ }
7122
+ }
7123
+ return attrs;
7124
+ }
7125
+ function formatInspect(className, payload, depth, options, inspect) {
7126
+ if (typeof depth === "number" && depth < 0) {
7127
+ const tag = `[${className}]`;
7128
+ return options?.stylize ? options.stylize(tag, "special") : tag;
7129
+ }
7130
+ if (typeof inspect !== "function" || !options) {
7131
+ return payload;
7132
+ }
7133
+ const childOptions = {
7134
+ ...options,
7135
+ depth: options.depth == null ? options.depth : options.depth - 1
7136
+ };
7137
+ return `${className} ${inspect(payload, childOptions)}`;
7138
+ }
7139
+
6890
7140
  // node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js
6891
7141
  var SpanImpl = class {
6892
7142
  // Below properties are included to implement ReadableSpan for export
@@ -7234,6 +7484,28 @@
7234
7484
  }
7235
7485
  return value;
7236
7486
  }
7487
+ [inspectCustom](depth, options, inspect) {
7488
+ const payload = {
7489
+ name: this.name,
7490
+ kind: this.kind,
7491
+ spanContext: this._spanContext,
7492
+ parentSpanContext: this.parentSpanContext,
7493
+ status: this.status,
7494
+ startTime: this.startTime,
7495
+ endTime: this.endTime,
7496
+ duration: this._duration,
7497
+ ended: this._ended,
7498
+ attributes: this.attributes,
7499
+ events: this.events,
7500
+ links: this.links,
7501
+ droppedAttributesCount: this._droppedAttributesCount,
7502
+ droppedEventsCount: this._droppedEventsCount,
7503
+ droppedLinksCount: this._droppedLinksCount,
7504
+ instrumentationScope: this.instrumentationScope,
7505
+ resource: { attributes: settledResourceAttributes(this.resource) }
7506
+ };
7507
+ return formatInspect("SpanImpl", payload, depth, options, inspect);
7508
+ }
7237
7509
  };
7238
7510
 
7239
7511
  // node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js
@@ -7330,9 +7602,13 @@
7330
7602
  }
7331
7603
  _accumulate(traceId) {
7332
7604
  let accumulation = 0;
7333
- for (let i2 = 0; i2 < traceId.length / 8; i2++) {
7334
- const pos = i2 * 8;
7335
- const part = parseInt(traceId.slice(pos, pos + 8), 16);
7605
+ for (let i2 = 0; i2 < 32; i2 += 8) {
7606
+ let part = 0;
7607
+ for (let j2 = 0; j2 < 8; j2++) {
7608
+ const c2 = traceId.charCodeAt(i2 + j2);
7609
+ const v2 = c2 < 58 ? c2 - 48 : c2 < 71 ? c2 - 55 : c2 - 87;
7610
+ part = part << 4 | v2;
7611
+ }
7336
7612
  accumulation = (accumulation ^ part) >>> 0;
7337
7613
  }
7338
7614
  return accumulation;
@@ -7734,7 +8010,7 @@
7734
8010
  }
7735
8011
 
7736
8012
  // node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js
7737
- var VERSION5 = "2.7.0";
8013
+ var VERSION6 = "2.8.0";
7738
8014
 
7739
8015
  // node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js
7740
8016
  var Tracer = class {
@@ -7758,7 +8034,7 @@
7758
8034
  this._resource = resource;
7759
8035
  this._spanProcessor = spanProcessor;
7760
8036
  this.instrumentationScope = instrumentationScope;
7761
- const meter = localConfig.meterProvider ? localConfig.meterProvider.getMeter("@opentelemetry/sdk-trace", VERSION5) : createNoopMeter();
8037
+ const meter = localConfig.meterProvider ? localConfig.meterProvider.getMeter("@opentelemetry/sdk-trace", VERSION6) : createNoopMeter();
7762
8038
  this._tracerMetrics = new TracerMetrics(meter);
7763
8039
  }
7764
8040
  /**
@@ -7852,6 +8128,15 @@
7852
8128
  getSpanLimits() {
7853
8129
  return this._spanLimits;
7854
8130
  }
8131
+ [inspectCustom](depth, options, inspect) {
8132
+ const payload = {
8133
+ instrumentationScope: this.instrumentationScope,
8134
+ resource: { attributes: settledResourceAttributes(this._resource) },
8135
+ spanLimits: this._spanLimits,
8136
+ generalLimits: this._generalLimits
8137
+ };
8138
+ return formatInspect("Tracer", payload, depth, options, inspect);
8139
+ }
7855
8140
  };
7856
8141
 
7857
8142
  // node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js
@@ -7972,6 +8257,15 @@
7972
8257
  shutdown() {
7973
8258
  return this._activeSpanProcessor.shutdown();
7974
8259
  }
8260
+ [inspectCustom](depth, options, inspect) {
8261
+ const processors = this._activeSpanProcessor["_spanProcessors"];
8262
+ const payload = {
8263
+ resource: { attributes: settledResourceAttributes(this._resource) },
8264
+ tracers: Array.from(this._tracers.keys()),
8265
+ spanProcessors: processors.map((p2) => p2.constructor?.name ?? "SpanProcessor")
8266
+ };
8267
+ return formatInspect("BasicTracerProvider", payload, depth, options, inspect);
8268
+ }
7975
8269
  };
7976
8270
 
7977
8271
  // node_modules/@opentelemetry/sdk-trace-web/build/esm/StackContextManager.js
@@ -8314,7 +8608,7 @@
8314
8608
  function getNodeValue(target, optimised) {
8315
8609
  const nodeType = target.nodeType;
8316
8610
  const index = getNodeIndex(target);
8317
- let nodeValue = "";
8611
+ let nodeValue;
8318
8612
  if (nodeType === Node.ELEMENT_NODE) {
8319
8613
  const id = target.getAttribute("id");
8320
8614
  if (optimised && id) {
@@ -8594,7 +8888,7 @@
8594
8888
  try {
8595
8889
  hookHandler(span, info);
8596
8890
  } catch (e2) {
8597
- this._diag.error(`Error running span customization hook due to exception in handler`, { triggerName }, e2);
8891
+ this._diag.error("Error running span customization hook due to exception in handler", { triggerName }, e2);
8598
8892
  }
8599
8893
  }
8600
8894
  };
@@ -8625,9 +8919,6 @@
8625
8919
  return result;
8626
8920
  }
8627
8921
  }
8628
- function isWrapped(func) {
8629
- return typeof func === "function" && typeof func.__original === "function" && typeof func.__unwrap === "function" && func.__wrapped === true;
8630
- }
8631
8922
 
8632
8923
  // node_modules/@opentelemetry/instrumentation/build/esm/semconvStability.js
8633
8924
  var SemconvStability;
@@ -8650,53 +8941,331 @@
8650
8941
  return semconvStability;
8651
8942
  }
8652
8943
 
8653
- // node_modules/@opentelemetry/instrumentation-document-load/build/esm/enums/AttributeNames.js
8654
- var AttributeNames;
8655
- (function(AttributeNames5) {
8656
- AttributeNames5["DOCUMENT_LOAD"] = "documentLoad";
8657
- AttributeNames5["DOCUMENT_FETCH"] = "documentFetch";
8658
- AttributeNames5["RESOURCE_FETCH"] = "resourceFetch";
8659
- })(AttributeNames || (AttributeNames = {}));
8660
-
8661
- // node_modules/@opentelemetry/instrumentation-document-load/build/esm/version.js
8662
- var PACKAGE_VERSION = "0.60.0";
8663
- var PACKAGE_NAME = "@opentelemetry/instrumentation-document-load";
8664
-
8665
- // node_modules/@opentelemetry/instrumentation-document-load/build/esm/semconv.js
8666
- var ATTR_HTTP_URL = "http.url";
8667
- var ATTR_HTTP_USER_AGENT = "http.user_agent";
8668
-
8669
- // node_modules/@opentelemetry/instrumentation-document-load/build/esm/enums/EventNames.js
8670
- var EventNames;
8671
- (function(EventNames3) {
8672
- EventNames3["FIRST_PAINT"] = "firstPaint";
8673
- EventNames3["FIRST_CONTENTFUL_PAINT"] = "firstContentfulPaint";
8674
- })(EventNames || (EventNames = {}));
8944
+ // node_modules/@opentelemetry/instrumentation-browser-navigation/build/esm/version.js
8945
+ var PACKAGE_VERSION = "0.12.0";
8946
+ var PACKAGE_NAME = "@opentelemetry/instrumentation-browser-navigation";
8675
8947
 
8676
- // node_modules/@opentelemetry/instrumentation-document-load/build/esm/utils.js
8677
- var getPerformanceNavigationEntries = () => {
8678
- const entries = {};
8679
- const performanceNavigationTiming = otperformance.getEntriesByType?.("navigation")[0];
8680
- if (performanceNavigationTiming) {
8681
- const keys = Object.values(PerformanceTimingNames);
8682
- keys.forEach((key) => {
8683
- if (hasKey(performanceNavigationTiming, key)) {
8684
- const value = performanceNavigationTiming[key];
8685
- if (typeof value === "number") {
8686
- entries[key] = value;
8687
- }
8688
- }
8689
- });
8690
- } else {
8691
- const perf = otperformance;
8692
- const performanceTiming = perf.timing;
8693
- if (performanceTiming) {
8694
- const keys = Object.values(PerformanceTimingNames);
8695
- keys.forEach((key) => {
8696
- if (hasKey(performanceTiming, key)) {
8697
- const value = performanceTiming[key];
8698
- if (typeof value === "number") {
8699
- entries[key] = value;
8948
+ // node_modules/@opentelemetry/instrumentation-browser-navigation/build/esm/utils.js
8949
+ function isHashChange(fromUrl, toUrl) {
8950
+ try {
8951
+ const a2 = new URL(fromUrl, window.location.origin);
8952
+ const b2 = new URL(toUrl, window.location.origin);
8953
+ const sameBase = a2.origin === b2.origin && a2.pathname === b2.pathname && a2.search === b2.search;
8954
+ const fromHasHash = a2.hash !== "";
8955
+ const toHasHash = b2.hash !== "";
8956
+ const hashesAreDifferent = a2.hash !== b2.hash;
8957
+ return sameBase && hashesAreDifferent && (fromHasHash && toHasHash || !fromHasHash && toHasHash);
8958
+ } catch {
8959
+ const fromBase = fromUrl.split("#")[0];
8960
+ const toBase = toUrl.split("#")[0];
8961
+ const fromHash = fromUrl.split("#")[1] || "";
8962
+ const toHash = toUrl.split("#")[1] || "";
8963
+ const sameBase = fromBase === toBase;
8964
+ const hashesAreDifferent = fromHash !== toHash;
8965
+ const notRemovingHash = toHash !== "";
8966
+ return sameBase && hashesAreDifferent && notRemovingHash;
8967
+ }
8968
+ }
8969
+
8970
+ // node_modules/@opentelemetry/instrumentation-browser-navigation/build/esm/instrumentation.js
8971
+ var EVENT_NAME = "browser.navigation";
8972
+ var ATTR_BROWSER_NAVIGATION_SAME_DOCUMENT = "browser.navigation.same_document";
8973
+ var ATTR_BROWSER_NAVIGATION_HASH_CHANGE = "browser.navigation.hash_change";
8974
+ var ATTR_BROWSER_NAVIGATION_TYPE = "browser.navigation.type";
8975
+ var BrowserNavigationInstrumentation = class extends InstrumentationBase {
8976
+ applyCustomLogRecordData = void 0;
8977
+ _lastUrl = location.href;
8978
+ _hasProcessedInitialLoad = false;
8979
+ /**
8980
+ *
8981
+ * @param config
8982
+ */
8983
+ constructor(config) {
8984
+ super(PACKAGE_NAME, PACKAGE_VERSION, config);
8985
+ this.applyCustomLogRecordData = config?.applyCustomLogRecordData;
8986
+ this.sanitizeUrl = config?.sanitizeUrl;
8987
+ }
8988
+ init() {
8989
+ }
8990
+ /**
8991
+ * callback to be executed when using hard navigation
8992
+ */
8993
+ _onHardNavigation() {
8994
+ const navLogRecord = {
8995
+ eventName: EVENT_NAME,
8996
+ attributes: {
8997
+ [ATTR_URL_FULL]: this.sanitizeUrl ? this.sanitizeUrl(document.documentURI) : document.documentURI,
8998
+ [ATTR_BROWSER_NAVIGATION_SAME_DOCUMENT]: false,
8999
+ [ATTR_BROWSER_NAVIGATION_HASH_CHANGE]: false
9000
+ }
9001
+ };
9002
+ this._applyCustomLogRecordData(navLogRecord, this.applyCustomLogRecordData);
9003
+ this.logger.emit(navLogRecord);
9004
+ }
9005
+ /**
9006
+ * callback to be executed when using soft navigation
9007
+ */
9008
+ _onSoftNavigation(changeState, navigationEvent) {
9009
+ const referrerUrl = this._lastUrl;
9010
+ const currentUrl = changeState === "currententrychange" && navigationEvent?.target?.currentEntry?.url ? navigationEvent.target.currentEntry.url : location.href;
9011
+ if (referrerUrl === currentUrl) {
9012
+ return;
9013
+ }
9014
+ const navType = this._mapChangeStateToType(changeState, navigationEvent);
9015
+ const sameDocument = this._determineSameDocument(changeState, navigationEvent, referrerUrl, currentUrl);
9016
+ const hashChange = this._determineHashChange(changeState, navigationEvent, referrerUrl, currentUrl);
9017
+ const navLogRecord = {
9018
+ eventName: EVENT_NAME,
9019
+ attributes: {
9020
+ [ATTR_URL_FULL]: this.sanitizeUrl ? this.sanitizeUrl(currentUrl) : currentUrl,
9021
+ [ATTR_BROWSER_NAVIGATION_SAME_DOCUMENT]: sameDocument,
9022
+ [ATTR_BROWSER_NAVIGATION_HASH_CHANGE]: hashChange,
9023
+ ...navType ? { [ATTR_BROWSER_NAVIGATION_TYPE]: navType } : {}
9024
+ }
9025
+ };
9026
+ this._applyCustomLogRecordData(navLogRecord, this.applyCustomLogRecordData);
9027
+ this.logger.emit(navLogRecord);
9028
+ this._lastUrl = currentUrl;
9029
+ }
9030
+ /**
9031
+ * executes callback {_onDOMContentLoaded } when the page is viewed
9032
+ */
9033
+ _waitForPageLoad() {
9034
+ if (document.readyState === "complete" && !this._hasProcessedInitialLoad) {
9035
+ this._hasProcessedInitialLoad = true;
9036
+ this._onHardNavigation();
9037
+ return;
9038
+ }
9039
+ if (this._onLoadHandler) {
9040
+ document.removeEventListener("DOMContentLoaded", this._onLoadHandler);
9041
+ }
9042
+ this._onLoadHandler = () => {
9043
+ if (!this._hasProcessedInitialLoad) {
9044
+ this._hasProcessedInitialLoad = true;
9045
+ this._onHardNavigation();
9046
+ }
9047
+ };
9048
+ document.addEventListener("DOMContentLoaded", this._onLoadHandler);
9049
+ }
9050
+ /**
9051
+ * implements enable function
9052
+ */
9053
+ enable() {
9054
+ if (this._isEnabled) {
9055
+ return;
9056
+ }
9057
+ this._isEnabled = true;
9058
+ const cfg = this.getConfig();
9059
+ const useNavigationApiIfAvailable = !!cfg.useNavigationApiIfAvailable;
9060
+ const navigationApi = useNavigationApiIfAvailable && window.navigation;
9061
+ if (!navigationApi && !this._isHistoryPatched) {
9062
+ this._patchHistoryApi();
9063
+ this._isHistoryPatched = true;
9064
+ }
9065
+ this._waitForPageLoad();
9066
+ if (navigationApi) {
9067
+ if (this._onNavigateHandler) {
9068
+ navigationApi.removeEventListener("currententrychange", this._onNavigateHandler);
9069
+ this._onNavigateHandler = void 0;
9070
+ }
9071
+ this._onNavigateHandler = (event) => {
9072
+ this._onSoftNavigation("currententrychange", event);
9073
+ };
9074
+ navigationApi.addEventListener("currententrychange", this._onNavigateHandler);
9075
+ } else {
9076
+ if (this._onPopStateHandler) {
9077
+ window.removeEventListener("popstate", this._onPopStateHandler);
9078
+ this._onPopStateHandler = void 0;
9079
+ }
9080
+ this._onPopStateHandler = () => {
9081
+ this._onSoftNavigation("popstate");
9082
+ };
9083
+ window.addEventListener("popstate", this._onPopStateHandler);
9084
+ }
9085
+ }
9086
+ /**
9087
+ * implements disable function
9088
+ */
9089
+ disable() {
9090
+ if (!this._isEnabled) {
9091
+ return;
9092
+ }
9093
+ this._isEnabled = false;
9094
+ if (this._onLoadHandler) {
9095
+ document.removeEventListener("DOMContentLoaded", this._onLoadHandler);
9096
+ this._onLoadHandler = void 0;
9097
+ }
9098
+ if (this._onPopStateHandler) {
9099
+ window.removeEventListener("popstate", this._onPopStateHandler);
9100
+ this._onPopStateHandler = void 0;
9101
+ }
9102
+ if (this._onNavigateHandler) {
9103
+ try {
9104
+ const navigationApi = window.navigation;
9105
+ navigationApi?.removeEventListener?.("currententrychange", this._onNavigateHandler);
9106
+ } catch {
9107
+ }
9108
+ this._onNavigateHandler = void 0;
9109
+ }
9110
+ this._hasProcessedInitialLoad = false;
9111
+ }
9112
+ /**
9113
+ * Patches the history api method
9114
+ */
9115
+ _patchHistoryMethod(changeState) {
9116
+ const plugin = this;
9117
+ return (original) => {
9118
+ return function patchHistoryMethod(...args) {
9119
+ if (!plugin._isEnabled) {
9120
+ return original.apply(this, args);
9121
+ }
9122
+ const result = original.apply(this, args);
9123
+ const currentUrl = location.href;
9124
+ if (currentUrl !== plugin._lastUrl) {
9125
+ plugin._onSoftNavigation(changeState);
9126
+ }
9127
+ return result;
9128
+ };
9129
+ };
9130
+ }
9131
+ _patchHistoryApi() {
9132
+ this._wrap(history, "replaceState", this._patchHistoryMethod("replaceState"));
9133
+ this._wrap(history, "pushState", this._patchHistoryMethod("pushState"));
9134
+ }
9135
+ /**
9136
+ *
9137
+ * @param logRecord
9138
+ * @param applyCustomLogRecordData
9139
+ * Add custom data to the event
9140
+ */
9141
+ _applyCustomLogRecordData(logRecord, applyCustomLogRecordData) {
9142
+ if (applyCustomLogRecordData) {
9143
+ applyCustomLogRecordData(logRecord);
9144
+ }
9145
+ }
9146
+ _determineSameDocument(changeState, navigationEvent, fromUrl, toUrl) {
9147
+ if (changeState === "currententrychange") {
9148
+ if (fromUrl && toUrl) {
9149
+ try {
9150
+ const fromURL = new URL(fromUrl);
9151
+ const toURL = new URL(toUrl);
9152
+ return fromURL.origin === toURL.origin;
9153
+ } catch {
9154
+ return true;
9155
+ }
9156
+ }
9157
+ return true;
9158
+ }
9159
+ if (fromUrl && toUrl) {
9160
+ try {
9161
+ const fromURL = new URL(fromUrl);
9162
+ const toURL = new URL(toUrl);
9163
+ return fromURL.origin === toURL.origin;
9164
+ } catch {
9165
+ return true;
9166
+ }
9167
+ }
9168
+ return true;
9169
+ }
9170
+ /**
9171
+ * Determines if navigation is a hash change based on URL comparison
9172
+ * A hash change is true if the URLs are the same except for the hash part
9173
+ */
9174
+ _determineHashChange(changeState, navigationEvent, fromUrl, toUrl) {
9175
+ if (changeState === "currententrychange") {
9176
+ if (fromUrl && toUrl) {
9177
+ return isHashChange(fromUrl, toUrl);
9178
+ }
9179
+ return false;
9180
+ }
9181
+ if (fromUrl && toUrl) {
9182
+ return isHashChange(fromUrl, toUrl);
9183
+ }
9184
+ return false;
9185
+ }
9186
+ _mapChangeStateToType(changeState, navigationEvent) {
9187
+ if (changeState === "currententrychange") {
9188
+ if (navigationEvent?.navigationType) {
9189
+ const navType = navigationEvent.navigationType;
9190
+ switch (navType) {
9191
+ case "traverse":
9192
+ return "traverse";
9193
+ case "replace":
9194
+ return "replace";
9195
+ case "reload":
9196
+ return "reload";
9197
+ case "push":
9198
+ default:
9199
+ return "push";
9200
+ }
9201
+ }
9202
+ return "push";
9203
+ }
9204
+ switch (changeState) {
9205
+ case "pushState":
9206
+ return "push";
9207
+ case "replaceState":
9208
+ return "replace";
9209
+ case "popstate":
9210
+ return "traverse";
9211
+ // Default to traverse, but hash changes will be handled specially
9212
+ case "hashchange":
9213
+ return "push";
9214
+ case "navigate":
9215
+ return "push";
9216
+ default:
9217
+ return void 0;
9218
+ }
9219
+ }
9220
+ };
9221
+
9222
+ // node_modules/@opentelemetry/instrumentation-document-load/build/esm/enums/AttributeNames.js
9223
+ var AttributeNames;
9224
+ (function(AttributeNames5) {
9225
+ AttributeNames5["DOCUMENT_LOAD"] = "documentLoad";
9226
+ AttributeNames5["DOCUMENT_FETCH"] = "documentFetch";
9227
+ AttributeNames5["RESOURCE_FETCH"] = "resourceFetch";
9228
+ })(AttributeNames || (AttributeNames = {}));
9229
+
9230
+ // node_modules/@opentelemetry/instrumentation-document-load/build/esm/version.js
9231
+ var PACKAGE_VERSION2 = "0.64.0";
9232
+ var PACKAGE_NAME2 = "@opentelemetry/instrumentation-document-load";
9233
+
9234
+ // node_modules/@opentelemetry/instrumentation-document-load/build/esm/semconv.js
9235
+ var ATTR_HTTP_URL = "http.url";
9236
+ var ATTR_HTTP_USER_AGENT = "http.user_agent";
9237
+
9238
+ // node_modules/@opentelemetry/instrumentation-document-load/build/esm/enums/EventNames.js
9239
+ var EventNames;
9240
+ (function(EventNames3) {
9241
+ EventNames3["FIRST_PAINT"] = "firstPaint";
9242
+ EventNames3["FIRST_CONTENTFUL_PAINT"] = "firstContentfulPaint";
9243
+ })(EventNames || (EventNames = {}));
9244
+
9245
+ // node_modules/@opentelemetry/instrumentation-document-load/build/esm/utils.js
9246
+ var getPerformanceNavigationEntries = () => {
9247
+ const entries = {};
9248
+ const performanceNavigationTiming = otperformance.getEntriesByType?.("navigation")[0];
9249
+ if (performanceNavigationTiming) {
9250
+ const keys = Object.values(PerformanceTimingNames);
9251
+ keys.forEach((key) => {
9252
+ if (hasKey(performanceNavigationTiming, key)) {
9253
+ const value = performanceNavigationTiming[key];
9254
+ if (typeof value === "number") {
9255
+ entries[key] = value;
9256
+ }
9257
+ }
9258
+ });
9259
+ } else {
9260
+ const perf = otperformance;
9261
+ const performanceTiming = perf.timing;
9262
+ if (performanceTiming) {
9263
+ const keys = Object.values(PerformanceTimingNames);
9264
+ keys.forEach((key) => {
9265
+ if (hasKey(performanceTiming, key)) {
9266
+ const value = performanceTiming[key];
9267
+ if (typeof value === "number") {
9268
+ entries[key] = value;
8700
9269
  }
8701
9270
  }
8702
9271
  });
@@ -8726,7 +9295,7 @@
8726
9295
  moduleName = this.component;
8727
9296
  _semconvStability;
8728
9297
  constructor(config = {}) {
8729
- super(PACKAGE_NAME, PACKAGE_VERSION, config);
9298
+ super(PACKAGE_NAME2, PACKAGE_VERSION2, config);
8730
9299
  this._semconvStability = semconvStabilityFromStr("http", config?.semconvStabilityOptIn);
8731
9300
  }
8732
9301
  init() {
@@ -9074,20 +9643,20 @@
9074
9643
  }
9075
9644
 
9076
9645
  // node_modules/@opentelemetry/instrumentation-fetch/build/esm/version.js
9077
- var VERSION6 = "0.215.0";
9646
+ var VERSION7 = "0.219.0";
9078
9647
 
9079
9648
  // node_modules/@opentelemetry/instrumentation-fetch/build/esm/fetch.js
9080
9649
  var OBSERVER_WAIT_TIME_MS = 300;
9081
9650
  var hasBrowserPerformanceAPI = typeof PerformanceObserver !== "undefined";
9082
9651
  var FetchInstrumentation = class extends InstrumentationBase {
9083
9652
  component = "fetch";
9084
- version = VERSION6;
9653
+ version = VERSION7;
9085
9654
  moduleName = this.component;
9086
9655
  _usedResources = /* @__PURE__ */ new WeakSet();
9087
9656
  _tasksCount = 0;
9088
9657
  _semconvStability;
9089
9658
  constructor(config = {}) {
9090
- super("@opentelemetry/instrumentation-fetch", VERSION6, config);
9659
+ super("@opentelemetry/instrumentation-fetch", VERSION7, config);
9091
9660
  this._semconvStability = semconvStabilityFromStr("http", config?.semconvStabilityOptIn);
9092
9661
  }
9093
9662
  init() {
@@ -9431,13 +10000,18 @@
9431
10000
  if (this._isEnabled) {
9432
10001
  return;
9433
10002
  }
9434
- this._isEnabled = true;
9435
10003
  if (this._isFetchPatched) {
9436
10004
  this._diag.debug("fetch constructor already patched");
10005
+ this._isEnabled = true;
9437
10006
  return;
9438
10007
  }
9439
- this._isFetchPatched = true;
9440
- this._wrap(globalThis, "fetch", this._patchConstructor());
10008
+ try {
10009
+ this._wrap(globalThis, "fetch", this._patchConstructor());
10010
+ this._isFetchPatched = true;
10011
+ this._isEnabled = true;
10012
+ } catch (err) {
10013
+ this._diag.warn("Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.", err);
10014
+ }
9441
10015
  }
9442
10016
  /**
9443
10017
  * deactivates fetch instrumentation
@@ -9455,16 +10029,16 @@
9455
10029
  };
9456
10030
 
9457
10031
  // node_modules/@opentelemetry/instrumentation-long-task/build/esm/version.js
9458
- var PACKAGE_VERSION2 = "0.59.0";
9459
- var PACKAGE_NAME2 = "@opentelemetry/instrumentation-long-task";
10032
+ var PACKAGE_VERSION3 = "0.63.0";
10033
+ var PACKAGE_NAME3 = "@opentelemetry/instrumentation-long-task";
9460
10034
 
9461
10035
  // node_modules/@opentelemetry/instrumentation-long-task/build/esm/instrumentation.js
9462
10036
  var LONGTASK_PERFORMANCE_TYPE = "longtask";
9463
10037
  var LongTaskInstrumentation = class extends InstrumentationBase {
9464
- version = PACKAGE_VERSION2;
10038
+ version = PACKAGE_VERSION3;
9465
10039
  _observer;
9466
10040
  constructor(config = {}) {
9467
- super(PACKAGE_NAME2, PACKAGE_VERSION2, config);
10041
+ super(PACKAGE_NAME3, PACKAGE_VERSION3, config);
9468
10042
  }
9469
10043
  init() {
9470
10044
  }
@@ -9539,8 +10113,8 @@
9539
10113
  })(AttributeNames3 || (AttributeNames3 = {}));
9540
10114
 
9541
10115
  // node_modules/@opentelemetry/instrumentation-user-interaction/build/esm/version.js
9542
- var PACKAGE_VERSION3 = "0.59.0";
9543
- var PACKAGE_NAME3 = "@opentelemetry/instrumentation-user-interaction";
10116
+ var PACKAGE_VERSION4 = "0.63.0";
10117
+ var PACKAGE_NAME4 = "@opentelemetry/instrumentation-user-interaction";
9544
10118
 
9545
10119
  // node_modules/@opentelemetry/instrumentation-user-interaction/build/esm/instrumentation.js
9546
10120
  var ZONE_CONTEXT_KEY = "OT_ZONE_CONTEXT";
@@ -9550,7 +10124,7 @@
9550
10124
  return false;
9551
10125
  }
9552
10126
  var UserInteractionInstrumentation = class extends InstrumentationBase {
9553
- version = PACKAGE_VERSION3;
10127
+ version = PACKAGE_VERSION4;
9554
10128
  moduleName = "user-interaction";
9555
10129
  _spansData = /* @__PURE__ */ new WeakMap();
9556
10130
  // for addEventListener/removeEventListener state
@@ -9560,7 +10134,7 @@
9560
10134
  _eventNames;
9561
10135
  _shouldPreventSpanCreation;
9562
10136
  constructor(config = {}) {
9563
- super(PACKAGE_NAME3, PACKAGE_VERSION3, config);
10137
+ super(PACKAGE_NAME4, PACKAGE_VERSION4, config);
9564
10138
  this._eventNames = new Set(config?.eventNames ?? DEFAULT_EVENT_NAMES);
9565
10139
  this._shouldPreventSpanCreation = typeof config?.shouldPreventSpanCreation === "function" ? config.shouldPreventSpanCreation : defaultShouldPreventSpanCreation;
9566
10140
  }
@@ -10120,7 +10694,7 @@
10120
10694
  }
10121
10695
 
10122
10696
  // node_modules/@opentelemetry/instrumentation-xml-http-request/build/esm/version.js
10123
- var VERSION7 = "0.215.0";
10697
+ var VERSION8 = "0.219.0";
10124
10698
 
10125
10699
  // node_modules/@opentelemetry/instrumentation-xml-http-request/build/esm/enums/AttributeNames.js
10126
10700
  var AttributeNames4;
@@ -10132,14 +10706,14 @@
10132
10706
  var OBSERVER_WAIT_TIME_MS2 = 300;
10133
10707
  var XMLHttpRequestInstrumentation = class extends InstrumentationBase {
10134
10708
  component = "xml-http-request";
10135
- version = VERSION7;
10709
+ version = VERSION8;
10136
10710
  moduleName = this.component;
10137
10711
  _tasksCount = 0;
10138
10712
  _xhrMem = /* @__PURE__ */ new WeakMap();
10139
10713
  _usedResources = /* @__PURE__ */ new WeakSet();
10140
10714
  _semconvStability;
10141
10715
  constructor(config = {}) {
10142
- super("@opentelemetry/instrumentation-xml-http-request", VERSION7, config);
10716
+ super("@opentelemetry/instrumentation-xml-http-request", VERSION8, config);
10143
10717
  this._semconvStability = semconvStabilityFromStr("http", config?.semconvStabilityOptIn);
10144
10718
  }
10145
10719
  init() {
@@ -10313,12 +10887,12 @@
10313
10887
  * @private
10314
10888
  */
10315
10889
  _createSpan(xhr, url, method) {
10316
- if (isUrlIgnored(url, this.getConfig().ignoreUrls)) {
10890
+ const parsedUrl = parseUrl(url);
10891
+ if (isUrlIgnored(parsedUrl.href, this.getConfig().ignoreUrls)) {
10317
10892
  this._diag.debug("ignoring span as url matches ignored url");
10318
10893
  return;
10319
10894
  }
10320
10895
  let name = "";
10321
- const parsedUrl = parseUrl(url);
10322
10896
  const attributes = {};
10323
10897
  if (this._semconvStability & SemconvStability.OLD) {
10324
10898
  name = method.toUpperCase();
@@ -10372,6 +10946,9 @@
10372
10946
  return (original) => {
10373
10947
  const plugin = this;
10374
10948
  return function patchOpen(...args) {
10949
+ if (!plugin._isEnabled) {
10950
+ return original.apply(this, args);
10951
+ }
10375
10952
  const method = args[0];
10376
10953
  const url = args[1];
10377
10954
  plugin._createSpan(this, url, method);
@@ -10460,6 +11037,9 @@
10460
11037
  }
10461
11038
  return (original) => {
10462
11039
  return function patchSend(...args) {
11040
+ if (!plugin._isEnabled) {
11041
+ return original.apply(this, args);
11042
+ }
10463
11043
  const xhrMem = plugin._xhrMem.get(this);
10464
11044
  if (!xhrMem) {
10465
11045
  return original.apply(this, args);
@@ -10505,25 +11085,34 @@
10505
11085
  * implements enable function
10506
11086
  */
10507
11087
  enable() {
10508
- this._diag.debug("applying patch to", this.moduleName, this.version);
10509
- if (isWrapped(XMLHttpRequest.prototype.open)) {
10510
- this._unwrap(XMLHttpRequest.prototype, "open");
10511
- this._diag.debug("removing previous patch from method open");
11088
+ if (this._isEnabled) {
11089
+ return;
11090
+ }
11091
+ if (this._isXhrPatched) {
11092
+ this._diag.debug("reactivating existing patch on", this.moduleName, this.version);
11093
+ this._isEnabled = true;
11094
+ return;
10512
11095
  }
10513
- if (isWrapped(XMLHttpRequest.prototype.send)) {
11096
+ try {
11097
+ this._diag.debug("applying patch to", this.moduleName, this.version);
11098
+ this._wrap(XMLHttpRequest.prototype, "open", this._patchOpen());
11099
+ this._wrap(XMLHttpRequest.prototype, "send", this._patchSend());
11100
+ this._isXhrPatched = true;
11101
+ this._isEnabled = true;
11102
+ } catch (err) {
11103
+ this._unwrap(XMLHttpRequest.prototype, "open");
10514
11104
  this._unwrap(XMLHttpRequest.prototype, "send");
10515
- this._diag.debug("removing previous patch from method send");
11105
+ this._diag.warn("Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.", err);
10516
11106
  }
10517
- this._wrap(XMLHttpRequest.prototype, "open", this._patchOpen());
10518
- this._wrap(XMLHttpRequest.prototype, "send", this._patchSend());
10519
11107
  }
10520
11108
  /**
10521
11109
  * implements disable function
10522
11110
  */
10523
11111
  disable() {
10524
- this._diag.debug("removing patch from", this.moduleName, this.version);
10525
- this._unwrap(XMLHttpRequest.prototype, "open");
10526
- this._unwrap(XMLHttpRequest.prototype, "send");
11112
+ if (!this._isEnabled) {
11113
+ return;
11114
+ }
11115
+ this._isEnabled = false;
10527
11116
  this._tasksCount = 0;
10528
11117
  this._xhrMem = /* @__PURE__ */ new WeakMap();
10529
11118
  this._usedResources = /* @__PURE__ */ new WeakSet();
@@ -10531,13 +11120,13 @@
10531
11120
  };
10532
11121
 
10533
11122
  // node_modules/@opentelemetry/instrumentation-web-exception/build/esm/version.js
10534
- var PACKAGE_VERSION4 = "0.8.0";
10535
- var PACKAGE_NAME4 = "@opentelemetry/instrumentation-web-exception";
11123
+ var PACKAGE_VERSION5 = "0.12.0";
11124
+ var PACKAGE_NAME5 = "@opentelemetry/instrumentation-web-exception";
10536
11125
 
10537
11126
  // node_modules/@opentelemetry/instrumentation-web-exception/build/esm/instrumentation.js
10538
11127
  var ExceptionInstrumentation = class extends InstrumentationBase {
10539
11128
  constructor(config = {}) {
10540
- super(PACKAGE_NAME4, PACKAGE_VERSION4, config);
11129
+ super(PACKAGE_NAME5, PACKAGE_VERSION5, config);
10541
11130
  }
10542
11131
  init() {
10543
11132
  }
@@ -10547,7 +11136,7 @@
10547
11136
  if (error === void 0) {
10548
11137
  return;
10549
11138
  }
10550
- const logger3 = logs.getLoggerProvider().getLogger(this.instrumentationName, this.instrumentationVersion);
11139
+ const logger4 = logs.getLoggerProvider().getLogger(this.instrumentationName, this.instrumentationVersion);
10551
11140
  const config = this.getConfig();
10552
11141
  const customAttributes = config.applyCustomAttributes ? config.applyCustomAttributes(error) : {};
10553
11142
  let errorAttributes = {};
@@ -10567,7 +11156,7 @@
10567
11156
  timestamp: hrTime(),
10568
11157
  observedTimestamp: hrTime()
10569
11158
  };
10570
- logger3.emit(errorLog);
11159
+ logger4.emit(errorLog);
10571
11160
  }
10572
11161
  disable() {
10573
11162
  if (this._onErrorHandler) {
@@ -10585,7 +11174,7 @@
10585
11174
  };
10586
11175
 
10587
11176
  // node_modules/@opentelemetry/browser-instrumentation/dist/package.js
10588
- var version = "0.3.0";
11177
+ var version = "0.5.2";
10589
11178
 
10590
11179
  // node_modules/@opentelemetry/browser-instrumentation/dist/web-vitals/semconv.js
10591
11180
  var WEB_VITAL_EVENT_NAME = "browser.web_vital";
@@ -10596,66 +11185,481 @@
10596
11185
  var ATTR_WEB_VITAL_ID = "browser.web_vital.id";
10597
11186
  var ATTR_WEB_VITAL_NAVIGATION_TYPE = "browser.web_vital.navigation_type";
10598
11187
 
10599
- // node_modules/web-vitals/dist/web-vitals.attribution.js
10600
- var t = class {
10601
- t;
10602
- o = 0;
10603
- i = [];
10604
- u(t2) {
10605
- if (t2.hadRecentInput) return;
10606
- const e2 = this.i[0], n2 = this.i.at(-1);
10607
- this.o && e2 && n2 && t2.startTime - n2.startTime < 1e3 && t2.startTime - e2.startTime < 5e3 ? (this.o += t2.value, this.i.push(t2)) : (this.o = t2.value, this.i = [t2]), this.t?.(t2);
10608
- }
10609
- };
10610
- var e = () => {
10611
- const t2 = performance.getEntriesByType("navigation")[0];
10612
- if (t2 && t2.responseStart > 0 && t2.responseStart < performance.now()) return t2;
10613
- };
10614
- var n = (t2) => {
10615
- if ("loading" === document.readyState) return "loading";
10616
- const n2 = e();
10617
- if (n2) {
10618
- if (t2 < n2.domInteractive) return "loading";
10619
- if (0 === n2.domContentLoadedEventStart || t2 < n2.domContentLoadedEventStart) return "dom-interactive";
10620
- if (0 === n2.domComplete || t2 < n2.domComplete) return "dom-content-loaded";
11188
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/api-logs/build/esm/types/LogRecord.js
11189
+ var SeverityNumber2;
11190
+ (function(SeverityNumber3) {
11191
+ SeverityNumber3[SeverityNumber3["UNSPECIFIED"] = 0] = "UNSPECIFIED";
11192
+ SeverityNumber3[SeverityNumber3["TRACE"] = 1] = "TRACE";
11193
+ SeverityNumber3[SeverityNumber3["TRACE2"] = 2] = "TRACE2";
11194
+ SeverityNumber3[SeverityNumber3["TRACE3"] = 3] = "TRACE3";
11195
+ SeverityNumber3[SeverityNumber3["TRACE4"] = 4] = "TRACE4";
11196
+ SeverityNumber3[SeverityNumber3["DEBUG"] = 5] = "DEBUG";
11197
+ SeverityNumber3[SeverityNumber3["DEBUG2"] = 6] = "DEBUG2";
11198
+ SeverityNumber3[SeverityNumber3["DEBUG3"] = 7] = "DEBUG3";
11199
+ SeverityNumber3[SeverityNumber3["DEBUG4"] = 8] = "DEBUG4";
11200
+ SeverityNumber3[SeverityNumber3["INFO"] = 9] = "INFO";
11201
+ SeverityNumber3[SeverityNumber3["INFO2"] = 10] = "INFO2";
11202
+ SeverityNumber3[SeverityNumber3["INFO3"] = 11] = "INFO3";
11203
+ SeverityNumber3[SeverityNumber3["INFO4"] = 12] = "INFO4";
11204
+ SeverityNumber3[SeverityNumber3["WARN"] = 13] = "WARN";
11205
+ SeverityNumber3[SeverityNumber3["WARN2"] = 14] = "WARN2";
11206
+ SeverityNumber3[SeverityNumber3["WARN3"] = 15] = "WARN3";
11207
+ SeverityNumber3[SeverityNumber3["WARN4"] = 16] = "WARN4";
11208
+ SeverityNumber3[SeverityNumber3["ERROR"] = 17] = "ERROR";
11209
+ SeverityNumber3[SeverityNumber3["ERROR2"] = 18] = "ERROR2";
11210
+ SeverityNumber3[SeverityNumber3["ERROR3"] = 19] = "ERROR3";
11211
+ SeverityNumber3[SeverityNumber3["ERROR4"] = 20] = "ERROR4";
11212
+ SeverityNumber3[SeverityNumber3["FATAL"] = 21] = "FATAL";
11213
+ SeverityNumber3[SeverityNumber3["FATAL2"] = 22] = "FATAL2";
11214
+ SeverityNumber3[SeverityNumber3["FATAL3"] = 23] = "FATAL3";
11215
+ SeverityNumber3[SeverityNumber3["FATAL4"] = 24] = "FATAL4";
11216
+ })(SeverityNumber2 || (SeverityNumber2 = {}));
11217
+
11218
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js
11219
+ var NoopLogger2 = class {
11220
+ emit(_logRecord) {
10621
11221
  }
10622
- return "complete";
10623
- };
10624
- var o = (t2) => {
10625
- const e2 = t2.nodeName;
10626
- return 1 === t2.nodeType ? e2.toLowerCase() : e2.toUpperCase().replace(/^#/, "");
10627
- };
10628
- var i = (t2) => {
10629
- let e2 = "";
10630
- try {
10631
- for (; 9 !== t2?.nodeType; ) {
10632
- const n2 = t2, i2 = n2.id ? "#" + n2.id : [o(n2), ...Array.from(n2.classList).sort()].join(".");
10633
- if (e2.length + i2.length > 99) return e2 || i2;
10634
- if (e2 = e2 ? i2 + ">" + e2 : i2, n2.id) break;
10635
- t2 = n2.parentNode;
10636
- }
10637
- } catch {
11222
+ enabled() {
11223
+ return false;
10638
11224
  }
10639
- return e2;
10640
11225
  };
10641
- var r = /* @__PURE__ */ new WeakMap();
10642
- function s(t2, e2) {
10643
- return r.get(t2) || r.set(t2, new e2()), r.get(t2);
11226
+ var NOOP_LOGGER2 = new NoopLogger2();
11227
+
11228
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js
11229
+ var GLOBAL_LOGS_API_KEY2 = /* @__PURE__ */ Symbol.for("io.opentelemetry.js.api.logs");
11230
+ var _global3 = globalThis;
11231
+ function makeGetter2(requiredVersion, instance, fallback) {
11232
+ return (version2) => version2 === requiredVersion ? instance : fallback;
10644
11233
  }
10645
- var a = -1;
10646
- var c = () => a;
10647
- var u = (t2) => {
10648
- addEventListener("pageshow", (e2) => {
10649
- e2.persisted && (a = e2.timeStamp, t2(e2));
10650
- }, true);
10651
- };
10652
- var f = (t2, e2, n2, o2) => {
10653
- let i2, r2;
10654
- return (s2) => {
10655
- e2.value >= 0 && (s2 || o2) && (r2 = e2.value - (i2 ?? 0), (r2 || void 0 === i2) && (i2 = e2.value, e2.delta = r2, e2.rating = ((t3, e3) => t3 > e3[1] ? "poor" : t3 > e3[0] ? "needs-improvement" : "good")(e2.value, n2), t2(e2)));
10656
- };
11234
+ var API_BACKWARDS_COMPATIBILITY_VERSION2 = 1;
11235
+
11236
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js
11237
+ var NoopLoggerProvider2 = class {
11238
+ getLogger(_name, _version, _options) {
11239
+ return new NoopLogger2();
11240
+ }
10657
11241
  };
10658
- var d = (t2) => {
11242
+ var NOOP_LOGGER_PROVIDER2 = new NoopLoggerProvider2();
11243
+
11244
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js
11245
+ var ProxyLogger2 = class {
11246
+ constructor(provider, name, version2, options) {
11247
+ this._provider = provider;
11248
+ this.name = name;
11249
+ this.version = version2;
11250
+ this.options = options;
11251
+ }
11252
+ /**
11253
+ * Emit a log record. This method should only be used by log appenders.
11254
+ *
11255
+ * @param logRecord
11256
+ */
11257
+ emit(logRecord) {
11258
+ this._getLogger().emit(logRecord);
11259
+ }
11260
+ enabled(options) {
11261
+ return this._getLogger().enabled(options);
11262
+ }
11263
+ /**
11264
+ * Try to get a logger from the proxy logger provider.
11265
+ * If the proxy logger provider has no delegate, return a noop logger.
11266
+ */
11267
+ _getLogger() {
11268
+ if (this._delegate) {
11269
+ return this._delegate;
11270
+ }
11271
+ const logger4 = this._provider._getDelegateLogger(this.name, this.version, this.options);
11272
+ if (!logger4) {
11273
+ return NOOP_LOGGER2;
11274
+ }
11275
+ this._delegate = logger4;
11276
+ return this._delegate;
11277
+ }
11278
+ };
11279
+
11280
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js
11281
+ var ProxyLoggerProvider2 = class {
11282
+ getLogger(name, version2, options) {
11283
+ var _a;
11284
+ return (_a = this._getDelegateLogger(name, version2, options)) !== null && _a !== void 0 ? _a : new ProxyLogger2(this, name, version2, options);
11285
+ }
11286
+ /**
11287
+ * Get the delegate logger provider.
11288
+ * Used by tests only.
11289
+ * @internal
11290
+ */
11291
+ _getDelegate() {
11292
+ var _a;
11293
+ return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_LOGGER_PROVIDER2;
11294
+ }
11295
+ /**
11296
+ * Set the delegate logger provider
11297
+ * @internal
11298
+ */
11299
+ _setDelegate(delegate) {
11300
+ this._delegate = delegate;
11301
+ }
11302
+ /**
11303
+ * @internal
11304
+ */
11305
+ _getDelegateLogger(name, version2, options) {
11306
+ var _a;
11307
+ return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getLogger(name, version2, options);
11308
+ }
11309
+ };
11310
+
11311
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js
11312
+ var LogsAPI2 = class _LogsAPI {
11313
+ constructor() {
11314
+ this._proxyLoggerProvider = new ProxyLoggerProvider2();
11315
+ }
11316
+ static getInstance() {
11317
+ if (!this._instance) {
11318
+ this._instance = new _LogsAPI();
11319
+ }
11320
+ return this._instance;
11321
+ }
11322
+ setGlobalLoggerProvider(provider) {
11323
+ if (_global3[GLOBAL_LOGS_API_KEY2]) {
11324
+ return this.getLoggerProvider();
11325
+ }
11326
+ _global3[GLOBAL_LOGS_API_KEY2] = makeGetter2(API_BACKWARDS_COMPATIBILITY_VERSION2, provider, NOOP_LOGGER_PROVIDER2);
11327
+ this._proxyLoggerProvider._setDelegate(provider);
11328
+ return provider;
11329
+ }
11330
+ /**
11331
+ * Returns the global logger provider.
11332
+ *
11333
+ * @returns LoggerProvider
11334
+ */
11335
+ getLoggerProvider() {
11336
+ var _a, _b;
11337
+ return (_b = (_a = _global3[GLOBAL_LOGS_API_KEY2]) === null || _a === void 0 ? void 0 : _a.call(_global3, API_BACKWARDS_COMPATIBILITY_VERSION2)) !== null && _b !== void 0 ? _b : this._proxyLoggerProvider;
11338
+ }
11339
+ /**
11340
+ * Returns a logger from the global logger provider.
11341
+ *
11342
+ * @returns Logger
11343
+ */
11344
+ getLogger(name, version2, options) {
11345
+ return this.getLoggerProvider().getLogger(name, version2, options);
11346
+ }
11347
+ /** Remove the global logger provider */
11348
+ disable() {
11349
+ delete _global3[GLOBAL_LOGS_API_KEY2];
11350
+ this._proxyLoggerProvider = new ProxyLoggerProvider2();
11351
+ }
11352
+ };
11353
+
11354
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/api-logs/build/esm/index.js
11355
+ var logs2 = LogsAPI2.getInstance();
11356
+
11357
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/shimmer.js
11358
+ var logger2 = console.error.bind(console);
11359
+ function defineProperty2(obj, name, value) {
11360
+ const enumerable = !!obj[name] && Object.prototype.propertyIsEnumerable.call(obj, name);
11361
+ Object.defineProperty(obj, name, {
11362
+ configurable: true,
11363
+ enumerable,
11364
+ writable: true,
11365
+ value
11366
+ });
11367
+ }
11368
+ var wrap2 = (nodule, name, wrapper) => {
11369
+ if (!nodule || !nodule[name]) {
11370
+ logger2("no original function " + String(name) + " to wrap");
11371
+ return;
11372
+ }
11373
+ if (!wrapper) {
11374
+ logger2("no wrapper function");
11375
+ logger2(new Error().stack);
11376
+ return;
11377
+ }
11378
+ const original = nodule[name];
11379
+ if (typeof original !== "function" || typeof wrapper !== "function") {
11380
+ logger2("original object and wrapper must be functions");
11381
+ return;
11382
+ }
11383
+ const wrapped = wrapper(original, name);
11384
+ defineProperty2(wrapped, "__original", original);
11385
+ defineProperty2(wrapped, "__unwrap", () => {
11386
+ if (nodule[name] === wrapped) {
11387
+ defineProperty2(nodule, name, original);
11388
+ }
11389
+ });
11390
+ defineProperty2(wrapped, "__wrapped", true);
11391
+ defineProperty2(nodule, name, wrapped);
11392
+ return wrapped;
11393
+ };
11394
+ var massWrap2 = (nodules, names, wrapper) => {
11395
+ if (!nodules) {
11396
+ logger2("must provide one or more modules to patch");
11397
+ logger2(new Error().stack);
11398
+ return;
11399
+ } else if (!Array.isArray(nodules)) {
11400
+ nodules = [nodules];
11401
+ }
11402
+ if (!(names && Array.isArray(names))) {
11403
+ logger2("must provide one or more functions to wrap on modules");
11404
+ return;
11405
+ }
11406
+ nodules.forEach((nodule) => {
11407
+ names.forEach((name) => {
11408
+ wrap2(nodule, name, wrapper);
11409
+ });
11410
+ });
11411
+ };
11412
+ var unwrap2 = (nodule, name) => {
11413
+ if (!nodule || !nodule[name]) {
11414
+ logger2("no function to unwrap.");
11415
+ logger2(new Error().stack);
11416
+ return;
11417
+ }
11418
+ const wrapped = nodule[name];
11419
+ if (!wrapped.__unwrap) {
11420
+ logger2("no original to unwrap to -- has " + String(name) + " already been unwrapped?");
11421
+ } else {
11422
+ wrapped.__unwrap();
11423
+ return;
11424
+ }
11425
+ };
11426
+ var massUnwrap2 = (nodules, names) => {
11427
+ if (!nodules) {
11428
+ logger2("must provide one or more modules to patch");
11429
+ logger2(new Error().stack);
11430
+ return;
11431
+ } else if (!Array.isArray(nodules)) {
11432
+ nodules = [nodules];
11433
+ }
11434
+ if (!(names && Array.isArray(names))) {
11435
+ logger2("must provide one or more functions to unwrap on modules");
11436
+ return;
11437
+ }
11438
+ nodules.forEach((nodule) => {
11439
+ names.forEach((name) => {
11440
+ unwrap2(nodule, name);
11441
+ });
11442
+ });
11443
+ };
11444
+ function shimmer2(options) {
11445
+ if (options && options.logger) {
11446
+ if (typeof options.logger !== "function") {
11447
+ logger2("new logger isn't a function, not replacing");
11448
+ } else {
11449
+ logger2 = options.logger;
11450
+ }
11451
+ }
11452
+ }
11453
+ shimmer2.wrap = wrap2;
11454
+ shimmer2.massWrap = massWrap2;
11455
+ shimmer2.unwrap = unwrap2;
11456
+ shimmer2.massUnwrap = massUnwrap2;
11457
+
11458
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/instrumentation.js
11459
+ var InstrumentationAbstract2 = class {
11460
+ _config = {};
11461
+ _tracer;
11462
+ _meter;
11463
+ _logger;
11464
+ _diag;
11465
+ instrumentationName;
11466
+ instrumentationVersion;
11467
+ constructor(instrumentationName, instrumentationVersion, config) {
11468
+ this.instrumentationName = instrumentationName;
11469
+ this.instrumentationVersion = instrumentationVersion;
11470
+ this.setConfig(config);
11471
+ this._diag = diag2.createComponentLogger({
11472
+ namespace: instrumentationName
11473
+ });
11474
+ this._tracer = trace.getTracer(instrumentationName, instrumentationVersion);
11475
+ this._meter = metrics.getMeter(instrumentationName, instrumentationVersion);
11476
+ this._logger = logs2.getLogger(instrumentationName, instrumentationVersion);
11477
+ this._updateMetricInstruments();
11478
+ }
11479
+ /* Api to wrap instrumented method */
11480
+ _wrap = wrap2;
11481
+ /* Api to unwrap instrumented methods */
11482
+ _unwrap = unwrap2;
11483
+ /* Api to mass wrap instrumented method */
11484
+ _massWrap = massWrap2;
11485
+ /* Api to mass unwrap instrumented methods */
11486
+ _massUnwrap = massUnwrap2;
11487
+ /* Returns meter */
11488
+ get meter() {
11489
+ return this._meter;
11490
+ }
11491
+ /**
11492
+ * Sets MeterProvider to this plugin
11493
+ * @param meterProvider
11494
+ */
11495
+ setMeterProvider(meterProvider) {
11496
+ this._meter = meterProvider.getMeter(this.instrumentationName, this.instrumentationVersion);
11497
+ this._updateMetricInstruments();
11498
+ }
11499
+ /* Returns logger */
11500
+ get logger() {
11501
+ return this._logger;
11502
+ }
11503
+ /**
11504
+ * Sets LoggerProvider to this plugin
11505
+ * @param loggerProvider
11506
+ */
11507
+ setLoggerProvider(loggerProvider) {
11508
+ this._logger = loggerProvider.getLogger(this.instrumentationName, this.instrumentationVersion);
11509
+ }
11510
+ /**
11511
+ * @experimental
11512
+ *
11513
+ * Get module definitions defined by {@link init}.
11514
+ * This can be used for experimental compile-time instrumentation.
11515
+ *
11516
+ * @returns an array of {@link InstrumentationModuleDefinition}
11517
+ */
11518
+ getModuleDefinitions() {
11519
+ const initResult = this.init() ?? [];
11520
+ if (!Array.isArray(initResult)) {
11521
+ return [initResult];
11522
+ }
11523
+ return initResult;
11524
+ }
11525
+ /**
11526
+ * Sets the new metric instruments with the current Meter.
11527
+ */
11528
+ _updateMetricInstruments() {
11529
+ return;
11530
+ }
11531
+ /* Returns InstrumentationConfig */
11532
+ getConfig() {
11533
+ return this._config;
11534
+ }
11535
+ /**
11536
+ * Sets InstrumentationConfig to this plugin
11537
+ * @param config
11538
+ */
11539
+ setConfig(config) {
11540
+ this._config = {
11541
+ enabled: true,
11542
+ ...config
11543
+ };
11544
+ }
11545
+ /**
11546
+ * Sets TraceProvider to this plugin
11547
+ * @param tracerProvider
11548
+ */
11549
+ setTracerProvider(tracerProvider) {
11550
+ this._tracer = tracerProvider.getTracer(this.instrumentationName, this.instrumentationVersion);
11551
+ }
11552
+ /* Returns tracer */
11553
+ get tracer() {
11554
+ return this._tracer;
11555
+ }
11556
+ /**
11557
+ * Execute span customization hook, if configured, and log any errors.
11558
+ * Any semantics of the trigger and info are defined by the specific instrumentation.
11559
+ * @param hookHandler The optional hook handler which the user has configured via instrumentation config
11560
+ * @param triggerName The name of the trigger for executing the hook for logging purposes
11561
+ * @param span The span to which the hook should be applied
11562
+ * @param info The info object to be passed to the hook, with useful data the hook may use
11563
+ */
11564
+ _runSpanCustomizationHook(hookHandler, triggerName, span, info) {
11565
+ if (!hookHandler) {
11566
+ return;
11567
+ }
11568
+ try {
11569
+ hookHandler(span, info);
11570
+ } catch (e2) {
11571
+ this._diag.error(`Error running span customization hook due to exception in handler`, { triggerName }, e2);
11572
+ }
11573
+ }
11574
+ };
11575
+
11576
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/platform/browser/instrumentation.js
11577
+ var InstrumentationBase2 = class extends InstrumentationAbstract2 {
11578
+ constructor(instrumentationName, instrumentationVersion, config) {
11579
+ super(instrumentationName, instrumentationVersion, config);
11580
+ if (this._config.enabled) {
11581
+ this.enable();
11582
+ }
11583
+ }
11584
+ };
11585
+
11586
+ // node_modules/@opentelemetry/browser-instrumentation/node_modules/@opentelemetry/instrumentation/build/esm/utils.js
11587
+ function safeExecuteInTheMiddle2(execute, onFinish, preventThrowingError) {
11588
+ let error;
11589
+ let result;
11590
+ try {
11591
+ result = execute();
11592
+ } catch (e2) {
11593
+ error = e2;
11594
+ } finally {
11595
+ onFinish(error, result);
11596
+ if (error && !preventThrowingError) {
11597
+ throw error;
11598
+ }
11599
+ return result;
11600
+ }
11601
+ }
11602
+
11603
+ // node_modules/web-vitals/dist/web-vitals.attribution.js
11604
+ var t = class {
11605
+ t;
11606
+ o = 0;
11607
+ i = [];
11608
+ u(t2) {
11609
+ if (t2.hadRecentInput) return;
11610
+ const e2 = this.i[0], n2 = this.i.at(-1);
11611
+ this.o && e2 && n2 && t2.startTime - n2.startTime < 1e3 && t2.startTime - e2.startTime < 5e3 ? (this.o += t2.value, this.i.push(t2)) : (this.o = t2.value, this.i = [t2]), this.t?.(t2);
11612
+ }
11613
+ };
11614
+ var e = () => {
11615
+ const t2 = performance.getEntriesByType("navigation")[0];
11616
+ if (t2 && t2.responseStart > 0 && t2.responseStart < performance.now()) return t2;
11617
+ };
11618
+ var n = (t2) => {
11619
+ if ("loading" === document.readyState) return "loading";
11620
+ const n2 = e();
11621
+ if (n2) {
11622
+ if (t2 < n2.domInteractive) return "loading";
11623
+ if (0 === n2.domContentLoadedEventStart || t2 < n2.domContentLoadedEventStart) return "dom-interactive";
11624
+ if (0 === n2.domComplete || t2 < n2.domComplete) return "dom-content-loaded";
11625
+ }
11626
+ return "complete";
11627
+ };
11628
+ var o = (t2) => {
11629
+ const e2 = t2.nodeName;
11630
+ return 1 === t2.nodeType ? e2.toLowerCase() : e2.toUpperCase().replace(/^#/, "");
11631
+ };
11632
+ var i = (t2) => {
11633
+ let e2 = "";
11634
+ try {
11635
+ for (; 9 !== t2?.nodeType; ) {
11636
+ const n2 = t2, i2 = n2.id ? "#" + n2.id : [o(n2), ...Array.from(n2.classList).sort()].join(".");
11637
+ if (e2.length + i2.length > 99) return e2 || i2;
11638
+ if (e2 = e2 ? i2 + ">" + e2 : i2, n2.id) break;
11639
+ t2 = n2.parentNode;
11640
+ }
11641
+ } catch {
11642
+ }
11643
+ return e2;
11644
+ };
11645
+ var r = /* @__PURE__ */ new WeakMap();
11646
+ function s(t2, e2) {
11647
+ return r.get(t2) || r.set(t2, new e2()), r.get(t2);
11648
+ }
11649
+ var a = -1;
11650
+ var c = () => a;
11651
+ var u = (t2) => {
11652
+ addEventListener("pageshow", (e2) => {
11653
+ e2.persisted && (a = e2.timeStamp, t2(e2));
11654
+ }, true);
11655
+ };
11656
+ var f = (t2, e2, n2, o2) => {
11657
+ let i2, r2;
11658
+ return (s2) => {
11659
+ e2.value >= 0 && (s2 || o2) && (r2 = e2.value - (i2 ?? 0), (r2 || void 0 === i2) && (i2 = e2.value, e2.delta = r2, e2.rating = ((t3, e3) => t3 > e3[1] ? "poor" : t3 > e3[0] ? "needs-improvement" : "good")(e2.value, n2), t2(e2)));
11660
+ };
11661
+ };
11662
+ var d = (t2) => {
10659
11663
  requestAnimationFrame(() => requestAnimationFrame(t2));
10660
11664
  };
10661
11665
  var l = () => e()?.activationStart ?? 0;
@@ -11004,7 +12008,7 @@
11004
12008
  };
11005
12009
 
11006
12010
  // node_modules/@opentelemetry/browser-instrumentation/dist/web-vitals/instrumentation.js
11007
- var WebVitalsInstrumentation = class extends InstrumentationBase {
12011
+ var WebVitalsInstrumentation = class extends InstrumentationBase2 {
11008
12012
  _applyCustomLogRecordData;
11009
12013
  _includeRawAttribution;
11010
12014
  constructor(config = {}) {
@@ -11075,12 +12079,12 @@
11075
12079
  const timestamp = this._getTimestampForMetric(metric);
11076
12080
  const logRecord = {
11077
12081
  eventName: WEB_VITAL_EVENT_NAME,
11078
- severityNumber: SeverityNumber.INFO,
12082
+ severityNumber: SeverityNumber2.INFO,
11079
12083
  attributes,
11080
12084
  ...this._includeRawAttribution ? { body: JSON.stringify(metric.attribution) } : {},
11081
12085
  ...timestamp !== void 0 ? { timestamp } : {}
11082
12086
  };
11083
- if (this._applyCustomLogRecordData) safeExecuteInTheMiddle(() => this._applyCustomLogRecordData?.(logRecord), (error) => {
12087
+ if (this._applyCustomLogRecordData) safeExecuteInTheMiddle2(() => this._applyCustomLogRecordData?.(logRecord), (error) => {
11084
12088
  if (error) this._diag.error("applyCustomLogRecordData hook failed", error);
11085
12089
  }, true);
11086
12090
  this.logger.emit(logRecord);
@@ -11130,7 +12134,7 @@
11130
12134
  }
11131
12135
 
11132
12136
  // lib/context.js
11133
- var logger2 = createLogger({ logLevel: "warn" });
12137
+ var logger3 = createLogger({ logLevel: "warn" });
11134
12138
  var _currentContext = ROOT_CONTEXT;
11135
12139
  var _managerEnabled = false;
11136
12140
  var AsyncApisContextManager = {
@@ -11158,7 +12162,7 @@
11158
12162
  return this;
11159
12163
  }
11160
12164
  const manager = this;
11161
- wrap2(window, "setTimeout", (origSetTimeout) => {
12165
+ wrap3(window, "setTimeout", (origSetTimeout) => {
11162
12166
  return function(...args) {
11163
12167
  const delay = Number(args[1]);
11164
12168
  if (isNaN(delay) || delay <= 50) {
@@ -11167,7 +12171,7 @@
11167
12171
  return origSetTimeout.apply(this, args);
11168
12172
  };
11169
12173
  });
11170
- wrap2(window, "setImmediate", (origSetImmediate) => {
12174
+ wrap3(window, "setImmediate", (origSetImmediate) => {
11171
12175
  return function(...args) {
11172
12176
  args[0] = bindFn(args[0], manager, manager.active());
11173
12177
  return origSetImmediate.apply(this, args);
@@ -11183,8 +12187,8 @@
11183
12187
  },
11184
12188
  disable: function() {
11185
12189
  if (_managerEnabled) {
11186
- unwrap2(window, "setTimeout");
11187
- unwrap2(window, "setImmediate");
12190
+ unwrap3(window, "setTimeout");
12191
+ unwrap3(window, "setImmediate");
11188
12192
  unwrapXMLHttpRequest();
11189
12193
  if (window.Promise) {
11190
12194
  unwrapPromise();
@@ -11212,7 +12216,7 @@
11212
12216
  return wrappedCtxFn;
11213
12217
  }
11214
12218
  function wrapPromise(manager) {
11215
- wrap2(Promise.prototype, "then", (origThen) => {
12219
+ wrap3(Promise.prototype, "then", (origThen) => {
11216
12220
  return function(onResolved, onRejected) {
11217
12221
  return origThen.call(
11218
12222
  this,
@@ -11221,7 +12225,7 @@
11221
12225
  );
11222
12226
  };
11223
12227
  });
11224
- wrap2(Promise.prototype, "catch", (origCatch) => {
12228
+ wrap3(Promise.prototype, "catch", (origCatch) => {
11225
12229
  return function(onRejected) {
11226
12230
  return origCatch.call(
11227
12231
  this,
@@ -11229,7 +12233,7 @@
11229
12233
  );
11230
12234
  };
11231
12235
  });
11232
- wrap2(Promise.prototype, "finally", (origFinally) => {
12236
+ wrap3(Promise.prototype, "finally", (origFinally) => {
11233
12237
  return function(onCompleted) {
11234
12238
  return origFinally.call(
11235
12239
  this,
@@ -11239,9 +12243,9 @@
11239
12243
  });
11240
12244
  }
11241
12245
  function unwrapPromise() {
11242
- unwrap2(Promise.prototype, "then");
11243
- unwrap2(Promise.prototype, "catch");
11244
- unwrap2(Promise.prototype, "finally");
12246
+ unwrap3(Promise.prototype, "then");
12247
+ unwrap3(Promise.prototype, "catch");
12248
+ unwrap3(Promise.prototype, "finally");
11245
12249
  }
11246
12250
  var xhrProps = ["onreadystatechange"];
11247
12251
  var xhrProto = globalThis.XMLHttpRequest.prototype;
@@ -11256,7 +12260,7 @@
11256
12260
  ];
11257
12261
  var xhrTargetProto = globalThis.XMLHttpRequestEventTarget.prototype;
11258
12262
  function wrapXMLHttpRequest(manager) {
11259
- wrap2(xhrProto, "addEventListener", function(origAEL) {
12263
+ wrap3(xhrProto, "addEventListener", function(origAEL) {
11260
12264
  return function(...args) {
11261
12265
  const xhr = this;
11262
12266
  if (typeof args[1] === "function") {
@@ -11269,7 +12273,7 @@
11269
12273
  return origAEL.apply(xhr, args);
11270
12274
  };
11271
12275
  });
11272
- wrap2(xhrProto, "removeEventListener", function(origREL) {
12276
+ wrap3(xhrProto, "removeEventListener", function(origREL) {
11273
12277
  return function(...args) {
11274
12278
  const xhr = this;
11275
12279
  if (typeof args[1] === "function") {
@@ -11301,13 +12305,13 @@
11301
12305
  }
11302
12306
  }
11303
12307
  function unwrapXMLHttpRequest() {
11304
- unwrap2(xhrProto, "addEventListener");
11305
- unwrap2(xhrProto, "removeEventListener");
12308
+ unwrap3(xhrProto, "addEventListener");
12309
+ unwrap3(xhrProto, "removeEventListener");
11306
12310
  for (const prop of xhrProps) {
11307
12311
  const descriptor = Object.getOwnPropertyDescriptor(xhrProto, prop);
11308
12312
  if (descriptor) {
11309
- unwrap2(descriptor, "set");
11310
- unwrap2(descriptor, "get");
12313
+ unwrap3(descriptor, "set");
12314
+ unwrap3(descriptor, "get");
11311
12315
  Object.defineProperty(xhrProto, prop, descriptor);
11312
12316
  }
11313
12317
  }
@@ -11317,50 +12321,50 @@
11317
12321
  prop
11318
12322
  );
11319
12323
  if (descriptor) {
11320
- unwrap2(descriptor, "set");
11321
- unwrap2(descriptor, "get");
12324
+ unwrap3(descriptor, "set");
12325
+ unwrap3(descriptor, "get");
11322
12326
  Object.defineProperty(xhrTargetProto, prop, descriptor);
11323
12327
  }
11324
12328
  }
11325
12329
  }
11326
- function wrap2(nodule, name, wrapper) {
12330
+ function wrap3(nodule, name, wrapper) {
11327
12331
  if (!nodule || !nodule[name]) {
11328
- logger2.warn("no original function " + String(name) + " to wrap");
12332
+ logger3.warn("no original function " + String(name) + " to wrap");
11329
12333
  return;
11330
12334
  }
11331
12335
  if (!wrapper) {
11332
- logger2.warn("no wrapper function");
11333
- logger2.warn(new Error().stack);
12336
+ logger3.warn("no wrapper function");
12337
+ logger3.warn(new Error().stack);
11334
12338
  return;
11335
12339
  }
11336
12340
  const original = nodule[name];
11337
12341
  if (typeof original !== "function" || typeof wrapper !== "function") {
11338
- logger2.warn("original object and wrapper must be functions");
12342
+ logger3.warn("original object and wrapper must be functions");
11339
12343
  return;
11340
12344
  }
11341
12345
  const wrapped = wrapper(original, name);
11342
12346
  if (typeof original.toString === "function") {
11343
12347
  wrapped.toString = original.toString.bind(original);
11344
12348
  }
11345
- defineProperty2(wrapped, "__original", original);
11346
- defineProperty2(wrapped, "__unwrap", () => {
12349
+ defineProperty3(wrapped, "__original", original);
12350
+ defineProperty3(wrapped, "__unwrap", () => {
11347
12351
  if (nodule[name] === wrapped) {
11348
- defineProperty2(nodule, name, original);
12352
+ defineProperty3(nodule, name, original);
11349
12353
  }
11350
12354
  });
11351
- defineProperty2(wrapped, "__wrapped", true);
11352
- defineProperty2(nodule, name, wrapped);
12355
+ defineProperty3(wrapped, "__wrapped", true);
12356
+ defineProperty3(nodule, name, wrapped);
11353
12357
  return wrapped;
11354
12358
  }
11355
- function unwrap2(nodule, name) {
12359
+ function unwrap3(nodule, name) {
11356
12360
  if (!nodule || !nodule[name]) {
11357
- logger2.warn("no function to unwrap.");
11358
- logger2.warn(new Error().stack);
12361
+ logger3.warn("no function to unwrap.");
12362
+ logger3.warn(new Error().stack);
11359
12363
  return;
11360
12364
  }
11361
12365
  const wrapped = nodule[name];
11362
12366
  if (!wrapped.__unwrap) {
11363
- logger2.warn(
12367
+ logger3.warn(
11364
12368
  `no original to unwrap to -- has ${String(name)} already been unwrapped?`
11365
12369
  );
11366
12370
  } else {
@@ -11369,7 +12373,7 @@
11369
12373
  }
11370
12374
  }
11371
12375
  function wrapDescriptor(descriptor, manager) {
11372
- wrap2(descriptor, "set", function(origSet) {
12376
+ wrap3(descriptor, "set", function(origSet) {
11373
12377
  return function(value) {
11374
12378
  if (typeof value === "function") {
11375
12379
  const origValue = value;
@@ -11379,7 +12383,7 @@
11379
12383
  return origSet.call(this, value);
11380
12384
  };
11381
12385
  });
11382
- wrap2(descriptor, "get", function(origGet) {
12386
+ wrap3(descriptor, "get", function(origGet) {
11383
12387
  return function() {
11384
12388
  const value = origGet.call(this);
11385
12389
  if (typeof value === "function" && value.__original) {
@@ -11389,7 +12393,7 @@
11389
12393
  };
11390
12394
  });
11391
12395
  }
11392
- function defineProperty2(obj, name, value) {
12396
+ function defineProperty3(obj, name, value) {
11393
12397
  const enumerable = !!obj[name] && Object.prototype.propertyIsEnumerable.call(obj, name);
11394
12398
  Object.defineProperty(obj, name, {
11395
12399
  configurable: true,
@@ -11407,7 +12411,7 @@
11407
12411
  var ATTR_USER_AGENT_ORIGINAL2 = "user_agent.original";
11408
12412
 
11409
12413
  // lib/version.js
11410
- var EDOT_VERSION = "0.2.0";
12414
+ var EDOT_VERSION = "0.3.0";
11411
12415
 
11412
12416
  // lib/detector.js
11413
12417
  function detectResource(attribs, serviceName2, serviceVersion) {
@@ -11628,6 +12632,7 @@
11628
12632
  });
11629
12633
  logs.setGlobalLoggerProvider(loggerProvider);
11630
12634
  const instrFactories = {
12635
+ "@opentelemetry/instrumentation-browser-navigation": (cfg2) => new BrowserNavigationInstrumentation(cfg2),
11631
12636
  "@opentelemetry/instrumentation-document-load": (cfg2) => new DocumentLoadInstrumentation(cfg2),
11632
12637
  "@opentelemetry/instrumentation-fetch": (cfg2) => new FetchInstrumentation(cfg2),
11633
12638
  "@opentelemetry/instrumentation-long-task": (cfg2) => new LongTaskInstrumentation(cfg2),