@equinor/fusion-framework-vite-plugin-spa 5.0.0 → 5.2.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.
@@ -0,0 +1,2862 @@
1
+ /*
2
+ * Copyright The OpenTelemetry Authors
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ // this is autogenerated file, see scripts/version-update.js
6
+ const VERSION$2 = '1.9.1';
7
+
8
+ /*
9
+ * Copyright The OpenTelemetry Authors
10
+ * SPDX-License-Identifier: Apache-2.0
11
+ */
12
+ const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
13
+ /**
14
+ * Create a function to test an API version to see if it is compatible with the provided ownVersion.
15
+ *
16
+ * The returned function has the following semantics:
17
+ * - Exact match is always compatible
18
+ * - Major versions must match exactly
19
+ * - 1.x package cannot use global 2.x package
20
+ * - 2.x package cannot use global 1.x package
21
+ * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API
22
+ * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects
23
+ * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3
24
+ * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor
25
+ * - Patch and build tag differences are not considered at this time
26
+ *
27
+ * @param ownVersion version which should be checked against
28
+ */
29
+ function _makeCompatibilityCheck(ownVersion) {
30
+ const acceptedVersions = new Set([ownVersion]);
31
+ const rejectedVersions = new Set();
32
+ const myVersionMatch = ownVersion.match(re);
33
+ if (!myVersionMatch) {
34
+ // we cannot guarantee compatibility so we always return noop
35
+ return () => false;
36
+ }
37
+ const ownVersionParsed = {
38
+ major: +myVersionMatch[1],
39
+ minor: +myVersionMatch[2],
40
+ patch: +myVersionMatch[3],
41
+ prerelease: myVersionMatch[4],
42
+ };
43
+ // if ownVersion has a prerelease tag, versions must match exactly
44
+ if (ownVersionParsed.prerelease != null) {
45
+ return function isExactmatch(globalVersion) {
46
+ return globalVersion === ownVersion;
47
+ };
48
+ }
49
+ function _reject(v) {
50
+ rejectedVersions.add(v);
51
+ return false;
52
+ }
53
+ function _accept(v) {
54
+ acceptedVersions.add(v);
55
+ return true;
56
+ }
57
+ return function isCompatible(globalVersion) {
58
+ if (acceptedVersions.has(globalVersion)) {
59
+ return true;
60
+ }
61
+ if (rejectedVersions.has(globalVersion)) {
62
+ return false;
63
+ }
64
+ const globalVersionMatch = globalVersion.match(re);
65
+ if (!globalVersionMatch) {
66
+ // cannot parse other version
67
+ // we cannot guarantee compatibility so we always noop
68
+ return _reject(globalVersion);
69
+ }
70
+ const globalVersionParsed = {
71
+ major: +globalVersionMatch[1],
72
+ minor: +globalVersionMatch[2],
73
+ patch: +globalVersionMatch[3],
74
+ prerelease: globalVersionMatch[4],
75
+ };
76
+ // if globalVersion has a prerelease tag, versions must match exactly
77
+ if (globalVersionParsed.prerelease != null) {
78
+ return _reject(globalVersion);
79
+ }
80
+ // major versions must match
81
+ if (ownVersionParsed.major !== globalVersionParsed.major) {
82
+ return _reject(globalVersion);
83
+ }
84
+ if (ownVersionParsed.major === 0) {
85
+ if (ownVersionParsed.minor === globalVersionParsed.minor &&
86
+ ownVersionParsed.patch <= globalVersionParsed.patch) {
87
+ return _accept(globalVersion);
88
+ }
89
+ return _reject(globalVersion);
90
+ }
91
+ if (ownVersionParsed.minor <= globalVersionParsed.minor) {
92
+ return _accept(globalVersion);
93
+ }
94
+ return _reject(globalVersion);
95
+ };
96
+ }
97
+ /**
98
+ * Test an API version to see if it is compatible with this API.
99
+ *
100
+ * - Exact match is always compatible
101
+ * - Major versions must match exactly
102
+ * - 1.x package cannot use global 2.x package
103
+ * - 2.x package cannot use global 1.x package
104
+ * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API
105
+ * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects
106
+ * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3
107
+ * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor
108
+ * - Patch and build tag differences are not considered at this time
109
+ *
110
+ * @param version version of the API requesting an instance of the global API
111
+ */
112
+ const isCompatible = _makeCompatibilityCheck(VERSION$2);
113
+
114
+ /*
115
+ * Copyright The OpenTelemetry Authors
116
+ * SPDX-License-Identifier: Apache-2.0
117
+ */
118
+ const major = VERSION$2.split('.')[0];
119
+ const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
120
+ const _global = (typeof globalThis === 'object'
121
+ ? globalThis
122
+ : typeof self === 'object'
123
+ ? self
124
+ : typeof window === 'object'
125
+ ? window
126
+ : typeof global === 'object'
127
+ ? global
128
+ : {});
129
+ function registerGlobal(type, instance, diag, allowOverride = false) {
130
+ var _a;
131
+ const api = (_global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
132
+ version: VERSION$2,
133
+ });
134
+ if (!allowOverride && api[type]) {
135
+ // already registered an API of this type
136
+ const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
137
+ diag.error(err.stack || err.message);
138
+ return false;
139
+ }
140
+ if (api.version !== VERSION$2) {
141
+ // All registered APIs must be of the same version exactly
142
+ const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION$2}`);
143
+ diag.error(err.stack || err.message);
144
+ return false;
145
+ }
146
+ api[type] = instance;
147
+ diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION$2}.`);
148
+ return true;
149
+ }
150
+ function getGlobal(type) {
151
+ var _a, _b;
152
+ const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
153
+ if (!globalVersion || !isCompatible(globalVersion)) {
154
+ return;
155
+ }
156
+ return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
157
+ }
158
+ function unregisterGlobal(type, diag) {
159
+ diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION$2}.`);
160
+ const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
161
+ if (api) {
162
+ delete api[type];
163
+ }
164
+ }
165
+
166
+ /*
167
+ * Copyright The OpenTelemetry Authors
168
+ * SPDX-License-Identifier: Apache-2.0
169
+ */
170
+ /**
171
+ * Component Logger which is meant to be used as part of any component which
172
+ * will add automatically additional namespace in front of the log message.
173
+ * It will then forward all message to global diag logger
174
+ * @example
175
+ * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });
176
+ * cLogger.debug('test');
177
+ * // @opentelemetry/instrumentation-http test
178
+ */
179
+ class DiagComponentLogger {
180
+ constructor(props) {
181
+ this._namespace = props.namespace || 'DiagComponentLogger';
182
+ }
183
+ debug(...args) {
184
+ return logProxy('debug', this._namespace, args);
185
+ }
186
+ error(...args) {
187
+ return logProxy('error', this._namespace, args);
188
+ }
189
+ info(...args) {
190
+ return logProxy('info', this._namespace, args);
191
+ }
192
+ warn(...args) {
193
+ return logProxy('warn', this._namespace, args);
194
+ }
195
+ verbose(...args) {
196
+ return logProxy('verbose', this._namespace, args);
197
+ }
198
+ }
199
+ function logProxy(funcName, namespace, args) {
200
+ const logger = getGlobal('diag');
201
+ // shortcut if logger not set
202
+ if (!logger) {
203
+ return;
204
+ }
205
+ return logger[funcName](namespace, ...args);
206
+ }
207
+
208
+ /*
209
+ * Copyright The OpenTelemetry Authors
210
+ * SPDX-License-Identifier: Apache-2.0
211
+ */
212
+ /**
213
+ * Defines the available internal logging levels for the diagnostic logger, the numeric values
214
+ * of the levels are defined to match the original values from the initial LogLevel to avoid
215
+ * compatibility/migration issues for any implementation that assume the numeric ordering.
216
+ */
217
+ var DiagLogLevel;
218
+ (function (DiagLogLevel) {
219
+ /** Diagnostic Logging level setting to disable all logging (except and forced logs) */
220
+ DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
221
+ /** Identifies an error scenario */
222
+ DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR";
223
+ /** Identifies a warning scenario */
224
+ DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN";
225
+ /** General informational log message */
226
+ DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO";
227
+ /** General debug log message */
228
+ DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG";
229
+ /**
230
+ * Detailed trace level logging should only be used for development, should only be set
231
+ * in a development environment.
232
+ */
233
+ DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
234
+ /** Used to set the logging level to include all logging */
235
+ DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
236
+ })(DiagLogLevel || (DiagLogLevel = {}));
237
+
238
+ /*
239
+ * Copyright The OpenTelemetry Authors
240
+ * SPDX-License-Identifier: Apache-2.0
241
+ */
242
+ function createLogLevelDiagLogger(maxLevel, logger) {
243
+ if (maxLevel < DiagLogLevel.NONE) {
244
+ maxLevel = DiagLogLevel.NONE;
245
+ }
246
+ else if (maxLevel > DiagLogLevel.ALL) {
247
+ maxLevel = DiagLogLevel.ALL;
248
+ }
249
+ // In case the logger is null or undefined
250
+ logger = logger || {};
251
+ function _filterFunc(funcName, theLevel) {
252
+ const theFunc = logger[funcName];
253
+ if (typeof theFunc === 'function' && maxLevel >= theLevel) {
254
+ return theFunc.bind(logger);
255
+ }
256
+ return function () { };
257
+ }
258
+ return {
259
+ error: _filterFunc('error', DiagLogLevel.ERROR),
260
+ warn: _filterFunc('warn', DiagLogLevel.WARN),
261
+ info: _filterFunc('info', DiagLogLevel.INFO),
262
+ debug: _filterFunc('debug', DiagLogLevel.DEBUG),
263
+ verbose: _filterFunc('verbose', DiagLogLevel.VERBOSE),
264
+ };
265
+ }
266
+
267
+ /*
268
+ * Copyright The OpenTelemetry Authors
269
+ * SPDX-License-Identifier: Apache-2.0
270
+ */
271
+ const API_NAME$2 = 'diag';
272
+ /**
273
+ * Singleton object which represents the entry point to the OpenTelemetry internal
274
+ * diagnostic API
275
+ *
276
+ * @since 1.0.0
277
+ */
278
+ class DiagAPI {
279
+ /** Get the singleton instance of the DiagAPI API */
280
+ static instance() {
281
+ if (!this._instance) {
282
+ this._instance = new DiagAPI();
283
+ }
284
+ return this._instance;
285
+ }
286
+ /**
287
+ * Private internal constructor
288
+ * @private
289
+ */
290
+ constructor() {
291
+ function _logProxy(funcName) {
292
+ return function (...args) {
293
+ const logger = getGlobal('diag');
294
+ // shortcut if logger not set
295
+ if (!logger)
296
+ return;
297
+ return logger[funcName](...args);
298
+ };
299
+ }
300
+ // Using self local variable for minification purposes as 'this' cannot be minified
301
+ const self = this;
302
+ // DiagAPI specific functions
303
+ const setLogger = (logger, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
304
+ var _a, _b, _c;
305
+ if (logger === self) {
306
+ // There isn't much we can do here.
307
+ // Logging to the console might break the user application.
308
+ // Try to log to self. If a logger was previously registered it will receive the log.
309
+ const err = new Error('Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation');
310
+ self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
311
+ return false;
312
+ }
313
+ if (typeof optionsOrLogLevel === 'number') {
314
+ optionsOrLogLevel = {
315
+ logLevel: optionsOrLogLevel,
316
+ };
317
+ }
318
+ const oldLogger = getGlobal('diag');
319
+ const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
320
+ // There already is an logger registered. We'll let it know before overwriting it.
321
+ if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
322
+ const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : '<failed to generate stacktrace>';
323
+ oldLogger.warn(`Current logger will be overwritten from ${stack}`);
324
+ newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
325
+ }
326
+ return registerGlobal('diag', newLogger, self, true);
327
+ };
328
+ self.setLogger = setLogger;
329
+ self.disable = () => {
330
+ unregisterGlobal(API_NAME$2, self);
331
+ };
332
+ self.createComponentLogger = (options) => {
333
+ return new DiagComponentLogger(options);
334
+ };
335
+ self.verbose = _logProxy('verbose');
336
+ self.debug = _logProxy('debug');
337
+ self.info = _logProxy('info');
338
+ self.warn = _logProxy('warn');
339
+ self.error = _logProxy('error');
340
+ }
341
+ }
342
+
343
+ /*
344
+ * Copyright The OpenTelemetry Authors
345
+ * SPDX-License-Identifier: Apache-2.0
346
+ */
347
+ /**
348
+ * Get a key to uniquely identify a context value
349
+ *
350
+ * @since 1.0.0
351
+ */
352
+ function createContextKey(description) {
353
+ // The specification states that for the same input, multiple calls should
354
+ // return different keys. Due to the nature of the JS dependency management
355
+ // system, this creates problems where multiple versions of some package
356
+ // could hold different keys for the same property.
357
+ //
358
+ // Therefore, we use Symbol.for which returns the same key for the same input.
359
+ return Symbol.for(description);
360
+ }
361
+ class BaseContext {
362
+ /**
363
+ * Construct a new context which inherits values from an optional parent context.
364
+ *
365
+ * @param parentContext a context from which to inherit values
366
+ */
367
+ constructor(parentContext) {
368
+ // for minification
369
+ const self = this;
370
+ self._currentContext = parentContext ? new Map(parentContext) : new Map();
371
+ self.getValue = (key) => self._currentContext.get(key);
372
+ self.setValue = (key, value) => {
373
+ const context = new BaseContext(self._currentContext);
374
+ context._currentContext.set(key, value);
375
+ return context;
376
+ };
377
+ self.deleteValue = (key) => {
378
+ const context = new BaseContext(self._currentContext);
379
+ context._currentContext.delete(key);
380
+ return context;
381
+ };
382
+ }
383
+ }
384
+ /**
385
+ * The root context is used as the default parent context when there is no active context
386
+ *
387
+ * @since 1.0.0
388
+ */
389
+ const ROOT_CONTEXT = new BaseContext();
390
+
391
+ /*
392
+ * Copyright The OpenTelemetry Authors
393
+ * SPDX-License-Identifier: Apache-2.0
394
+ */
395
+ /**
396
+ * NoopMeter is a noop implementation of the {@link Meter} interface. It reuses
397
+ * constant NoopMetrics for all of its methods.
398
+ */
399
+ class NoopMeter {
400
+ constructor() { }
401
+ /**
402
+ * @see {@link Meter.createGauge}
403
+ */
404
+ createGauge(_name, _options) {
405
+ return NOOP_GAUGE_METRIC;
406
+ }
407
+ /**
408
+ * @see {@link Meter.createHistogram}
409
+ */
410
+ createHistogram(_name, _options) {
411
+ return NOOP_HISTOGRAM_METRIC;
412
+ }
413
+ /**
414
+ * @see {@link Meter.createCounter}
415
+ */
416
+ createCounter(_name, _options) {
417
+ return NOOP_COUNTER_METRIC;
418
+ }
419
+ /**
420
+ * @see {@link Meter.createUpDownCounter}
421
+ */
422
+ createUpDownCounter(_name, _options) {
423
+ return NOOP_UP_DOWN_COUNTER_METRIC;
424
+ }
425
+ /**
426
+ * @see {@link Meter.createObservableGauge}
427
+ */
428
+ createObservableGauge(_name, _options) {
429
+ return NOOP_OBSERVABLE_GAUGE_METRIC;
430
+ }
431
+ /**
432
+ * @see {@link Meter.createObservableCounter}
433
+ */
434
+ createObservableCounter(_name, _options) {
435
+ return NOOP_OBSERVABLE_COUNTER_METRIC;
436
+ }
437
+ /**
438
+ * @see {@link Meter.createObservableUpDownCounter}
439
+ */
440
+ createObservableUpDownCounter(_name, _options) {
441
+ return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
442
+ }
443
+ /**
444
+ * @see {@link Meter.addBatchObservableCallback}
445
+ */
446
+ addBatchObservableCallback(_callback, _observables) { }
447
+ /**
448
+ * @see {@link Meter.removeBatchObservableCallback}
449
+ */
450
+ removeBatchObservableCallback(_callback) { }
451
+ }
452
+ class NoopMetric {
453
+ }
454
+ class NoopCounterMetric extends NoopMetric {
455
+ add(_value, _attributes) { }
456
+ }
457
+ class NoopUpDownCounterMetric extends NoopMetric {
458
+ add(_value, _attributes) { }
459
+ }
460
+ class NoopGaugeMetric extends NoopMetric {
461
+ record(_value, _attributes) { }
462
+ }
463
+ class NoopHistogramMetric extends NoopMetric {
464
+ record(_value, _attributes) { }
465
+ }
466
+ class NoopObservableMetric {
467
+ addCallback(_callback) { }
468
+ removeCallback(_callback) { }
469
+ }
470
+ class NoopObservableCounterMetric extends NoopObservableMetric {
471
+ }
472
+ class NoopObservableGaugeMetric extends NoopObservableMetric {
473
+ }
474
+ class NoopObservableUpDownCounterMetric extends NoopObservableMetric {
475
+ }
476
+ const NOOP_METER = new NoopMeter();
477
+ // Synchronous instruments
478
+ const NOOP_COUNTER_METRIC = new NoopCounterMetric();
479
+ const NOOP_GAUGE_METRIC = new NoopGaugeMetric();
480
+ const NOOP_HISTOGRAM_METRIC = new NoopHistogramMetric();
481
+ const NOOP_UP_DOWN_COUNTER_METRIC = new NoopUpDownCounterMetric();
482
+ // Asynchronous instruments
483
+ const NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();
484
+ const NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();
485
+ const NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();
486
+ /**
487
+ * Create a no-op Meter
488
+ *
489
+ * @since 1.3.0
490
+ */
491
+ function createNoopMeter() {
492
+ return NOOP_METER;
493
+ }
494
+
495
+ /*
496
+ * Copyright The OpenTelemetry Authors
497
+ * SPDX-License-Identifier: Apache-2.0
498
+ */
499
+ class NoopContextManager {
500
+ active() {
501
+ return ROOT_CONTEXT;
502
+ }
503
+ with(_context, fn, thisArg, ...args) {
504
+ return fn.call(thisArg, ...args);
505
+ }
506
+ bind(_context, target) {
507
+ return target;
508
+ }
509
+ enable() {
510
+ return this;
511
+ }
512
+ disable() {
513
+ return this;
514
+ }
515
+ }
516
+
517
+ /*
518
+ * Copyright The OpenTelemetry Authors
519
+ * SPDX-License-Identifier: Apache-2.0
520
+ */
521
+ const API_NAME$1 = 'context';
522
+ const NOOP_CONTEXT_MANAGER = new NoopContextManager();
523
+ /**
524
+ * Singleton object which represents the entry point to the OpenTelemetry Context API
525
+ *
526
+ * @since 1.0.0
527
+ */
528
+ class ContextAPI {
529
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
530
+ constructor() { }
531
+ /** Get the singleton instance of the Context API */
532
+ static getInstance() {
533
+ if (!this._instance) {
534
+ this._instance = new ContextAPI();
535
+ }
536
+ return this._instance;
537
+ }
538
+ /**
539
+ * Set the current context manager.
540
+ *
541
+ * @returns true if the context manager was successfully registered, else false
542
+ */
543
+ setGlobalContextManager(contextManager) {
544
+ return registerGlobal(API_NAME$1, contextManager, DiagAPI.instance());
545
+ }
546
+ /**
547
+ * Get the currently active context
548
+ */
549
+ active() {
550
+ return this._getContextManager().active();
551
+ }
552
+ /**
553
+ * Execute a function with an active context
554
+ *
555
+ * @param context context to be active during function execution
556
+ * @param fn function to execute in a context
557
+ * @param thisArg optional receiver to be used for calling fn
558
+ * @param args optional arguments forwarded to fn
559
+ */
560
+ with(context, fn, thisArg, ...args) {
561
+ return this._getContextManager().with(context, fn, thisArg, ...args);
562
+ }
563
+ /**
564
+ * Bind a context to a target function or event emitter
565
+ *
566
+ * @param context context to bind to the event emitter or function. Defaults to the currently active context
567
+ * @param target function or event emitter to bind
568
+ */
569
+ bind(context, target) {
570
+ return this._getContextManager().bind(context, target);
571
+ }
572
+ _getContextManager() {
573
+ return getGlobal(API_NAME$1) || NOOP_CONTEXT_MANAGER;
574
+ }
575
+ /** Disable and remove the global context manager */
576
+ disable() {
577
+ this._getContextManager().disable();
578
+ unregisterGlobal(API_NAME$1, DiagAPI.instance());
579
+ }
580
+ }
581
+
582
+ /*
583
+ * Copyright The OpenTelemetry Authors
584
+ * SPDX-License-Identifier: Apache-2.0
585
+ */
586
+ /**
587
+ * @since 1.0.0
588
+ */
589
+ var TraceFlags;
590
+ (function (TraceFlags) {
591
+ /** Represents no flag set. */
592
+ TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
593
+ /** Bit to represent whether trace is sampled in trace flags. */
594
+ TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
595
+ })(TraceFlags || (TraceFlags = {}));
596
+
597
+ /*
598
+ * Copyright The OpenTelemetry Authors
599
+ * SPDX-License-Identifier: Apache-2.0
600
+ */
601
+ /**
602
+ * @since 1.0.0
603
+ */
604
+ const INVALID_SPANID = '0000000000000000';
605
+ /**
606
+ * @since 1.0.0
607
+ */
608
+ const INVALID_TRACEID = '00000000000000000000000000000000';
609
+ /**
610
+ * @since 1.0.0
611
+ */
612
+ const INVALID_SPAN_CONTEXT = {
613
+ traceId: INVALID_TRACEID,
614
+ spanId: INVALID_SPANID,
615
+ traceFlags: TraceFlags.NONE,
616
+ };
617
+
618
+ /*
619
+ * Copyright The OpenTelemetry Authors
620
+ * SPDX-License-Identifier: Apache-2.0
621
+ */
622
+ /**
623
+ * The NonRecordingSpan is the default {@link Span} that is used when no Span
624
+ * implementation is available. All operations are no-op including context
625
+ * propagation.
626
+ */
627
+ class NonRecordingSpan {
628
+ constructor(spanContext = INVALID_SPAN_CONTEXT) {
629
+ this._spanContext = spanContext;
630
+ }
631
+ // Returns a SpanContext.
632
+ spanContext() {
633
+ return this._spanContext;
634
+ }
635
+ // By default does nothing
636
+ setAttribute(_key, _value) {
637
+ return this;
638
+ }
639
+ // By default does nothing
640
+ setAttributes(_attributes) {
641
+ return this;
642
+ }
643
+ // By default does nothing
644
+ addEvent(_name, _attributes) {
645
+ return this;
646
+ }
647
+ addLink(_link) {
648
+ return this;
649
+ }
650
+ addLinks(_links) {
651
+ return this;
652
+ }
653
+ // By default does nothing
654
+ setStatus(_status) {
655
+ return this;
656
+ }
657
+ // By default does nothing
658
+ updateName(_name) {
659
+ return this;
660
+ }
661
+ // By default does nothing
662
+ end(_endTime) { }
663
+ // isRecording always returns false for NonRecordingSpan.
664
+ isRecording() {
665
+ return false;
666
+ }
667
+ // By default does nothing
668
+ recordException(_exception, _time) { }
669
+ }
670
+
671
+ /*
672
+ * Copyright The OpenTelemetry Authors
673
+ * SPDX-License-Identifier: Apache-2.0
674
+ */
675
+ /**
676
+ * span key
677
+ */
678
+ const SPAN_KEY = createContextKey('OpenTelemetry Context Key SPAN');
679
+ /**
680
+ * Return the span if one exists
681
+ *
682
+ * @param context context to get span from
683
+ */
684
+ function getSpan(context) {
685
+ return context.getValue(SPAN_KEY) || undefined;
686
+ }
687
+ /**
688
+ * Gets the span from the current context, if one exists.
689
+ */
690
+ function getActiveSpan() {
691
+ return getSpan(ContextAPI.getInstance().active());
692
+ }
693
+ /**
694
+ * Set the span on a context
695
+ *
696
+ * @param context context to use as parent
697
+ * @param span span to set active
698
+ */
699
+ function setSpan(context, span) {
700
+ return context.setValue(SPAN_KEY, span);
701
+ }
702
+ /**
703
+ * Remove current span stored in the context
704
+ *
705
+ * @param context context to delete span from
706
+ */
707
+ function deleteSpan(context) {
708
+ return context.deleteValue(SPAN_KEY);
709
+ }
710
+ /**
711
+ * Wrap span context in a NoopSpan and set as span in a new
712
+ * context
713
+ *
714
+ * @param context context to set active span on
715
+ * @param spanContext span context to be wrapped
716
+ */
717
+ function setSpanContext(context, spanContext) {
718
+ return setSpan(context, new NonRecordingSpan(spanContext));
719
+ }
720
+ /**
721
+ * Get the span context of the span if it exists.
722
+ *
723
+ * @param context context to get values from
724
+ */
725
+ function getSpanContext(context) {
726
+ var _a;
727
+ return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext();
728
+ }
729
+
730
+ /*
731
+ * Copyright The OpenTelemetry Authors
732
+ * SPDX-License-Identifier: Apache-2.0
733
+ */
734
+ // Valid characters (0-9, a-f, A-F) are marked as 1.
735
+ const isHex = new Uint8Array([
736
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
737
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
738
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
739
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
740
+ ]);
741
+ function isValidHex(id, length) {
742
+ // As of 1.9.0 the id was allowed to be a non-string value,
743
+ // even though it was not possible in the types.
744
+ if (typeof id !== 'string' || id.length !== length)
745
+ return false;
746
+ let r = 0;
747
+ for (let i = 0; i < id.length; i += 4) {
748
+ r +=
749
+ (isHex[id.charCodeAt(i)] | 0) +
750
+ (isHex[id.charCodeAt(i + 1)] | 0) +
751
+ (isHex[id.charCodeAt(i + 2)] | 0) +
752
+ (isHex[id.charCodeAt(i + 3)] | 0);
753
+ }
754
+ return r === length;
755
+ }
756
+ /**
757
+ * @since 1.0.0
758
+ */
759
+ function isValidTraceId(traceId) {
760
+ return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;
761
+ }
762
+ /**
763
+ * @since 1.0.0
764
+ */
765
+ function isValidSpanId(spanId) {
766
+ return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;
767
+ }
768
+ /**
769
+ * Returns true if this {@link SpanContext} is valid.
770
+ * @return true if this {@link SpanContext} is valid.
771
+ *
772
+ * @since 1.0.0
773
+ */
774
+ function isSpanContextValid(spanContext) {
775
+ return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId));
776
+ }
777
+ /**
778
+ * Wrap the given {@link SpanContext} in a new non-recording {@link Span}
779
+ *
780
+ * @param spanContext span context to be wrapped
781
+ * @returns a new non-recording {@link Span} with the provided context
782
+ */
783
+ function wrapSpanContext(spanContext) {
784
+ return new NonRecordingSpan(spanContext);
785
+ }
786
+
787
+ /*
788
+ * Copyright The OpenTelemetry Authors
789
+ * SPDX-License-Identifier: Apache-2.0
790
+ */
791
+ const contextApi = ContextAPI.getInstance();
792
+ /**
793
+ * No-op implementations of {@link Tracer}.
794
+ */
795
+ class NoopTracer {
796
+ // startSpan starts a noop span.
797
+ startSpan(name, options, context = contextApi.active()) {
798
+ const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
799
+ if (root) {
800
+ return new NonRecordingSpan();
801
+ }
802
+ const parentFromContext = context && getSpanContext(context);
803
+ if (isSpanContext(parentFromContext) &&
804
+ isSpanContextValid(parentFromContext)) {
805
+ return new NonRecordingSpan(parentFromContext);
806
+ }
807
+ else {
808
+ return new NonRecordingSpan();
809
+ }
810
+ }
811
+ startActiveSpan(name, arg2, arg3, arg4) {
812
+ let opts;
813
+ let ctx;
814
+ let fn;
815
+ if (arguments.length < 2) {
816
+ return;
817
+ }
818
+ else if (arguments.length === 2) {
819
+ fn = arg2;
820
+ }
821
+ else if (arguments.length === 3) {
822
+ opts = arg2;
823
+ fn = arg3;
824
+ }
825
+ else {
826
+ opts = arg2;
827
+ ctx = arg3;
828
+ fn = arg4;
829
+ }
830
+ const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
831
+ const span = this.startSpan(name, opts, parentContext);
832
+ const contextWithSpanSet = setSpan(parentContext, span);
833
+ return contextApi.with(contextWithSpanSet, fn, undefined, span);
834
+ }
835
+ }
836
+ function isSpanContext(spanContext) {
837
+ return (spanContext !== null &&
838
+ typeof spanContext === 'object' &&
839
+ 'spanId' in spanContext &&
840
+ typeof spanContext['spanId'] === 'string' &&
841
+ 'traceId' in spanContext &&
842
+ typeof spanContext['traceId'] === 'string' &&
843
+ 'traceFlags' in spanContext &&
844
+ typeof spanContext['traceFlags'] === 'number');
845
+ }
846
+
847
+ /*
848
+ * Copyright The OpenTelemetry Authors
849
+ * SPDX-License-Identifier: Apache-2.0
850
+ */
851
+ const NOOP_TRACER = new NoopTracer();
852
+ /**
853
+ * Proxy tracer provided by the proxy tracer provider
854
+ *
855
+ * @since 1.0.0
856
+ */
857
+ class ProxyTracer {
858
+ constructor(provider, name, version, options) {
859
+ this._provider = provider;
860
+ this.name = name;
861
+ this.version = version;
862
+ this.options = options;
863
+ }
864
+ startSpan(name, options, context) {
865
+ return this._getTracer().startSpan(name, options, context);
866
+ }
867
+ startActiveSpan(_name, _options, _context, _fn) {
868
+ const tracer = this._getTracer();
869
+ return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
870
+ }
871
+ /**
872
+ * Try to get a tracer from the proxy tracer provider.
873
+ * If the proxy tracer provider has no delegate, return a noop tracer.
874
+ */
875
+ _getTracer() {
876
+ if (this._delegate) {
877
+ return this._delegate;
878
+ }
879
+ const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
880
+ if (!tracer) {
881
+ return NOOP_TRACER;
882
+ }
883
+ this._delegate = tracer;
884
+ return this._delegate;
885
+ }
886
+ }
887
+
888
+ /*
889
+ * Copyright The OpenTelemetry Authors
890
+ * SPDX-License-Identifier: Apache-2.0
891
+ */
892
+ /**
893
+ * An implementation of the {@link TracerProvider} which returns an impotent
894
+ * Tracer for all calls to `getTracer`.
895
+ *
896
+ * All operations are no-op.
897
+ */
898
+ class NoopTracerProvider {
899
+ getTracer(_name, _version, _options) {
900
+ return new NoopTracer();
901
+ }
902
+ }
903
+
904
+ /*
905
+ * Copyright The OpenTelemetry Authors
906
+ * SPDX-License-Identifier: Apache-2.0
907
+ */
908
+ const NOOP_TRACER_PROVIDER = new NoopTracerProvider();
909
+ /**
910
+ * Tracer provider which provides {@link ProxyTracer}s.
911
+ *
912
+ * Before a delegate is set, tracers provided are NoOp.
913
+ * When a delegate is set, traces are provided from the delegate.
914
+ * When a delegate is set after tracers have already been provided,
915
+ * all tracers already provided will use the provided delegate implementation.
916
+ *
917
+ * @deprecated This will be removed in the next major version.
918
+ * @since 1.0.0
919
+ */
920
+ class ProxyTracerProvider {
921
+ /**
922
+ * Get a {@link ProxyTracer}
923
+ */
924
+ getTracer(name, version, options) {
925
+ var _a;
926
+ return ((_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options));
927
+ }
928
+ getDelegate() {
929
+ var _a;
930
+ return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;
931
+ }
932
+ /**
933
+ * Set the delegate tracer provider
934
+ */
935
+ setDelegate(delegate) {
936
+ this._delegate = delegate;
937
+ }
938
+ getDelegateTracer(name, version, options) {
939
+ var _a;
940
+ return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
941
+ }
942
+ }
943
+
944
+ /*
945
+ * Copyright The OpenTelemetry Authors
946
+ * SPDX-License-Identifier: Apache-2.0
947
+ */
948
+ // Split module-level variable definition into separate files to allow
949
+ // tree-shaking on each api instance.
950
+ /**
951
+ * Entrypoint for context API
952
+ * @since 1.0.0
953
+ */
954
+ const context = ContextAPI.getInstance();
955
+
956
+ /*
957
+ * Copyright The OpenTelemetry Authors
958
+ * SPDX-License-Identifier: Apache-2.0
959
+ */
960
+ // Split module-level variable definition into separate files to allow
961
+ // tree-shaking on each api instance.
962
+ /**
963
+ * Entrypoint for Diag API.
964
+ * Defines Diagnostic handler used for internal diagnostic logging operations.
965
+ * The default provides a Noop DiagLogger implementation which may be changed via the
966
+ * diag.setLogger(logger: DiagLogger) function.
967
+ *
968
+ * @since 1.0.0
969
+ */
970
+ const diag = DiagAPI.instance();
971
+
972
+ /*
973
+ * Copyright The OpenTelemetry Authors
974
+ * SPDX-License-Identifier: Apache-2.0
975
+ */
976
+ const API_NAME = 'trace';
977
+ /**
978
+ * Singleton object which represents the entry point to the OpenTelemetry Tracing API
979
+ *
980
+ * @since 1.0.0
981
+ */
982
+ class TraceAPI {
983
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
984
+ constructor() {
985
+ this._proxyTracerProvider = new ProxyTracerProvider();
986
+ this.wrapSpanContext = wrapSpanContext;
987
+ this.isSpanContextValid = isSpanContextValid;
988
+ this.deleteSpan = deleteSpan;
989
+ this.getSpan = getSpan;
990
+ this.getActiveSpan = getActiveSpan;
991
+ this.getSpanContext = getSpanContext;
992
+ this.setSpan = setSpan;
993
+ this.setSpanContext = setSpanContext;
994
+ }
995
+ /** Get the singleton instance of the Trace API */
996
+ static getInstance() {
997
+ if (!this._instance) {
998
+ this._instance = new TraceAPI();
999
+ }
1000
+ return this._instance;
1001
+ }
1002
+ /**
1003
+ * Set the current global tracer.
1004
+ *
1005
+ * @returns true if the tracer provider was successfully registered, else false
1006
+ */
1007
+ setGlobalTracerProvider(provider) {
1008
+ const success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());
1009
+ if (success) {
1010
+ this._proxyTracerProvider.setDelegate(provider);
1011
+ }
1012
+ return success;
1013
+ }
1014
+ /**
1015
+ * Returns the global tracer provider.
1016
+ */
1017
+ getTracerProvider() {
1018
+ return getGlobal(API_NAME) || this._proxyTracerProvider;
1019
+ }
1020
+ /**
1021
+ * Returns a tracer from the global tracer provider.
1022
+ */
1023
+ getTracer(name, version) {
1024
+ return this.getTracerProvider().getTracer(name, version);
1025
+ }
1026
+ /** Remove the global tracer provider */
1027
+ disable() {
1028
+ unregisterGlobal(API_NAME, DiagAPI.instance());
1029
+ this._proxyTracerProvider = new ProxyTracerProvider();
1030
+ }
1031
+ }
1032
+
1033
+ /*
1034
+ * Copyright The OpenTelemetry Authors
1035
+ * SPDX-License-Identifier: Apache-2.0
1036
+ */
1037
+ // Split module-level variable definition into separate files to allow
1038
+ // tree-shaking on each api instance.
1039
+ /**
1040
+ * Entrypoint for trace API
1041
+ *
1042
+ * @since 1.0.0
1043
+ */
1044
+ const trace = TraceAPI.getInstance();
1045
+
1046
+ /*
1047
+ * Copyright The OpenTelemetry Authors
1048
+ * SPDX-License-Identifier: Apache-2.0
1049
+ */
1050
+ const SUPPRESS_TRACING_KEY = createContextKey('OpenTelemetry SDK Context Key SUPPRESS_TRACING');
1051
+ function suppressTracing(context) {
1052
+ return context.setValue(SUPPRESS_TRACING_KEY, true);
1053
+ }
1054
+ function isTracingSuppressed(context) {
1055
+ return context.getValue(SUPPRESS_TRACING_KEY) === true;
1056
+ }
1057
+
1058
+ /*
1059
+ * Copyright The OpenTelemetry Authors
1060
+ * SPDX-License-Identifier: Apache-2.0
1061
+ */
1062
+ /**
1063
+ * Returns a function that logs an error using the provided logger, or a
1064
+ * console logger if one was not provided.
1065
+ */
1066
+ function loggingErrorHandler() {
1067
+ return (ex) => {
1068
+ diag.error(stringifyException(ex));
1069
+ };
1070
+ }
1071
+ /**
1072
+ * Converts an exception into a string representation
1073
+ * @param {Exception} ex
1074
+ */
1075
+ function stringifyException(ex) {
1076
+ if (typeof ex === 'string') {
1077
+ return ex;
1078
+ }
1079
+ else {
1080
+ return JSON.stringify(flattenException(ex));
1081
+ }
1082
+ }
1083
+ /**
1084
+ * Flattens an exception into key-value pairs by traversing the prototype chain
1085
+ * and coercing values to strings. Duplicate properties will not be overwritten;
1086
+ * the first insert wins.
1087
+ */
1088
+ function flattenException(ex) {
1089
+ const result = {};
1090
+ let current = ex;
1091
+ while (current !== null) {
1092
+ Object.getOwnPropertyNames(current).forEach(propertyName => {
1093
+ if (result[propertyName])
1094
+ return;
1095
+ const value = current[propertyName];
1096
+ if (value) {
1097
+ result[propertyName] = String(value);
1098
+ }
1099
+ });
1100
+ current = Object.getPrototypeOf(current);
1101
+ }
1102
+ return result;
1103
+ }
1104
+
1105
+ /*
1106
+ * Copyright The OpenTelemetry Authors
1107
+ * SPDX-License-Identifier: Apache-2.0
1108
+ */
1109
+ /** The global error handler delegate */
1110
+ let delegateHandler = loggingErrorHandler();
1111
+ /**
1112
+ * Return the global error handler
1113
+ * @param {Exception} ex
1114
+ */
1115
+ function globalErrorHandler(ex) {
1116
+ try {
1117
+ delegateHandler(ex);
1118
+ }
1119
+ catch { } // eslint-disable-line no-empty
1120
+ }
1121
+
1122
+ /*
1123
+ * Copyright The OpenTelemetry Authors
1124
+ * SPDX-License-Identifier: Apache-2.0
1125
+ */
1126
+ // this is autogenerated file, see scripts/version-update.js
1127
+ const VERSION$1 = '2.11.0';
1128
+
1129
+ /*
1130
+ * Copyright The OpenTelemetry Authors
1131
+ *
1132
+ * Licensed under the Apache License, Version 2.0 (the "License");
1133
+ * you may not use this file except in compliance with the License.
1134
+ * You may obtain a copy of the License at
1135
+ *
1136
+ * https://www.apache.org/licenses/LICENSE-2.0
1137
+ *
1138
+ * Unless required by applicable law or agreed to in writing, software
1139
+ * distributed under the License is distributed on an "AS IS" BASIS,
1140
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1141
+ * See the License for the specific language governing permissions and
1142
+ * limitations under the License.
1143
+ */
1144
+ //----------------------------------------------------------------------------------------------------------
1145
+ // DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/stable/attributes.ts.j2
1146
+ //----------------------------------------------------------------------------------------------------------
1147
+ /**
1148
+ * ASP.NET Core exception middleware handling result.
1149
+ *
1150
+ * @example handled
1151
+ * @example unhandled
1152
+ */
1153
+ /**
1154
+ * Describes a class of error the operation ended with.
1155
+ *
1156
+ * @example timeout
1157
+ * @example java.net.UnknownHostException
1158
+ * @example server_certificate_invalid
1159
+ * @example 500
1160
+ *
1161
+ * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
1162
+ *
1163
+ * When `error.type` is set to a type (e.g., an exception type), its
1164
+ * canonical class name identifying the type within the artifact **SHOULD** be used.
1165
+ *
1166
+ * Instrumentations **SHOULD** document the list of errors they report.
1167
+ *
1168
+ * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
1169
+ * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
1170
+ * should be prepared for `error.type` to have high cardinality at query time when no
1171
+ * additional filters are applied.
1172
+ *
1173
+ * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
1174
+ *
1175
+ * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
1176
+ * it's **RECOMMENDED** to:
1177
+ *
1178
+ * - Use a domain-specific attribute
1179
+ * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
1180
+ */
1181
+ const ATTR_ERROR_TYPE$2 = 'error.type';
1182
+ /**
1183
+ * The exception message.
1184
+ *
1185
+ * @example Division by zero
1186
+ * @example Can't convert 'int' object to str implicitly
1187
+ *
1188
+ * @note > [!WARNING]
1189
+ *
1190
+ * > This attribute may contain sensitive information.
1191
+ */
1192
+ const ATTR_EXCEPTION_MESSAGE$1 = 'exception.message';
1193
+ /**
1194
+ * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.
1195
+ *
1196
+ * @example "Exception in thread "main" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\n"
1197
+ */
1198
+ const ATTR_EXCEPTION_STACKTRACE$1 = 'exception.stacktrace';
1199
+ /**
1200
+ * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.
1201
+ *
1202
+ * @example java.net.ConnectException
1203
+ * @example OSError
1204
+ */
1205
+ const ATTR_EXCEPTION_TYPE$1 = 'exception.type';
1206
+ /**
1207
+ * HTTP request method.
1208
+ *
1209
+ * @example GET
1210
+ * @example POST
1211
+ * @example HEAD
1212
+ *
1213
+ * @note HTTP request method value **SHOULD** be "known" to the instrumentation.
1214
+ * By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods),
1215
+ * the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html)
1216
+ * and the QUERY method defined in [httpbis-safe-method-w-body](https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/?include_text=1).
1217
+ *
1218
+ * If the HTTP request method is not known to instrumentation, it **MUST** set the `http.request.method` attribute to `_OTHER`.
1219
+ *
1220
+ * If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it **MUST** provide a way to override
1221
+ * the list of known HTTP methods. If this override is done via environment variable, then the environment variable **MUST** be named
1222
+ * OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods.
1223
+ *
1224
+ *
1225
+ * If this override is done via declarative configuration, then the list **MUST** be configurable via the `known_methods` property
1226
+ * (an array of case-sensitive strings with minimum items 0) under `.instrumentation/development.general.http.client` and/or
1227
+ * `.instrumentation/development.general.http.server`.
1228
+ *
1229
+ * In either case, this list **MUST** be a full override of the default known methods,
1230
+ * it is not a list of known methods in addition to the defaults.
1231
+ *
1232
+ * HTTP method names are case-sensitive and `http.request.method` attribute value **MUST** match a known HTTP method name exactly.
1233
+ * Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, **SHOULD** populate a canonical equivalent.
1234
+ * Tracing instrumentations that do so, **MUST** also set `http.request.method_original` to the original value.
1235
+ */
1236
+ const ATTR_HTTP_REQUEST_METHOD = 'http.request.method';
1237
+ /**
1238
+ * Original HTTP method sent by the client in the request line.
1239
+ *
1240
+ * @example GeT
1241
+ * @example ACL
1242
+ * @example foo
1243
+ */
1244
+ const ATTR_HTTP_REQUEST_METHOD_ORIGINAL = 'http.request.method_original';
1245
+ /**
1246
+ * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
1247
+ *
1248
+ * @example 200
1249
+ */
1250
+ const ATTR_HTTP_RESPONSE_STATUS_CODE$1 = 'http.response.status_code';
1251
+ /**
1252
+ * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
1253
+ *
1254
+ * @example example.com
1255
+ * @example 10.1.2.80
1256
+ * @example /tmp/my.sock
1257
+ *
1258
+ * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.
1259
+ */
1260
+ const ATTR_SERVER_ADDRESS$1 = 'server.address';
1261
+ /**
1262
+ * Server port number.
1263
+ *
1264
+ * @example 80
1265
+ * @example 8080
1266
+ * @example 443
1267
+ *
1268
+ * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.
1269
+ */
1270
+ const ATTR_SERVER_PORT$1 = 'server.port';
1271
+ /**
1272
+ * The language of the telemetry SDK.
1273
+ */
1274
+ const ATTR_TELEMETRY_SDK_LANGUAGE$1 = 'telemetry.sdk.language';
1275
+ /**
1276
+ * Enum value "webjs" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}.
1277
+ */
1278
+ const TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS = "webjs";
1279
+ /**
1280
+ * The name of the telemetry SDK as defined above.
1281
+ *
1282
+ * @example opentelemetry
1283
+ *
1284
+ * @note The OpenTelemetry SDK **MUST** set the `telemetry.sdk.name` attribute to `opentelemetry`.
1285
+ * If another SDK, like a fork or a vendor-provided implementation, is used, this SDK **MUST** set the
1286
+ * `telemetry.sdk.name` attribute to the fully-qualified class or module name of this SDK's main entry point
1287
+ * or another suitable identifier depending on the language.
1288
+ * The identifier `opentelemetry` is reserved and **MUST NOT** be used in this case.
1289
+ * All custom identifiers **SHOULD** be stable across different versions of an implementation.
1290
+ */
1291
+ const ATTR_TELEMETRY_SDK_NAME$1 = 'telemetry.sdk.name';
1292
+ /**
1293
+ * The version string of the telemetry SDK.
1294
+ *
1295
+ * @example 1.2.3
1296
+ */
1297
+ const ATTR_TELEMETRY_SDK_VERSION$1 = 'telemetry.sdk.version';
1298
+ /**
1299
+ * Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)
1300
+ *
1301
+ * @example https://www.foo.bar/search?q=OpenTelemetry#SemConv
1302
+ * @example //localhost
1303
+ *
1304
+ * @note For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment
1305
+ * is not transmitted over HTTP, but if it is known, it **SHOULD** be included nevertheless.
1306
+ *
1307
+ * `url.full` **MUST NOT** contain credentials passed via URL in form of `https://username:password@www.example.com/`.
1308
+ * In such case username and password **SHOULD** be redacted and attribute's value **SHOULD** be `https://REDACTED:REDACTED@www.example.com/`.
1309
+ *
1310
+ * `url.full` **SHOULD** capture the absolute URL when it is available (or can be reconstructed).
1311
+ *
1312
+ * Sensitive content provided in `url.full` **SHOULD** be scrubbed when instrumentations can identify it.
1313
+ *
1314
+ *
1315
+ * Query string values for the following keys **SHOULD** be redacted by default and replaced by the
1316
+ * value `REDACTED`:
1317
+ *
1318
+ * - [`AWSAccessKeyId`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)
1319
+ * - [`Signature`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth)
1320
+ * - [`sig`](https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token)
1321
+ * - [`X-Goog-Signature`](https://cloud.google.com/storage/docs/access-control/signed-urls)
1322
+ *
1323
+ * This list is subject to change over time.
1324
+ *
1325
+ * Matching of query parameter keys against the sensitive list **SHOULD** be case-sensitive.
1326
+ *
1327
+ *
1328
+ * Instrumentation **MAY** provide a way to override this list via declarative configuration.
1329
+ * If so, it **SHOULD** use the `sensitive_query_parameters` property
1330
+ * (an array of case-sensitive strings with minimum items 0) under
1331
+ * `.instrumentation/development.general.sanitization.url`.
1332
+ * This list is a full override of the default sensitive query parameter keys,
1333
+ * it is not a list of keys in addition to the defaults.
1334
+ *
1335
+ * When a query string value is redacted, the query string key **SHOULD** still be preserved, e.g.
1336
+ * `https://www.example.com/path?color=blue&sig=REDACTED`.
1337
+ */
1338
+ const ATTR_URL_FULL = 'url.full';
1339
+ /**
1340
+ * Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.
1341
+ *
1342
+ * @example CERN-LineMode/2.15 libwww/2.17b3
1343
+ * @example Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1
1344
+ * @example YourApp/1.0.0 grpc-java-okhttp/1.27.2
1345
+ */
1346
+ const ATTR_USER_AGENT_ORIGINAL = 'user_agent.original';
1347
+
1348
+ /*
1349
+ * Copyright The OpenTelemetry Authors
1350
+ * SPDX-License-Identifier: Apache-2.0
1351
+ */
1352
+ /*
1353
+ * This file contains a copy of unstable semantic convention definitions
1354
+ * used by this package.
1355
+ * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
1356
+ */
1357
+ /**
1358
+ * The name of the runtime of this process.
1359
+ *
1360
+ * @example OpenJDK Runtime Environment
1361
+ *
1362
+ * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
1363
+ */
1364
+ const ATTR_PROCESS_RUNTIME_NAME = 'process.runtime.name';
1365
+
1366
+ /*
1367
+ * Copyright The OpenTelemetry Authors
1368
+ * SPDX-License-Identifier: Apache-2.0
1369
+ */
1370
+ /** Constants describing the SDK in use */
1371
+ const SDK_INFO = {
1372
+ [ATTR_TELEMETRY_SDK_NAME$1]: 'opentelemetry',
1373
+ [ATTR_PROCESS_RUNTIME_NAME]: 'browser',
1374
+ [ATTR_TELEMETRY_SDK_LANGUAGE$1]: TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS,
1375
+ [ATTR_TELEMETRY_SDK_VERSION$1]: VERSION$1,
1376
+ };
1377
+
1378
+ /*
1379
+ * Copyright The OpenTelemetry Authors
1380
+ * SPDX-License-Identifier: Apache-2.0
1381
+ */
1382
+ /**
1383
+ * @deprecated Use performance directly.
1384
+ */
1385
+ const otperformance = performance;
1386
+
1387
+ /*
1388
+ * Copyright The OpenTelemetry Authors
1389
+ * SPDX-License-Identifier: Apache-2.0
1390
+ */
1391
+ const NANOSECOND_DIGITS = 9;
1392
+ const NANOSECOND_DIGITS_IN_MILLIS = 6;
1393
+ const MILLISECONDS_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS_IN_MILLIS);
1394
+ const SECOND_TO_NANOSECONDS = Math.pow(10, NANOSECOND_DIGITS);
1395
+ /**
1396
+ * Converts a number of milliseconds from epoch to HrTime([seconds, remainder in nanoseconds]).
1397
+ * @param epochMillis
1398
+ */
1399
+ function millisToHrTime(epochMillis) {
1400
+ const epochSeconds = epochMillis / 1000;
1401
+ // Decimals only.
1402
+ const seconds = Math.trunc(epochSeconds);
1403
+ // Round sub-nanosecond accuracy to nanosecond.
1404
+ const nanos = Math.round((epochMillis % 1000) * MILLISECONDS_TO_NANOSECONDS);
1405
+ return [seconds, nanos];
1406
+ }
1407
+ /**
1408
+ * Returns an hrtime calculated via performance component.
1409
+ * @param performanceNow
1410
+ */
1411
+ function hrTime(performanceNow) {
1412
+ const timeOrigin = millisToHrTime(otperformance.timeOrigin);
1413
+ const now = millisToHrTime(typeof performanceNow === 'number' ? performanceNow : otperformance.now());
1414
+ return addHrTimes(timeOrigin, now);
1415
+ }
1416
+ /**
1417
+ *
1418
+ * Converts a TimeInput to an HrTime, defaults to _hrtime().
1419
+ * @param time
1420
+ */
1421
+ function timeInputToHrTime(time) {
1422
+ // process.hrtime
1423
+ if (isTimeInputHrTime(time)) {
1424
+ return time;
1425
+ }
1426
+ else if (typeof time === 'number') {
1427
+ // Distinguish between a relative performance.now() value and an absolute
1428
+ // epoch-millisecond timestamp.
1429
+ //
1430
+ // performance.timeOrigin uses a monotonic clock that may be slightly ahead
1431
+ // of Date.now() due to clock adjustments (see MDN docs). This means a
1432
+ // real epoch-ms value (e.g. Date.now()) can land just below
1433
+ // performance.timeOrigin, causing it to be misclassified as a relative
1434
+ // performance.now() reading and doubled when timeOrigin is added.
1435
+ //
1436
+ // A genuine performance.now() value represents elapsed time since the
1437
+ // document/process started, so it is bounded by system uptime. No real
1438
+ // system has been running long enough for performance.now() to reach half
1439
+ // the current epoch time (~1994 in ms terms). We therefore treat any value
1440
+ // below half of performance.timeOrigin as a relative performance.now()
1441
+ // reading, and everything else as an absolute epoch-millisecond timestamp.
1442
+ if (time < otperformance.timeOrigin / 2) {
1443
+ return hrTime(time);
1444
+ }
1445
+ else {
1446
+ // epoch milliseconds or performance.timeOrigin
1447
+ return millisToHrTime(time);
1448
+ }
1449
+ }
1450
+ else if (time instanceof Date) {
1451
+ return millisToHrTime(time.getTime());
1452
+ }
1453
+ else {
1454
+ throw TypeError('Invalid input type');
1455
+ }
1456
+ }
1457
+ /**
1458
+ * Returns a duration of two hrTime.
1459
+ * @param startTime
1460
+ * @param endTime
1461
+ */
1462
+ function hrTimeDuration(startTime, endTime) {
1463
+ let seconds = endTime[0] - startTime[0];
1464
+ let nanos = endTime[1] - startTime[1];
1465
+ // overflow
1466
+ if (nanos < 0) {
1467
+ seconds -= 1;
1468
+ // negate
1469
+ nanos += SECOND_TO_NANOSECONDS;
1470
+ }
1471
+ return [seconds, nanos];
1472
+ }
1473
+ /**
1474
+ * Convert hrTime to nanoseconds.
1475
+ * @param time
1476
+ */
1477
+ function hrTimeToNanoseconds(time) {
1478
+ return time[0] * SECOND_TO_NANOSECONDS + time[1];
1479
+ }
1480
+ /**
1481
+ * Convert hrTime to milliseconds.
1482
+ * @param time
1483
+ */
1484
+ function hrTimeToMilliseconds(time) {
1485
+ return time[0] * 1e3 + time[1] / 1e6;
1486
+ }
1487
+ /**
1488
+ * check if time is HrTime
1489
+ * @param value
1490
+ */
1491
+ function isTimeInputHrTime(value) {
1492
+ return (Array.isArray(value) &&
1493
+ value.length === 2 &&
1494
+ typeof value[0] === 'number' &&
1495
+ typeof value[1] === 'number');
1496
+ }
1497
+ /**
1498
+ * check if input value is a correct types.TimeInput
1499
+ * @param value
1500
+ */
1501
+ function isTimeInput(value) {
1502
+ return (isTimeInputHrTime(value) ||
1503
+ typeof value === 'number' ||
1504
+ value instanceof Date);
1505
+ }
1506
+ /**
1507
+ * Given 2 HrTime formatted times, return their sum as an HrTime.
1508
+ */
1509
+ function addHrTimes(time1, time2) {
1510
+ const out = [time1[0] + time2[0], time1[1] + time2[1]];
1511
+ // Nanoseconds
1512
+ if (out[1] >= SECOND_TO_NANOSECONDS) {
1513
+ out[1] -= SECOND_TO_NANOSECONDS;
1514
+ out[0] += 1;
1515
+ }
1516
+ return out;
1517
+ }
1518
+
1519
+ /*
1520
+ * Copyright The OpenTelemetry Authors
1521
+ * SPDX-License-Identifier: Apache-2.0
1522
+ */
1523
+ var ExportResultCode;
1524
+ (function (ExportResultCode) {
1525
+ ExportResultCode[ExportResultCode["SUCCESS"] = 0] = "SUCCESS";
1526
+ ExportResultCode[ExportResultCode["FAILED"] = 1] = "FAILED";
1527
+ })(ExportResultCode || (ExportResultCode = {}));
1528
+
1529
+ /*
1530
+ * Copyright The OpenTelemetry Authors
1531
+ * SPDX-License-Identifier: Apache-2.0
1532
+ */
1533
+ class Deferred {
1534
+ _promise;
1535
+ _resolve;
1536
+ _reject;
1537
+ constructor() {
1538
+ this._promise = new Promise((resolve, reject) => {
1539
+ this._resolve = resolve;
1540
+ this._reject = reject;
1541
+ });
1542
+ }
1543
+ get promise() {
1544
+ return this._promise;
1545
+ }
1546
+ resolve(val) {
1547
+ this._resolve(val);
1548
+ }
1549
+ reject(err) {
1550
+ this._reject(err);
1551
+ }
1552
+ }
1553
+
1554
+ /*
1555
+ * Copyright The OpenTelemetry Authors
1556
+ * SPDX-License-Identifier: Apache-2.0
1557
+ */
1558
+ /**
1559
+ * Bind the callback and only invoke the callback once regardless how many times `BindOnceFuture.call` is invoked.
1560
+ */
1561
+ class BindOnceFuture {
1562
+ _isCalled = false;
1563
+ _deferred = new Deferred();
1564
+ _callback;
1565
+ _that;
1566
+ constructor(callback, that) {
1567
+ this._callback = callback;
1568
+ this._that = that;
1569
+ }
1570
+ get isCalled() {
1571
+ return this._isCalled;
1572
+ }
1573
+ get promise() {
1574
+ return this._deferred.promise;
1575
+ }
1576
+ call(...args) {
1577
+ if (!this._isCalled) {
1578
+ this._isCalled = true;
1579
+ try {
1580
+ Promise.resolve(this._callback.call(this._that, ...args)).then(val => this._deferred.resolve(val), err => this._deferred.reject(err));
1581
+ }
1582
+ catch (err) {
1583
+ this._deferred.reject(err);
1584
+ }
1585
+ }
1586
+ return this._deferred.promise;
1587
+ }
1588
+ }
1589
+
1590
+ /*
1591
+ * Copyright The OpenTelemetry Authors
1592
+ * SPDX-License-Identifier: Apache-2.0
1593
+ */
1594
+ class OTLPExporterBase {
1595
+ _delegate;
1596
+ constructor(delegate) {
1597
+ this._delegate = delegate;
1598
+ }
1599
+ /**
1600
+ * Export items.
1601
+ * @param items
1602
+ * @param resultCallback
1603
+ */
1604
+ export(items, resultCallback) {
1605
+ this._delegate.export(items, resultCallback);
1606
+ }
1607
+ forceFlush() {
1608
+ return this._delegate.forceFlush();
1609
+ }
1610
+ shutdown() {
1611
+ return this._delegate.shutdown();
1612
+ }
1613
+ setMetrics(metrics) {
1614
+ this._delegate.setMetrics(metrics);
1615
+ }
1616
+ }
1617
+
1618
+ /*
1619
+ * Copyright The OpenTelemetry Authors
1620
+ * SPDX-License-Identifier: Apache-2.0
1621
+ */
1622
+ /**
1623
+ * Interface for handling error
1624
+ */
1625
+ class OTLPExporterError extends Error {
1626
+ code;
1627
+ name = 'OTLPExporterError';
1628
+ data;
1629
+ constructor(message, code, data) {
1630
+ super(message);
1631
+ this.data = data;
1632
+ this.code = code;
1633
+ }
1634
+ }
1635
+
1636
+ /*
1637
+ * Copyright The OpenTelemetry Authors
1638
+ * SPDX-License-Identifier: Apache-2.0
1639
+ */
1640
+ function validateTimeoutMillis(timeoutMillis) {
1641
+ if (Number.isFinite(timeoutMillis) && timeoutMillis > 0) {
1642
+ return timeoutMillis;
1643
+ }
1644
+ throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${timeoutMillis}')`);
1645
+ }
1646
+ function wrapStaticHeadersInFunction(headers) {
1647
+ if (headers == null) {
1648
+ return undefined;
1649
+ }
1650
+ return async () => headers;
1651
+ }
1652
+ /**
1653
+ * @param userProvidedConfiguration Configuration options provided by the user in code.
1654
+ * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
1655
+ * @param defaultConfiguration The defaults as defined by the exporter specification
1656
+ */
1657
+ function mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {
1658
+ return {
1659
+ timeoutMillis: validateTimeoutMillis(userProvidedConfiguration.timeoutMillis ??
1660
+ fallbackConfiguration.timeoutMillis ??
1661
+ defaultConfiguration.timeoutMillis),
1662
+ concurrencyLimit: userProvidedConfiguration.concurrencyLimit ??
1663
+ fallbackConfiguration.concurrencyLimit ??
1664
+ defaultConfiguration.concurrencyLimit,
1665
+ compression: userProvidedConfiguration.compression ??
1666
+ fallbackConfiguration.compression ??
1667
+ defaultConfiguration.compression,
1668
+ };
1669
+ }
1670
+ function getSharedConfigurationDefaults() {
1671
+ return {
1672
+ timeoutMillis: 10000,
1673
+ concurrencyLimit: 30,
1674
+ compression: 'none',
1675
+ };
1676
+ }
1677
+
1678
+ /*
1679
+ * Copyright The OpenTelemetry Authors
1680
+ * SPDX-License-Identifier: Apache-2.0
1681
+ */
1682
+ class BoundedQueueExportPromiseHandler {
1683
+ _concurrencyLimit;
1684
+ _sendingPromises = [];
1685
+ /**
1686
+ * @param concurrencyLimit maximum promises allowed in a queue at the same time.
1687
+ */
1688
+ constructor(concurrencyLimit) {
1689
+ this._concurrencyLimit = concurrencyLimit;
1690
+ }
1691
+ pushPromise(promise) {
1692
+ if (this.hasReachedLimit()) {
1693
+ throw new Error('Concurrency Limit reached');
1694
+ }
1695
+ this._sendingPromises.push(promise);
1696
+ const popPromise = () => {
1697
+ const index = this._sendingPromises.indexOf(promise);
1698
+ void this._sendingPromises.splice(index, 1);
1699
+ };
1700
+ promise.then(popPromise, popPromise);
1701
+ }
1702
+ hasReachedLimit() {
1703
+ return this._sendingPromises.length >= this._concurrencyLimit;
1704
+ }
1705
+ async awaitAll() {
1706
+ await Promise.all(this._sendingPromises);
1707
+ }
1708
+ }
1709
+ /**
1710
+ * Promise queue for keeping track of export promises. Finished promises will be auto-dequeued.
1711
+ * Allows for awaiting all promises in the queue.
1712
+ */
1713
+ function createBoundedQueueExportPromiseHandler(options) {
1714
+ return new BoundedQueueExportPromiseHandler(options.concurrencyLimit);
1715
+ }
1716
+
1717
+ /*
1718
+ * Copyright The OpenTelemetry Authors
1719
+ * SPDX-License-Identifier: Apache-2.0
1720
+ */
1721
+ function isPartialSuccessResponse(response) {
1722
+ return Object.prototype.hasOwnProperty.call(response, 'partialSuccess');
1723
+ }
1724
+ /**
1725
+ * Default response handler that logs a partial success to the console.
1726
+ */
1727
+ function createLoggingPartialSuccessResponseHandler() {
1728
+ return {
1729
+ handleResponse(response) {
1730
+ // Partial success MUST never be an empty object according the specification
1731
+ // see https://opentelemetry.io/docs/specs/otlp/#partial-success
1732
+ if (response == null ||
1733
+ !isPartialSuccessResponse(response) ||
1734
+ response.partialSuccess == null ||
1735
+ Object.keys(response.partialSuccess).length === 0) {
1736
+ return;
1737
+ }
1738
+ diag.warn('Received Partial Success response:', JSON.stringify(response.partialSuccess));
1739
+ },
1740
+ };
1741
+ }
1742
+
1743
+ /*
1744
+ * Copyright The OpenTelemetry Authors
1745
+ * SPDX-License-Identifier: Apache-2.0
1746
+ */
1747
+ class OTLPExportDelegate {
1748
+ _metrics;
1749
+ _diagLogger;
1750
+ _transport;
1751
+ _serializer;
1752
+ _responseHandler;
1753
+ _promiseQueue;
1754
+ _timeout;
1755
+ constructor(transport, serializer, responseHandler, promiseQueue, metrics, timeout) {
1756
+ this._transport = transport;
1757
+ this._serializer = serializer;
1758
+ this._responseHandler = responseHandler;
1759
+ this._promiseQueue = promiseQueue;
1760
+ this._timeout = timeout;
1761
+ this._diagLogger = diag.createComponentLogger({
1762
+ namespace: 'OTLPExportDelegate',
1763
+ });
1764
+ this._metrics = metrics;
1765
+ }
1766
+ export(internalRepresentation, resultCallback) {
1767
+ this._diagLogger.debug('items to be sent', internalRepresentation);
1768
+ // don't do any work if too many exports are in progress.
1769
+ if (this._promiseQueue.hasReachedLimit()) {
1770
+ resultCallback({
1771
+ code: ExportResultCode.FAILED,
1772
+ error: new Error('Concurrent export limit reached'),
1773
+ });
1774
+ return;
1775
+ }
1776
+ const serializedRequest = this._serializer.serializeRequest(internalRepresentation);
1777
+ if (serializedRequest == null) {
1778
+ resultCallback({
1779
+ code: ExportResultCode.FAILED,
1780
+ error: new Error('Nothing to send'),
1781
+ });
1782
+ return;
1783
+ }
1784
+ const finishExport = this._metrics.startExport(internalRepresentation);
1785
+ this._promiseQueue.pushPromise(this._transport.send(serializedRequest, this._timeout).then(response => {
1786
+ if (response.status === 'success') {
1787
+ finishExport(undefined);
1788
+ if (response.data != null) {
1789
+ try {
1790
+ this._responseHandler.handleResponse(this._serializer.deserializeResponse(response.data));
1791
+ }
1792
+ catch (e) {
1793
+ this._diagLogger.warn('Export succeeded but could not deserialize response - is the response specification compliant?', e, response.data);
1794
+ }
1795
+ }
1796
+ // No matter the response, we can consider the export still successful.
1797
+ resultCallback({
1798
+ code: ExportResultCode.SUCCESS,
1799
+ });
1800
+ return;
1801
+ }
1802
+ else if (response.status === 'failure' && response.error) {
1803
+ finishExport(response.error);
1804
+ resultCallback({
1805
+ code: ExportResultCode.FAILED,
1806
+ error: response.error,
1807
+ });
1808
+ return;
1809
+ }
1810
+ else if (response.status === 'retryable') {
1811
+ finishExport('export_max_retries');
1812
+ resultCallback({
1813
+ code: ExportResultCode.FAILED,
1814
+ error: response.error ??
1815
+ new OTLPExporterError('Export failed with retryable status'),
1816
+ });
1817
+ }
1818
+ else {
1819
+ finishExport('export_failed');
1820
+ resultCallback({
1821
+ code: ExportResultCode.FAILED,
1822
+ error: new OTLPExporterError('Export failed with unknown error'),
1823
+ });
1824
+ }
1825
+ }, reason => {
1826
+ finishExport(reason);
1827
+ resultCallback({
1828
+ code: ExportResultCode.FAILED,
1829
+ error: reason,
1830
+ });
1831
+ }));
1832
+ }
1833
+ forceFlush() {
1834
+ return this._promiseQueue.awaitAll();
1835
+ }
1836
+ setMetrics(metrics) {
1837
+ this._metrics = metrics;
1838
+ }
1839
+ async shutdown() {
1840
+ this._diagLogger.debug('shutdown started');
1841
+ await this.forceFlush();
1842
+ this._transport.shutdown();
1843
+ }
1844
+ }
1845
+ /**
1846
+ * Creates a generic delegate for OTLP exports which only contains parts of the OTLP export that are shared across all
1847
+ * signals.
1848
+ */
1849
+ function createOtlpExportDelegate(components, settings) {
1850
+ return new OTLPExportDelegate(components.transport, components.serializer, createLoggingPartialSuccessResponseHandler(), components.promiseHandler, components.metrics, settings.timeout);
1851
+ }
1852
+
1853
+ /*
1854
+ * Copyright The OpenTelemetry Authors
1855
+ * SPDX-License-Identifier: Apache-2.0
1856
+ */
1857
+ function createOtlpNetworkExportDelegate(options, serializer, metrics, transport) {
1858
+ return createOtlpExportDelegate({
1859
+ transport: transport,
1860
+ serializer,
1861
+ promiseHandler: createBoundedQueueExportPromiseHandler(options),
1862
+ metrics,
1863
+ }, { timeout: options.timeoutMillis });
1864
+ }
1865
+
1866
+ /*
1867
+ * Copyright The OpenTelemetry Authors
1868
+ * SPDX-License-Identifier: Apache-2.0
1869
+ */
1870
+ /*
1871
+ * This file contains a copy of unstable semantic convention definitions
1872
+ * used by this package.
1873
+ * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
1874
+ */
1875
+ /**
1876
+ * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
1877
+ *
1878
+ * @example 200
1879
+ */
1880
+ const ATTR_HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code';
1881
+ /**
1882
+ * A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.
1883
+ *
1884
+ * @example otlp_grpc_span_exporter/0
1885
+ * @example custom-name
1886
+ *
1887
+ * @note Implementations **SHOULD** ensure a low cardinality for this attribute, even across application or SDK restarts.
1888
+ * E.g. implementations **MUST NOT** use UUIDs as values for this attribute.
1889
+ *
1890
+ * Implementations **MAY** achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
1891
+ * Hereby `otel.component.type` refers to the corresponding attribute value of the component.
1892
+ *
1893
+ * The value of `instance-counter` **MAY** be automatically assigned by the component and uniqueness within the enclosing SDK instance **MUST** be guaranteed.
1894
+ * For example, `<instance-counter>` **MAY** be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
1895
+ * instance of the given component type is started.
1896
+ *
1897
+ * With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
1898
+ * as `otel.component.name`, the second one `batching_span_processor/1` and so on.
1899
+ * These values will therefore be reused in the case of an application restart.
1900
+ *
1901
+ * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
1902
+ */
1903
+ const ATTR_OTEL_COMPONENT_NAME = 'otel.component.name';
1904
+ /**
1905
+ * A name identifying the type of the OpenTelemetry component.
1906
+ *
1907
+ * @example batching_span_processor
1908
+ * @example com.example.MySpanExporter
1909
+ *
1910
+ * @note If none of the standardized values apply, implementations **SHOULD** use the language-defined name of the type.
1911
+ * E.g. for Java the fully qualified classname **SHOULD** be used in this case.
1912
+ *
1913
+ * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
1914
+ */
1915
+ const ATTR_OTEL_COMPONENT_TYPE = 'otel.component.type';
1916
+ /**
1917
+ * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
1918
+ *
1919
+ * @example example.com
1920
+ * @example 10.1.2.80
1921
+ * @example /tmp/my.sock
1922
+ *
1923
+ * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available.
1924
+ */
1925
+ const ATTR_SERVER_ADDRESS = 'server.address';
1926
+ /**
1927
+ * Server port number.
1928
+ *
1929
+ * @example 80
1930
+ * @example 8080
1931
+ * @example 443
1932
+ *
1933
+ * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available.
1934
+ */
1935
+ const ATTR_SERVER_PORT = 'server.port';
1936
+ /**
1937
+ * Describes a class of error the operation ended with.
1938
+ *
1939
+ * @example timeout
1940
+ * @example java.net.UnknownHostException
1941
+ * @example server_certificate_invalid
1942
+ * @example 500
1943
+ *
1944
+ * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
1945
+ *
1946
+ * When `error.type` is set to a type (e.g., an exception type), its
1947
+ * canonical class name identifying the type within the artifact **SHOULD** be used.
1948
+ *
1949
+ * Instrumentations **SHOULD** document the list of errors they report.
1950
+ *
1951
+ * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
1952
+ * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
1953
+ * should be prepared for `error.type` to have high cardinality at query time when no
1954
+ * additional filters are applied.
1955
+ *
1956
+ * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
1957
+ *
1958
+ * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
1959
+ * it's **RECOMMENDED** to:
1960
+ *
1961
+ * - Use a domain-specific attribute
1962
+ * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
1963
+ */
1964
+ const ATTR_ERROR_TYPE$1 = 'error.type';
1965
+
1966
+ /*
1967
+ * Copyright The OpenTelemetry Authors
1968
+ * SPDX-License-Identifier: Apache-2.0
1969
+ */
1970
+ // this is autogenerated file, see scripts/version-update.js
1971
+ const VERSION = '0.222.0';
1972
+
1973
+ /*
1974
+ * Copyright The OpenTelemetry Authors
1975
+ * SPDX-License-Identifier: Apache-2.0
1976
+ */
1977
+ const componentCounter = new Map();
1978
+ /**
1979
+ * Generates `otel.sdk.exporter.*` metrics.
1980
+ * https://opentelemetry.io/docs/specs/semconv/otel/sdk-metrics
1981
+ */
1982
+ class ExporterMetrics {
1983
+ inflight;
1984
+ exported;
1985
+ duration;
1986
+ standardAttrs;
1987
+ responseAttributesFromError;
1988
+ helper;
1989
+ constructor(options) {
1990
+ const { componentType, metricsHelper, meterProvider, url, responseAttributesFromError, } = options;
1991
+ this.responseAttributesFromError = responseAttributesFromError;
1992
+ const meter = meterProvider
1993
+ ? meterProvider.getMeter('@opentelemetry/otlp-exporter', VERSION)
1994
+ : createNoopMeter();
1995
+ const counter = componentCounter.get(componentType) ?? 0;
1996
+ componentCounter.set(componentType, counter + 1);
1997
+ this.standardAttrs = {
1998
+ [ATTR_OTEL_COMPONENT_TYPE]: componentType,
1999
+ [ATTR_OTEL_COMPONENT_NAME]: `${componentType}/${counter}`,
2000
+ };
2001
+ if (url) {
2002
+ // URLs may exclude scheme for gRPC endpoints, but in this case they always
2003
+ // have a port number. Because the URL constructor requires a scheme, we
2004
+ // can still handle gRPC endpoints by prepending an arbitrary scheme.
2005
+ let urlToParse = url;
2006
+ if (!url.includes('://')) {
2007
+ urlToParse = `http://${url}`;
2008
+ }
2009
+ try {
2010
+ const parsedUrl = new URL(urlToParse);
2011
+ this.standardAttrs[ATTR_SERVER_ADDRESS] = parsedUrl.hostname;
2012
+ let port = undefined;
2013
+ if (parsedUrl.port) {
2014
+ port = Number(parsedUrl.port);
2015
+ }
2016
+ else if (parsedUrl.protocol === 'http:') {
2017
+ port = 80;
2018
+ }
2019
+ else if (parsedUrl.protocol === 'https:') {
2020
+ port = 443;
2021
+ }
2022
+ if (typeof port === 'number') {
2023
+ this.standardAttrs[ATTR_SERVER_PORT] = port;
2024
+ }
2025
+ }
2026
+ catch {
2027
+ // In practice, URLs will be valid or something else will break. Better to let that
2028
+ // inform the user than an exception in this internal code and proceed best-effort
2029
+ // here.
2030
+ }
2031
+ }
2032
+ this.helper = metricsHelper;
2033
+ this.inflight = meter.createUpDownCounter(`otel.sdk.exporter.${this.helper.name}.inflight`, {
2034
+ unit: `{${this.helper.name}}`,
2035
+ description: `The number of ${this.helper.name}s which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).`,
2036
+ });
2037
+ this.exported = meter.createCounter(`otel.sdk.exporter.${this.helper.name}.exported`, {
2038
+ unit: `{${this.helper.name}}`,
2039
+ description: `The number of ${this.helper.name}s for which the export has finished, either successful or failed.`,
2040
+ });
2041
+ this.duration = meter.createHistogram('otel.sdk.exporter.operation.duration', {
2042
+ unit: 's',
2043
+ description: 'The duration of exporting a batch of telemetry records.',
2044
+ advice: {
2045
+ explicitBucketBoundaries: [],
2046
+ },
2047
+ });
2048
+ }
2049
+ startExport(request) {
2050
+ const numItems = this.helper.countItems(request);
2051
+ const startTime = hrTime();
2052
+ this.inflight.add(numItems, this.standardAttrs);
2053
+ return (error) => {
2054
+ const endTime = hrTime();
2055
+ this.inflight.add(-numItems, this.standardAttrs);
2056
+ const exportedAttrs = error
2057
+ ? {
2058
+ ...this.standardAttrs,
2059
+ [ATTR_ERROR_TYPE$1]: error instanceof Error ? error.name : 'export_failed',
2060
+ }
2061
+ : this.standardAttrs;
2062
+ this.exported.add(numItems, exportedAttrs);
2063
+ const durationAttrs = {
2064
+ ...exportedAttrs,
2065
+ ...this.responseAttributesFromError(error),
2066
+ };
2067
+ const duration = hrTimeToMilliseconds(hrTimeDuration(startTime, endTime)) / 1000;
2068
+ this.duration.record(duration, durationAttrs);
2069
+ };
2070
+ }
2071
+ }
2072
+
2073
+ /*
2074
+ * Copyright The OpenTelemetry Authors
2075
+ * SPDX-License-Identifier: Apache-2.0
2076
+ */
2077
+ class NoopLogger {
2078
+ emit(_logRecord) { }
2079
+ enabled() {
2080
+ return false;
2081
+ }
2082
+ }
2083
+ const NOOP_LOGGER = new NoopLogger();
2084
+ /**
2085
+ * Create a no-op Logger
2086
+ */
2087
+ function createNoopLogger() {
2088
+ return NOOP_LOGGER;
2089
+ }
2090
+
2091
+ /*
2092
+ * Copyright The OpenTelemetry Authors
2093
+ * SPDX-License-Identifier: Apache-2.0
2094
+ */
2095
+ //----------------------------------------------------------------------------------------------------------
2096
+ // DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/stable/attributes.ts.j2
2097
+ //----------------------------------------------------------------------------------------------------------
2098
+ /**
2099
+ * ASP.NET Core exception middleware handling result.
2100
+ *
2101
+ * @example handled
2102
+ * @example unhandled
2103
+ */
2104
+ /**
2105
+ * Describes a class of error the operation ended with.
2106
+ *
2107
+ * @example timeout
2108
+ * @example java.net.UnknownHostException
2109
+ * @example server_certificate_invalid
2110
+ * @example 500
2111
+ *
2112
+ * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality.
2113
+ *
2114
+ * When `error.type` is set to a type (e.g., an exception type), its
2115
+ * canonical class name identifying the type within the artifact **SHOULD** be used.
2116
+ *
2117
+ * If the recorded error type is a wrapper that is not meaningful for
2118
+ * failure classification, instrumentation **MAY** use the type of the inner
2119
+ * error instead. For example, in Go, errors created with `fmt.Errorf`
2120
+ * using `%w` **MAY** be unwrapped when the wrapper type does not help
2121
+ * classify the failure.
2122
+ *
2123
+ * Instrumentations **SHOULD** document the list of errors they report.
2124
+ *
2125
+ * The cardinality of `error.type` within one instrumentation library **SHOULD** be low.
2126
+ * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
2127
+ * should be prepared for `error.type` to have high cardinality at query time when no
2128
+ * additional filters are applied.
2129
+ *
2130
+ * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`.
2131
+ *
2132
+ * If a specific domain defines its own set of error identifiers (such as HTTP or RPC status codes),
2133
+ * it's **RECOMMENDED** to:
2134
+ *
2135
+ * - Use a domain-specific attribute
2136
+ * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.
2137
+ */
2138
+ const ATTR_ERROR_TYPE = 'error.type';
2139
+ /**
2140
+ * The exception message.
2141
+ *
2142
+ * @example Division by zero
2143
+ * @example Can't convert 'int' object to str implicitly
2144
+ *
2145
+ * @note > [!WARNING]
2146
+ *
2147
+ * > This attribute may contain sensitive information.
2148
+ */
2149
+ const ATTR_EXCEPTION_MESSAGE = 'exception.message';
2150
+ /**
2151
+ * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG.
2152
+ *
2153
+ * @example "Exception in thread "main" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\n"
2154
+ */
2155
+ const ATTR_EXCEPTION_STACKTRACE = 'exception.stacktrace';
2156
+ /**
2157
+ * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it.
2158
+ *
2159
+ * @example java.net.ConnectException
2160
+ * @example OSError
2161
+ *
2162
+ * @note If the recorded exception type is a wrapper that is not meaningful for
2163
+ * failure classification, instrumentation **MAY** use the type of the inner
2164
+ * exception instead. For example, in Go, errors created with `fmt.Errorf`
2165
+ * using `%w` **MAY** be unwrapped when the wrapper type does not help
2166
+ * classify the failure.
2167
+ */
2168
+ const ATTR_EXCEPTION_TYPE = 'exception.type';
2169
+ /**
2170
+ * Logical name of the service.
2171
+ *
2172
+ * @example shoppingcart
2173
+ *
2174
+ * @note **MUST** be the same for all instances of horizontally scaled services. If the value was not specified, SDKs **MUST** fallback to `unknown_service:` concatenated with the process executable name, e.g. `unknown_service:bash`. If the process executable name is not available, the value **MUST** be set to `unknown_service`.
2175
+ * The process executable name is the name of the process executable, the same value as described by the [`process.executable.name`](process.md) resource attribute.
2176
+ */
2177
+ const ATTR_SERVICE_NAME = 'service.name';
2178
+ /**
2179
+ * The language of the telemetry SDK.
2180
+ */
2181
+ const ATTR_TELEMETRY_SDK_LANGUAGE = 'telemetry.sdk.language';
2182
+ /**
2183
+ * The name of the telemetry SDK as defined above.
2184
+ *
2185
+ * @example opentelemetry
2186
+ *
2187
+ * @note The OpenTelemetry SDK **MUST** set the `telemetry.sdk.name` attribute to `opentelemetry`.
2188
+ * If another SDK, like a fork or a vendor-provided implementation, is used, this SDK **MUST** set the
2189
+ * `telemetry.sdk.name` attribute to the fully-qualified class or module name of this SDK's main entry point
2190
+ * or another suitable identifier depending on the language.
2191
+ * The identifier `opentelemetry` is reserved and **MUST NOT** be used in this case.
2192
+ * All custom identifiers **SHOULD** be stable across different versions of an implementation.
2193
+ */
2194
+ const ATTR_TELEMETRY_SDK_NAME = 'telemetry.sdk.name';
2195
+ /**
2196
+ * The version string of the telemetry SDK.
2197
+ *
2198
+ * @example 1.2.3
2199
+ */
2200
+ const ATTR_TELEMETRY_SDK_VERSION = 'telemetry.sdk.version';
2201
+
2202
+ /*
2203
+ * Copyright The OpenTelemetry Authors
2204
+ * SPDX-License-Identifier: Apache-2.0
2205
+ */
2206
+ let serviceName;
2207
+ /**
2208
+ * Returns the default service name for OpenTelemetry resources.
2209
+ * In Node.js environments, returns "unknown_service:<process.argv0>".
2210
+ * In browser/edge environments, returns "unknown_service".
2211
+ */
2212
+ function defaultServiceName() {
2213
+ if (serviceName === undefined) {
2214
+ try {
2215
+ const argv0 = globalThis.process.argv0;
2216
+ serviceName = argv0 ? `unknown_service:${argv0}` : 'unknown_service';
2217
+ }
2218
+ catch {
2219
+ serviceName = 'unknown_service';
2220
+ }
2221
+ }
2222
+ return serviceName;
2223
+ }
2224
+
2225
+ /*
2226
+ * Copyright The OpenTelemetry Authors
2227
+ * SPDX-License-Identifier: Apache-2.0
2228
+ */
2229
+ const isPromiseLike = (val) => {
2230
+ return (val !== null &&
2231
+ typeof val === 'object' &&
2232
+ typeof val.then === 'function');
2233
+ };
2234
+
2235
+ /*
2236
+ * Copyright The OpenTelemetry Authors
2237
+ * SPDX-License-Identifier: Apache-2.0
2238
+ */
2239
+ class ResourceImpl {
2240
+ _rawAttributes;
2241
+ _asyncAttributesPending = false;
2242
+ _schemaUrl;
2243
+ _memoizedAttributes;
2244
+ static FromAttributeList(attributes, options) {
2245
+ const res = new ResourceImpl({}, options);
2246
+ res._rawAttributes = guardedRawAttributes(attributes);
2247
+ res._asyncAttributesPending =
2248
+ attributes.filter(([_, val]) => isPromiseLike(val)).length > 0;
2249
+ return res;
2250
+ }
2251
+ constructor(
2252
+ /**
2253
+ * A dictionary of attributes with string keys and values that provide
2254
+ * information about the entity as numbers, strings or booleans
2255
+ * TODO: Consider to add check/validation on attributes.
2256
+ */
2257
+ resource, options) {
2258
+ const attributes = resource.attributes ?? {};
2259
+ this._rawAttributes = Object.entries(attributes).map(([k, v]) => {
2260
+ if (isPromiseLike(v)) {
2261
+ // side-effect
2262
+ this._asyncAttributesPending = true;
2263
+ }
2264
+ return [k, v];
2265
+ });
2266
+ this._rawAttributes = guardedRawAttributes(this._rawAttributes);
2267
+ this._schemaUrl = validateSchemaUrl(options?.schemaUrl);
2268
+ }
2269
+ get asyncAttributesPending() {
2270
+ return this._asyncAttributesPending;
2271
+ }
2272
+ async waitForAsyncAttributes() {
2273
+ if (!this.asyncAttributesPending) {
2274
+ return;
2275
+ }
2276
+ for (let i = 0; i < this._rawAttributes.length; i++) {
2277
+ const [k, v] = this._rawAttributes[i];
2278
+ this._rawAttributes[i] = [k, isPromiseLike(v) ? await v : v];
2279
+ }
2280
+ this._asyncAttributesPending = false;
2281
+ }
2282
+ get attributes() {
2283
+ if (this.asyncAttributesPending) {
2284
+ diag.error('Accessing resource attributes before async attributes settled');
2285
+ }
2286
+ if (this._memoizedAttributes) {
2287
+ return this._memoizedAttributes;
2288
+ }
2289
+ const attrs = {};
2290
+ for (const [k, v] of this._rawAttributes) {
2291
+ if (isPromiseLike(v)) {
2292
+ diag.debug(`Unsettled resource attribute ${k} skipped`);
2293
+ continue;
2294
+ }
2295
+ if (v != null) {
2296
+ attrs[k] ??= v;
2297
+ }
2298
+ }
2299
+ // only memoize output if all attributes are settled
2300
+ if (!this._asyncAttributesPending) {
2301
+ this._memoizedAttributes = attrs;
2302
+ }
2303
+ return attrs;
2304
+ }
2305
+ getRawAttributes() {
2306
+ return this._rawAttributes;
2307
+ }
2308
+ get schemaUrl() {
2309
+ return this._schemaUrl;
2310
+ }
2311
+ merge(resource) {
2312
+ if (resource == null)
2313
+ return this;
2314
+ // Order is important
2315
+ // Spec states incoming attributes override existing attributes
2316
+ const mergedSchemaUrl = mergeSchemaUrl(this, resource);
2317
+ const mergedOptions = mergedSchemaUrl
2318
+ ? { schemaUrl: mergedSchemaUrl }
2319
+ : undefined;
2320
+ return ResourceImpl.FromAttributeList([...resource.getRawAttributes(), ...this.getRawAttributes()], mergedOptions);
2321
+ }
2322
+ }
2323
+ function resourceFromAttributes(attributes, options) {
2324
+ return ResourceImpl.FromAttributeList(Object.entries(attributes), options);
2325
+ }
2326
+ function defaultResource() {
2327
+ return resourceFromAttributes({
2328
+ [ATTR_SERVICE_NAME]: defaultServiceName(),
2329
+ [ATTR_TELEMETRY_SDK_LANGUAGE]: SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE],
2330
+ [ATTR_TELEMETRY_SDK_NAME]: SDK_INFO[ATTR_TELEMETRY_SDK_NAME],
2331
+ [ATTR_TELEMETRY_SDK_VERSION]: SDK_INFO[ATTR_TELEMETRY_SDK_VERSION],
2332
+ });
2333
+ }
2334
+ function guardedRawAttributes(attributes) {
2335
+ return attributes.map(([k, v]) => {
2336
+ if (isPromiseLike(v)) {
2337
+ return [
2338
+ k,
2339
+ v.catch(err => {
2340
+ diag.debug('promise rejection for resource attribute: %s - %s', k, err);
2341
+ return undefined;
2342
+ }),
2343
+ ];
2344
+ }
2345
+ return [k, v];
2346
+ });
2347
+ }
2348
+ function validateSchemaUrl(schemaUrl) {
2349
+ if (typeof schemaUrl === 'string' || schemaUrl === undefined) {
2350
+ return schemaUrl;
2351
+ }
2352
+ diag.warn('Schema URL must be string or undefined, got %s. Schema URL will be ignored.', schemaUrl);
2353
+ return undefined;
2354
+ }
2355
+ function mergeSchemaUrl(old, updating) {
2356
+ const oldSchemaUrl = old?.schemaUrl;
2357
+ const updatingSchemaUrl = updating?.schemaUrl;
2358
+ const isOldEmpty = oldSchemaUrl === undefined || oldSchemaUrl === '';
2359
+ const isUpdatingEmpty = updatingSchemaUrl === undefined || updatingSchemaUrl === '';
2360
+ if (isOldEmpty) {
2361
+ return updatingSchemaUrl;
2362
+ }
2363
+ if (isUpdatingEmpty) {
2364
+ return oldSchemaUrl;
2365
+ }
2366
+ if (oldSchemaUrl === updatingSchemaUrl) {
2367
+ return oldSchemaUrl;
2368
+ }
2369
+ diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.', oldSchemaUrl, updatingSchemaUrl);
2370
+ return undefined;
2371
+ }
2372
+
2373
+ function createResource(resource, encoder) {
2374
+ const result = {
2375
+ attributes: toAttributes(resource.attributes, encoder),
2376
+ droppedAttributesCount: 0,
2377
+ };
2378
+ const schemaUrl = resource.schemaUrl;
2379
+ if (schemaUrl && schemaUrl !== '')
2380
+ result.schemaUrl = schemaUrl;
2381
+ return result;
2382
+ }
2383
+ function createInstrumentationScope(scope, encoder) {
2384
+ const result = {
2385
+ name: scope.name,
2386
+ version: scope.version,
2387
+ };
2388
+ if (scope.attributes && Object.keys(scope.attributes).length > 0) {
2389
+ result.attributes = toAttributes(scope.attributes, encoder);
2390
+ result.droppedAttributesCount = scope.droppedAttributesCount ?? 0;
2391
+ }
2392
+ return result;
2393
+ }
2394
+ function toAttributes(attributes, encoder) {
2395
+ return Object.keys(attributes).map(key => toKeyValue(key, attributes[key], encoder));
2396
+ }
2397
+ function toKeyValue(key, value, encoder) {
2398
+ return {
2399
+ key: key,
2400
+ value: toAnyValue(value, encoder),
2401
+ };
2402
+ }
2403
+ function toAnyValue(value, encoder) {
2404
+ const t = typeof value;
2405
+ if (t === 'string')
2406
+ return { stringValue: value };
2407
+ if (t === 'number') {
2408
+ if (!Number.isInteger(value))
2409
+ return { doubleValue: value };
2410
+ return { intValue: value };
2411
+ }
2412
+ if (t === 'boolean')
2413
+ return { boolValue: value };
2414
+ if (value instanceof Uint8Array)
2415
+ return { bytesValue: encoder.encodeUint8Array(value) };
2416
+ if (Array.isArray(value)) {
2417
+ const values = new Array(value.length);
2418
+ for (let i = 0; i < value.length; i++) {
2419
+ values[i] = toAnyValue(value[i], encoder);
2420
+ }
2421
+ return { arrayValue: { values } };
2422
+ }
2423
+ if (t === 'object' && value != null) {
2424
+ const keys = Object.keys(value);
2425
+ const values = new Array(keys.length);
2426
+ for (let i = 0; i < keys.length; i++) {
2427
+ values[i] = {
2428
+ key: keys[i],
2429
+ value: toAnyValue(value[keys[i]], encoder),
2430
+ };
2431
+ }
2432
+ return { kvlistValue: { values } };
2433
+ }
2434
+ return {};
2435
+ }
2436
+
2437
+ /*
2438
+ * Copyright The OpenTelemetry Authors
2439
+ * SPDX-License-Identifier: Apache-2.0
2440
+ */
2441
+ function hrTimeToNanos(hrTime) {
2442
+ const NANOSECONDS = BigInt(1000000000);
2443
+ return (BigInt(Math.trunc(hrTime[0])) * NANOSECONDS + BigInt(Math.trunc(hrTime[1])));
2444
+ }
2445
+ function encodeAsString(hrTime) {
2446
+ const nanos = hrTimeToNanos(hrTime);
2447
+ return nanos.toString();
2448
+ }
2449
+ const encodeTimestamp = typeof BigInt !== 'undefined' ? encodeAsString : hrTimeToNanoseconds;
2450
+ function identity(value) {
2451
+ return value;
2452
+ }
2453
+ /**
2454
+ * Encoder for JSON format.
2455
+ * Uses string timestamps, hex for span/trace IDs, and base64 for Uint8Array.
2456
+ */
2457
+ const JSON_ENCODER = {
2458
+ encodeHrTime: encodeTimestamp,
2459
+ encodeSpanContext: identity,
2460
+ encodeOptionalSpanContext: identity,
2461
+ encodeUint8Array: (bytes) => {
2462
+ if (typeof Buffer !== 'undefined') {
2463
+ return Buffer.from(bytes).toString('base64');
2464
+ }
2465
+ // implementation note: not using spread operator and passing to
2466
+ // btoa to avoid stack overflow on large Uint8Arrays
2467
+ const chars = new Array(bytes.length);
2468
+ for (let i = 0; i < bytes.length; i++) {
2469
+ chars[i] = String.fromCharCode(bytes[i]);
2470
+ }
2471
+ return btoa(chars.join(''));
2472
+ },
2473
+ };
2474
+
2475
+ /*
2476
+ * Copyright The OpenTelemetry Authors
2477
+ * SPDX-License-Identifier: Apache-2.0
2478
+ */
2479
+ const MAX_ATTEMPTS = 5;
2480
+ const INITIAL_BACKOFF = 1000;
2481
+ const MAX_BACKOFF = 5000;
2482
+ const BACKOFF_MULTIPLIER = 1.5;
2483
+ const JITTER = 0.2;
2484
+ /**
2485
+ * Get a pseudo-random jitter that falls in the range of [-JITTER, +JITTER]
2486
+ */
2487
+ function getJitter() {
2488
+ return Math.random() * (2 * JITTER) - JITTER;
2489
+ }
2490
+ class RetryingTransport {
2491
+ _transport;
2492
+ constructor(transport) {
2493
+ this._transport = transport;
2494
+ }
2495
+ retry(data, timeoutMillis, inMillis) {
2496
+ return new Promise((resolve, reject) => {
2497
+ setTimeout(() => {
2498
+ this._transport.send(data, timeoutMillis).then(resolve, reject);
2499
+ }, inMillis);
2500
+ });
2501
+ }
2502
+ async send(data, timeoutMillis) {
2503
+ let attempts = MAX_ATTEMPTS;
2504
+ let nextBackoff = INITIAL_BACKOFF;
2505
+ const deadline = Date.now() + timeoutMillis;
2506
+ let result = await this._transport.send(data, timeoutMillis);
2507
+ while (result.status === 'retryable' && attempts > 0) {
2508
+ attempts--;
2509
+ // use maximum of computed backoff and 0 to avoid negative timeouts
2510
+ const backoff = Math.max(Math.min(nextBackoff * (1 + getJitter()), MAX_BACKOFF), 0);
2511
+ nextBackoff = nextBackoff * BACKOFF_MULTIPLIER;
2512
+ const retryInMillis = result.retryInMillis ?? backoff;
2513
+ // return when expected retry time is after the export deadline.
2514
+ const remainingTimeoutMillis = deadline - Date.now();
2515
+ if (retryInMillis > remainingTimeoutMillis) {
2516
+ diag.info(`Export retry time ${Math.round(retryInMillis)}ms exceeds remaining timeout ${Math.round(remainingTimeoutMillis)}ms, not retrying further.`);
2517
+ return result;
2518
+ }
2519
+ diag.verbose(`Scheduling export retry in ${Math.round(retryInMillis)}ms`);
2520
+ result = await this.retry(data, remainingTimeoutMillis, retryInMillis);
2521
+ }
2522
+ if (result.status === 'success') {
2523
+ diag.verbose(`Export succeeded after ${MAX_ATTEMPTS - attempts} retry attempts.`);
2524
+ }
2525
+ else if (result.status === 'retryable') {
2526
+ diag.info(`Export failed after maximum retry attempts (${MAX_ATTEMPTS}).`);
2527
+ }
2528
+ else {
2529
+ diag.info(`Export failed with non-retryable error: ${result.error}`);
2530
+ }
2531
+ return result;
2532
+ }
2533
+ shutdown() {
2534
+ return this._transport.shutdown();
2535
+ }
2536
+ }
2537
+ /**
2538
+ * Creates an Exporter Transport that retries on 'retryable' response.
2539
+ */
2540
+ function createRetryingTransport(options) {
2541
+ return new RetryingTransport(options.transport);
2542
+ }
2543
+
2544
+ /*
2545
+ * Copyright The OpenTelemetry Authors
2546
+ * SPDX-License-Identifier: Apache-2.0
2547
+ */
2548
+ function isExportHTTPErrorRetryable(statusCode) {
2549
+ return (statusCode === 429 ||
2550
+ statusCode === 502 ||
2551
+ statusCode === 503 ||
2552
+ statusCode === 504);
2553
+ }
2554
+ function parseRetryAfterToMills(retryAfter) {
2555
+ if (retryAfter == null) {
2556
+ return undefined;
2557
+ }
2558
+ const seconds = Number.parseInt(retryAfter, 10);
2559
+ if (Number.isInteger(seconds)) {
2560
+ return seconds > 0 ? seconds * 1000 : -1;
2561
+ }
2562
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After#directives
2563
+ const delay = new Date(retryAfter).getTime() - Date.now();
2564
+ if (delay >= 0) {
2565
+ return delay;
2566
+ }
2567
+ return 0;
2568
+ }
2569
+
2570
+ /*
2571
+ * Copyright The OpenTelemetry Authors
2572
+ * SPDX-License-Identifier: Apache-2.0
2573
+ */
2574
+ /**
2575
+ * Maximum total body size for concurrent keepalive requests.
2576
+ * Browsers enforce a 64KiB cumulative limit across all pending keepalive requests.
2577
+ * We use 60KB to leave headroom for headers.
2578
+ * @see https://github.com/whatwg/fetch/issues/679
2579
+ * @see https://blog.huli.tw/2025/01/06/en/navigator-sendbeacon-64kib-and-source-code/
2580
+ */
2581
+ const MAX_KEEPALIVE_BODY_SIZE = 60 * 1024;
2582
+ /**
2583
+ * Maximum concurrent keepalive requests.
2584
+ * Chrome enforces 9 concurrent keepalive fetch requests per renderer process.
2585
+ * @see https://github.com/whatwg/fetch/issues/679
2586
+ * Quote: "If the renderer process is processing more than 9 requests with keepalive set, we reject a new request"
2587
+ */
2588
+ const MAX_KEEPALIVE_REQUESTS = 9;
2589
+ /**
2590
+ * Track cumulative pending body size across all in-flight keepalive requests.
2591
+ * This is necessary because the 64KiB limit is cumulative, not per-request.
2592
+ */
2593
+ let pendingBodySize = 0;
2594
+ /**
2595
+ * Track number of pending keepalive requests.
2596
+ */
2597
+ let pendingKeepaliveCount = 0;
2598
+ class FetchTransport {
2599
+ _parameters;
2600
+ constructor(parameters) {
2601
+ this._parameters = parameters;
2602
+ }
2603
+ async send(data, timeoutMillis) {
2604
+ const abortController = new AbortController();
2605
+ const timeout = setTimeout(() => abortController.abort(), timeoutMillis);
2606
+ // Fetch API may be wrapped by an instrumentation like `@opentelemetry/instrumentation-fetch`.
2607
+ // In that case the instrumentation would create a new Span for this request
2608
+ // because the context manager cannot keep the context after `await` calls.
2609
+ // This creates an indirect endless loop Export -> Span -> Export
2610
+ // By using the `__original` function the instrumentation can't intercept the call
2611
+ // and no Span will be created breaking the vicious cycle
2612
+ let fetchApi = globalThis.fetch;
2613
+ // @ts-expect-error -- fetch could be wrapped
2614
+ if (typeof fetchApi.__original === 'function') {
2615
+ // @ts-expect-error -- fetch could be wrapped
2616
+ fetchApi = fetchApi.__original;
2617
+ }
2618
+ const requestSize = data.byteLength;
2619
+ // Determine if we can use keepalive based on cumulative browser limits.
2620
+ // We must check BEFORE adding to pending totals to avoid exceeding limits.
2621
+ const wouldExceedSize = pendingBodySize + requestSize > MAX_KEEPALIVE_BODY_SIZE;
2622
+ const wouldExceedCount = pendingKeepaliveCount >= MAX_KEEPALIVE_REQUESTS;
2623
+ const useKeepalive = !wouldExceedSize && !wouldExceedCount;
2624
+ if (useKeepalive) {
2625
+ pendingBodySize += requestSize;
2626
+ pendingKeepaliveCount++;
2627
+ }
2628
+ else {
2629
+ const reason = wouldExceedSize ? 'size limit' : 'count limit';
2630
+ diag.debug(`keepalive disabled: ${(requestSize / 1024).toFixed(1)}KB payload, ${pendingKeepaliveCount} pending (${reason})`);
2631
+ }
2632
+ try {
2633
+ const url = new URL(this._parameters.url);
2634
+ const response = await fetchApi(url.href, {
2635
+ method: 'POST',
2636
+ headers: await this._parameters.headers(),
2637
+ body: data,
2638
+ signal: abortController.signal,
2639
+ keepalive: useKeepalive,
2640
+ mode: globalThis.location
2641
+ ? globalThis.location.origin === url.origin
2642
+ ? 'same-origin'
2643
+ : 'cors'
2644
+ : 'no-cors',
2645
+ });
2646
+ if (response.status >= 200 && response.status <= 299) {
2647
+ diag.debug(`export response success (status: ${response.status})`);
2648
+ return { status: 'success' };
2649
+ }
2650
+ else if (isExportHTTPErrorRetryable(response.status)) {
2651
+ diag.warn(`export response retryable (status: ${response.status})`);
2652
+ const retryAfter = response.headers.get('Retry-After');
2653
+ const retryInMillis = parseRetryAfterToMills(retryAfter);
2654
+ return { status: 'retryable', retryInMillis };
2655
+ }
2656
+ diag.error(`export response failure (status: ${response.status})`);
2657
+ return {
2658
+ status: 'failure',
2659
+ error: new Error(`Fetch request failed with non-retryable status ${response.status}`),
2660
+ };
2661
+ }
2662
+ catch (error) {
2663
+ if (isFetchNetworkErrorRetryable(error)) {
2664
+ diag.warn(`export request retryable (network error: ${error})`);
2665
+ return {
2666
+ status: 'retryable',
2667
+ error: new Error('Fetch request encountered a network error', {
2668
+ cause: error,
2669
+ }),
2670
+ };
2671
+ }
2672
+ diag.error(`export request failure (error: ${error})`);
2673
+ return {
2674
+ status: 'failure',
2675
+ error: new Error('Fetch request errored', { cause: error }),
2676
+ };
2677
+ }
2678
+ finally {
2679
+ clearTimeout(timeout);
2680
+ if (useKeepalive) {
2681
+ pendingBodySize -= requestSize;
2682
+ pendingKeepaliveCount--;
2683
+ }
2684
+ }
2685
+ }
2686
+ shutdown() {
2687
+ // Intentionally left empty, nothing to do.
2688
+ }
2689
+ }
2690
+ /**
2691
+ * Creates an exporter transport that uses `fetch` to send the data
2692
+ * @param parameters applied to each request made by transport
2693
+ */
2694
+ function createFetchTransport(parameters) {
2695
+ return new FetchTransport(parameters);
2696
+ }
2697
+ function isFetchNetworkErrorRetryable(error) {
2698
+ return error instanceof TypeError && !error.cause;
2699
+ }
2700
+
2701
+ /*
2702
+ * Copyright The OpenTelemetry Authors
2703
+ * SPDX-License-Identifier: Apache-2.0
2704
+ */
2705
+ function createOtlpFetchExportDelegate(options, serializer, metrics) {
2706
+ return createOtlpNetworkExportDelegate(options, serializer, metrics, createRetryingTransport({
2707
+ transport: createFetchTransport(options),
2708
+ }));
2709
+ }
2710
+
2711
+ /*
2712
+ * Copyright The OpenTelemetry Authors
2713
+ * SPDX-License-Identifier: Apache-2.0
2714
+ */
2715
+ /**
2716
+ * Parses headers from config leaving only those that have defined values
2717
+ * @param partialHeaders
2718
+ */
2719
+ function validateAndNormalizeHeaders(partialHeaders) {
2720
+ const headers = {};
2721
+ Object.entries(partialHeaders ?? {}).forEach(([key, value]) => {
2722
+ if (typeof value !== 'undefined') {
2723
+ headers[key] = String(value);
2724
+ }
2725
+ else {
2726
+ diag.warn(`Header "${key}" has invalid value (${value}) and will be ignored`);
2727
+ }
2728
+ });
2729
+ return headers;
2730
+ }
2731
+
2732
+ /*
2733
+ * Copyright The OpenTelemetry Authors
2734
+ * SPDX-License-Identifier: Apache-2.0
2735
+ */
2736
+ function mergeHeaders(userProvidedHeaders, fallbackHeaders, defaultHeaders) {
2737
+ return async () => {
2738
+ const requiredHeaders = {
2739
+ ...(await defaultHeaders()),
2740
+ };
2741
+ const headers = {};
2742
+ // add fallback ones first
2743
+ if (fallbackHeaders != null) {
2744
+ Object.assign(headers, await fallbackHeaders());
2745
+ }
2746
+ // override with user-provided ones
2747
+ if (userProvidedHeaders != null) {
2748
+ Object.assign(headers, validateAndNormalizeHeaders(await userProvidedHeaders()));
2749
+ }
2750
+ // override required ones.
2751
+ return Object.assign(headers, requiredHeaders);
2752
+ };
2753
+ }
2754
+ function validateUserProvidedUrl(url) {
2755
+ if (url == null) {
2756
+ return undefined;
2757
+ }
2758
+ try {
2759
+ // NOTE: In non-browser environments, `globalThis.location` will be `undefined`.
2760
+ const base = globalThis.location?.href;
2761
+ return new URL(url, base).href;
2762
+ }
2763
+ catch {
2764
+ throw new Error(`Configuration: Could not parse user-provided export URL: '${url}'`);
2765
+ }
2766
+ }
2767
+ /**
2768
+ * @param userProvidedConfiguration Configuration options provided by the user in code.
2769
+ * @param fallbackConfiguration Fallback to use when the {@link userProvidedConfiguration} does not specify an option.
2770
+ * @param defaultConfiguration The defaults as defined by the exporter specification
2771
+ */
2772
+ function mergeOtlpHttpConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration) {
2773
+ return {
2774
+ ...mergeOtlpSharedConfigurationWithDefaults(userProvidedConfiguration, fallbackConfiguration, defaultConfiguration),
2775
+ headers: mergeHeaders(userProvidedConfiguration.headers, fallbackConfiguration.headers, defaultConfiguration.headers),
2776
+ url: validateUserProvidedUrl(userProvidedConfiguration.url) ??
2777
+ fallbackConfiguration.url ??
2778
+ defaultConfiguration.url,
2779
+ };
2780
+ }
2781
+ function getHttpConfigurationDefaults(requiredHeaders, signalResourcePath) {
2782
+ return {
2783
+ ...getSharedConfigurationDefaults(),
2784
+ headers: async () => requiredHeaders,
2785
+ url: 'http://localhost:4318/' + signalResourcePath,
2786
+ };
2787
+ }
2788
+
2789
+ /*
2790
+ * Copyright The OpenTelemetry Authors
2791
+ * SPDX-License-Identifier: Apache-2.0
2792
+ */
2793
+ function convertLegacyHeaders(config) {
2794
+ if (typeof config.headers === 'function') {
2795
+ return config.headers;
2796
+ }
2797
+ return wrapStaticHeadersInFunction(config.headers);
2798
+ }
2799
+
2800
+ /**
2801
+ * @deprecated this will be removed in 2.0
2802
+ *
2803
+ * @param config
2804
+ * @param signalResourcePath
2805
+ * @param requiredHeaders
2806
+ */
2807
+ function convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders) {
2808
+ return mergeOtlpHttpConfigurationWithDefaults({
2809
+ url: config.url,
2810
+ timeoutMillis: config.timeoutMillis,
2811
+ headers: convertLegacyHeaders(config),
2812
+ concurrencyLimit: config.concurrencyLimit,
2813
+ }, {}, // no fallback for browser case
2814
+ getHttpConfigurationDefaults(requiredHeaders, signalResourcePath));
2815
+ }
2816
+
2817
+ /*
2818
+ * Copyright The OpenTelemetry Authors
2819
+ * SPDX-License-Identifier: Apache-2.0
2820
+ */
2821
+ /**
2822
+ * @deprecated
2823
+ */
2824
+ function createLegacyOtlpBrowserExporterMetrics(metricsComponentType, exporterMetricsHelper, url, meterProvider) {
2825
+ return new ExporterMetrics({
2826
+ componentType: metricsComponentType,
2827
+ metricsHelper: exporterMetricsHelper,
2828
+ url,
2829
+ meterProvider,
2830
+ responseAttributesFromError: (error) => {
2831
+ if (!error) {
2832
+ return {
2833
+ [ATTR_HTTP_RESPONSE_STATUS_CODE]: 200,
2834
+ };
2835
+ }
2836
+ if (!(error instanceof Error)) {
2837
+ return {};
2838
+ }
2839
+ if (error.message.startsWith('Fetch request failed with non-retryable status ')) {
2840
+ const statusStr = error.message.substring('Fetch request failed with non-retryable status '.length);
2841
+ return {
2842
+ [ATTR_HTTP_RESPONSE_STATUS_CODE]: Number(statusStr),
2843
+ };
2844
+ }
2845
+ return {};
2846
+ },
2847
+ });
2848
+ }
2849
+ /**
2850
+ * @deprecated
2851
+ * @param config
2852
+ * @param serializer
2853
+ * @param signalResourcePath
2854
+ * @param requiredHeaders
2855
+ */
2856
+ function createLegacyOtlpBrowserExportDelegate(config, serializer, metricsComponentType, exporterMetricsHelper, meterProvider, signalResourcePath, requiredHeaders) {
2857
+ const options = convertLegacyBrowserHttpOptions(config, signalResourcePath, requiredHeaders);
2858
+ return createOtlpFetchExportDelegate(options, serializer, createLegacyOtlpBrowserExporterMetrics(metricsComponentType, exporterMetricsHelper, options.url, config.selfObsMeterProvider));
2859
+ }
2860
+
2861
+ export { toAnyValue as $, ATTR_EXCEPTION_TYPE as A, BindOnceFuture as B, ContextAPI as C, DiagAPI as D, createNoopMeter as E, suppressTracing as F, ExportResultCode as G, defaultResource as H, INVALID_SPAN_CONTEXT as I, JSON_ENCODER as J, isValidTraceId as K, hrTimeToNanoseconds as L, timeInputToHrTime as M, NOOP_METER as N, OTLPExporterBase as O, ATTR_URL_FULL as P, ATTR_USER_AGENT_ORIGINAL as Q, ROOT_CONTEXT as R, ATTR_HTTP_RESPONSE_STATUS_CODE$1 as S, TraceFlags as T, ATTR_SERVER_ADDRESS$1 as U, ATTR_SERVER_PORT$1 as V, ATTR_ERROR_TYPE$2 as W, ATTR_HTTP_REQUEST_METHOD as X, ATTR_HTTP_REQUEST_METHOD_ORIGINAL as Y, ProxyTracerProvider as Z, resourceFromAttributes as _, isSpanContextValid as a, ATTR_EXCEPTION_MESSAGE$1 as a0, ATTR_EXCEPTION_TYPE$1 as a1, ATTR_EXCEPTION_STACKTRACE$1 as a2, createNoopLogger as a3, NoopLogger as b, createContextKey as c, diag as d, NOOP_LOGGER as e, createInstrumentationScope as f, getGlobal as g, createResource as h, isTracingSuppressed as i, toAttributes as j, createLegacyOtlpBrowserExportDelegate as k, isTimeInput as l, hrTimeDuration as m, hrTime as n, otperformance as o, millisToHrTime as p, isTimeInputHrTime as q, registerGlobal as r, addHrTimes as s, trace as t, unregisterGlobal as u, ATTR_EXCEPTION_MESSAGE as v, ATTR_EXCEPTION_STACKTRACE as w, context as x, globalErrorHandler as y, ATTR_ERROR_TYPE as z };
2862
+ //# sourceMappingURL=create-legacy-browser-delegate-B4z_676L.js.map