@opentelemetry/sdk-trace-web 1.30.1 → 2.0.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/StackContextManager.js +27 -66
- package/build/esm/StackContextManager.js.map +1 -1
- package/build/esm/WebTracerProvider.d.ts +1 -1
- package/build/esm/WebTracerProvider.js +43 -41
- package/build/esm/WebTracerProvider.js.map +1 -1
- package/build/esm/enums/PerformanceTimingNames.d.ts +1 -0
- package/build/esm/enums/PerformanceTimingNames.js +1 -0
- package/build/esm/enums/PerformanceTimingNames.js.map +1 -1
- package/build/esm/index.d.ts +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/types.d.ts +4 -3
- package/build/esm/types.js.map +1 -1
- package/build/esm/utils.d.ts +5 -4
- package/build/esm/utils.js +69 -84
- package/build/esm/utils.js.map +1 -1
- package/build/esm/version.d.ts +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/build/esnext/StackContextManager.js +8 -10
- package/build/esnext/StackContextManager.js.map +1 -1
- package/build/esnext/WebTracerProvider.d.ts +1 -1
- package/build/esnext/WebTracerProvider.js +37 -14
- package/build/esnext/WebTracerProvider.js.map +1 -1
- package/build/esnext/enums/PerformanceTimingNames.d.ts +1 -0
- package/build/esnext/enums/PerformanceTimingNames.js +1 -0
- package/build/esnext/enums/PerformanceTimingNames.js.map +1 -1
- package/build/esnext/index.d.ts +1 -1
- package/build/esnext/index.js +1 -1
- package/build/esnext/index.js.map +1 -1
- package/build/esnext/types.d.ts +4 -3
- package/build/esnext/types.js.map +1 -1
- package/build/esnext/utils.d.ts +5 -4
- package/build/esnext/utils.js +19 -30
- package/build/esnext/utils.js.map +1 -1
- package/build/esnext/version.d.ts +1 -1
- package/build/esnext/version.js +1 -1
- package/build/esnext/version.js.map +1 -1
- package/build/src/StackContextManager.js +8 -10
- package/build/src/StackContextManager.js.map +1 -1
- package/build/src/WebTracerProvider.d.ts +1 -1
- package/build/src/WebTracerProvider.js +37 -14
- package/build/src/WebTracerProvider.js.map +1 -1
- package/build/src/enums/PerformanceTimingNames.d.ts +1 -0
- package/build/src/enums/PerformanceTimingNames.js +1 -0
- package/build/src/enums/PerformanceTimingNames.js.map +1 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +1 -4
- package/build/src/index.js.map +1 -1
- package/build/src/types.d.ts +4 -3
- package/build/src/types.js.map +1 -1
- package/build/src/utils.d.ts +5 -4
- package/build/src/utils.js +19 -30
- package/build/src/utils.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +17 -19
|
@@ -13,63 +13,30 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
17
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
18
|
-
if (!m) return o;
|
|
19
|
-
var i = m.call(o), r, ar = [], e;
|
|
20
|
-
try {
|
|
21
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
-
}
|
|
23
|
-
catch (error) { e = { error: error }; }
|
|
24
|
-
finally {
|
|
25
|
-
try {
|
|
26
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27
|
-
}
|
|
28
|
-
finally { if (e) throw e.error; }
|
|
29
|
-
}
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
33
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
34
|
-
if (ar || !(i in from)) {
|
|
35
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
36
|
-
ar[i] = from[i];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
40
|
-
};
|
|
41
16
|
import { ROOT_CONTEXT } from '@opentelemetry/api';
|
|
42
17
|
/**
|
|
43
18
|
* Stack Context Manager for managing the state in web
|
|
44
19
|
* it doesn't fully support the async calls though
|
|
45
20
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this._currentContext = ROOT_CONTEXT;
|
|
56
|
-
}
|
|
21
|
+
export class StackContextManager {
|
|
22
|
+
/**
|
|
23
|
+
* whether the context manager is enabled or not
|
|
24
|
+
*/
|
|
25
|
+
_enabled = false;
|
|
26
|
+
/**
|
|
27
|
+
* Keeps the reference to current context
|
|
28
|
+
*/
|
|
29
|
+
_currentContext = ROOT_CONTEXT;
|
|
57
30
|
/**
|
|
58
31
|
*
|
|
59
32
|
* @param context
|
|
60
33
|
* @param target Function to be executed within the context
|
|
61
34
|
*/
|
|
62
35
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var _this = this;
|
|
68
|
-
var args = [];
|
|
69
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
70
|
-
args[_i] = arguments[_i];
|
|
71
|
-
}
|
|
72
|
-
return manager.with(context, function () { return target.apply(_this, args); });
|
|
36
|
+
_bindFunction(context = ROOT_CONTEXT, target) {
|
|
37
|
+
const manager = this;
|
|
38
|
+
const contextWrapper = function (...args) {
|
|
39
|
+
return manager.with(context, () => target.apply(this, args));
|
|
73
40
|
};
|
|
74
41
|
Object.defineProperty(contextWrapper, 'length', {
|
|
75
42
|
enumerable: false,
|
|
@@ -78,20 +45,20 @@ var StackContextManager = /** @class */ (function () {
|
|
|
78
45
|
value: target.length,
|
|
79
46
|
});
|
|
80
47
|
return contextWrapper;
|
|
81
|
-
}
|
|
48
|
+
}
|
|
82
49
|
/**
|
|
83
50
|
* Returns the active context
|
|
84
51
|
*/
|
|
85
|
-
|
|
52
|
+
active() {
|
|
86
53
|
return this._currentContext;
|
|
87
|
-
}
|
|
54
|
+
}
|
|
88
55
|
/**
|
|
89
56
|
* Binds a the certain context or the active one to the target function and then returns the target
|
|
90
57
|
* @param context A context (span) to be bind to target
|
|
91
58
|
* @param target a function or event emitter. When target or one of its callbacks is called,
|
|
92
59
|
* the provided context will be used as the active context for the duration of the call.
|
|
93
60
|
*/
|
|
94
|
-
|
|
61
|
+
bind(context, target) {
|
|
95
62
|
// if no specific context to propagate is given, we use the current one
|
|
96
63
|
if (context === undefined) {
|
|
97
64
|
context = this.active();
|
|
@@ -100,26 +67,26 @@ var StackContextManager = /** @class */ (function () {
|
|
|
100
67
|
return this._bindFunction(context, target);
|
|
101
68
|
}
|
|
102
69
|
return target;
|
|
103
|
-
}
|
|
70
|
+
}
|
|
104
71
|
/**
|
|
105
72
|
* Disable the context manager (clears the current context)
|
|
106
73
|
*/
|
|
107
|
-
|
|
74
|
+
disable() {
|
|
108
75
|
this._currentContext = ROOT_CONTEXT;
|
|
109
76
|
this._enabled = false;
|
|
110
77
|
return this;
|
|
111
|
-
}
|
|
78
|
+
}
|
|
112
79
|
/**
|
|
113
80
|
* Enables the context manager and creates a default(root) context
|
|
114
81
|
*/
|
|
115
|
-
|
|
82
|
+
enable() {
|
|
116
83
|
if (this._enabled) {
|
|
117
84
|
return this;
|
|
118
85
|
}
|
|
119
86
|
this._enabled = true;
|
|
120
87
|
this._currentContext = ROOT_CONTEXT;
|
|
121
88
|
return this;
|
|
122
|
-
}
|
|
89
|
+
}
|
|
123
90
|
/**
|
|
124
91
|
* Calls the callback function [fn] with the provided [context]. If [context] is undefined then it will use the window.
|
|
125
92
|
* The context will be set as active
|
|
@@ -128,21 +95,15 @@ var StackContextManager = /** @class */ (function () {
|
|
|
128
95
|
* @param thisArg optional receiver to be used for calling fn
|
|
129
96
|
* @param args optional arguments forwarded to fn
|
|
130
97
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
134
|
-
args[_i - 3] = arguments[_i];
|
|
135
|
-
}
|
|
136
|
-
var previousContext = this._currentContext;
|
|
98
|
+
with(context, fn, thisArg, ...args) {
|
|
99
|
+
const previousContext = this._currentContext;
|
|
137
100
|
this._currentContext = context || ROOT_CONTEXT;
|
|
138
101
|
try {
|
|
139
|
-
return fn.call
|
|
102
|
+
return fn.call(thisArg, ...args);
|
|
140
103
|
}
|
|
141
104
|
finally {
|
|
142
105
|
this._currentContext = previousContext;
|
|
143
106
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
}());
|
|
147
|
-
export { StackContextManager };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
148
109
|
//# sourceMappingURL=StackContextManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackContextManager.js","sourceRoot":"","sources":["../../src/StackContextManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"StackContextManager.js","sourceRoot":"","sources":["../../src/StackContextManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAA2B,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE3E;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACK,QAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACI,eAAe,GAAG,YAAY,CAAC;IAEtC;;;;OAIG;IACH,wDAAwD;IAChD,aAAa,CACnB,OAAO,GAAG,YAAY,EACtB,MAAS;QAET,MAAM,OAAO,GAAG,IAAI,CAAC;QACrB,MAAM,cAAc,GAAG,UAAyB,GAAG,IAAe;YAChE,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,cAAc,EAAE,QAAQ,EAAE;YAC9C,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,MAAM,CAAC,MAAM;SACrB,CAAC,CAAC;QACH,OAAO,cAA8B,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAI,OAAgB,EAAE,MAAS;QACjC,uEAAuE;QACvE,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;SACzB;QACD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;YAChC,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAC5C;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAC;SACb;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CACF,OAAuB,EACvB,EAAK,EACL,OAA8B,EAC9B,GAAG,IAAO;QAEV,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC7C,IAAI,CAAC,eAAe,GAAG,OAAO,IAAI,YAAY,CAAC;QAE/C,IAAI;YACF,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;SAClC;gBAAS;YACR,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Context, ContextManager, ROOT_CONTEXT } from '@opentelemetry/api';\n\n/**\n * Stack Context Manager for managing the state in web\n * it doesn't fully support the async calls though\n */\nexport class StackContextManager implements ContextManager {\n /**\n * whether the context manager is enabled or not\n */\n private _enabled = false;\n\n /**\n * Keeps the reference to current context\n */\n public _currentContext = ROOT_CONTEXT;\n\n /**\n *\n * @param context\n * @param target Function to be executed within the context\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n private _bindFunction<T extends Function>(\n context = ROOT_CONTEXT,\n target: T\n ): T {\n const manager = this;\n const contextWrapper = function (this: unknown, ...args: unknown[]) {\n return manager.with(context, () => target.apply(this, args));\n };\n Object.defineProperty(contextWrapper, 'length', {\n enumerable: false,\n configurable: true,\n writable: false,\n value: target.length,\n });\n return contextWrapper as unknown as T;\n }\n\n /**\n * Returns the active context\n */\n active(): Context {\n return this._currentContext;\n }\n\n /**\n * Binds a the certain context or the active one to the target function and then returns the target\n * @param context A context (span) to be bind to target\n * @param target a function or event emitter. When target or one of its callbacks is called,\n * the provided context will be used as the active context for the duration of the call.\n */\n bind<T>(context: Context, target: T): T {\n // if no specific context to propagate is given, we use the current one\n if (context === undefined) {\n context = this.active();\n }\n if (typeof target === 'function') {\n return this._bindFunction(context, target);\n }\n return target;\n }\n\n /**\n * Disable the context manager (clears the current context)\n */\n disable(): this {\n this._currentContext = ROOT_CONTEXT;\n this._enabled = false;\n return this;\n }\n\n /**\n * Enables the context manager and creates a default(root) context\n */\n enable(): this {\n if (this._enabled) {\n return this;\n }\n this._enabled = true;\n this._currentContext = ROOT_CONTEXT;\n return this;\n }\n\n /**\n * Calls the callback function [fn] with the provided [context]. If [context] is undefined then it will use the window.\n * The context will be set as active\n * @param context\n * @param fn Callback function\n * @param thisArg optional receiver to be used for calling fn\n * @param args optional arguments forwarded to fn\n */\n with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(\n context: Context | null,\n fn: F,\n thisArg?: ThisParameterType<F>,\n ...args: A\n ): ReturnType<F> {\n const previousContext = this._currentContext;\n this._currentContext = context || ROOT_CONTEXT;\n\n try {\n return fn.call(thisArg, ...args);\n } finally {\n this._currentContext = previousContext;\n }\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { BasicTracerProvider, SDKRegistrationConfig, TracerConfig } from '@opent
|
|
|
2
2
|
/**
|
|
3
3
|
* WebTracerConfig provides an interface for configuring a Web Tracer.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type WebTracerConfig = TracerConfig;
|
|
6
6
|
/**
|
|
7
7
|
* This class represents a web tracer with {@link StackContextManager}
|
|
8
8
|
*/
|
|
@@ -13,43 +13,52 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
var __extends = (this && this.__extends) || (function () {
|
|
17
|
-
var extendStatics = function (d, b) {
|
|
18
|
-
extendStatics = Object.setPrototypeOf ||
|
|
19
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
20
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
21
|
-
return extendStatics(d, b);
|
|
22
|
-
};
|
|
23
|
-
return function (d, b) {
|
|
24
|
-
if (typeof b !== "function" && b !== null)
|
|
25
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
26
|
-
extendStatics(d, b);
|
|
27
|
-
function __() { this.constructor = d; }
|
|
28
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
29
|
-
};
|
|
30
|
-
})();
|
|
31
16
|
import { BasicTracerProvider, } from '@opentelemetry/sdk-trace-base';
|
|
32
17
|
import { StackContextManager } from './StackContextManager';
|
|
18
|
+
import { trace, context, propagation, } from '@opentelemetry/api';
|
|
19
|
+
import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator, } from '@opentelemetry/core';
|
|
20
|
+
function setupContextManager(contextManager) {
|
|
21
|
+
// null means 'do not register'
|
|
22
|
+
if (contextManager === null) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// undefined means 'register default'
|
|
26
|
+
if (contextManager === undefined) {
|
|
27
|
+
const defaultContextManager = new StackContextManager();
|
|
28
|
+
defaultContextManager.enable();
|
|
29
|
+
context.setGlobalContextManager(defaultContextManager);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
contextManager.enable();
|
|
33
|
+
context.setGlobalContextManager(contextManager);
|
|
34
|
+
}
|
|
35
|
+
function setupPropagator(propagator) {
|
|
36
|
+
// null means 'do not register'
|
|
37
|
+
if (propagator === null) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// undefined means 'register default'
|
|
41
|
+
if (propagator === undefined) {
|
|
42
|
+
propagation.setGlobalPropagator(new CompositePropagator({
|
|
43
|
+
propagators: [
|
|
44
|
+
new W3CTraceContextPropagator(),
|
|
45
|
+
new W3CBaggagePropagator(),
|
|
46
|
+
],
|
|
47
|
+
}));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
propagation.setGlobalPropagator(propagator);
|
|
51
|
+
}
|
|
33
52
|
/**
|
|
34
53
|
* This class represents a web tracer with {@link StackContextManager}
|
|
35
54
|
*/
|
|
36
|
-
|
|
37
|
-
__extends(WebTracerProvider, _super);
|
|
55
|
+
export class WebTracerProvider extends BasicTracerProvider {
|
|
38
56
|
/**
|
|
39
57
|
* Constructs a new Tracer instance.
|
|
40
58
|
* @param config Web Tracer config
|
|
41
59
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _this = _super.call(this, config) || this;
|
|
45
|
-
if (config.contextManager) {
|
|
46
|
-
throw ('contextManager should be defined in register method not in' +
|
|
47
|
-
' constructor');
|
|
48
|
-
}
|
|
49
|
-
if (config.propagator) {
|
|
50
|
-
throw 'propagator should be defined in register method not in constructor';
|
|
51
|
-
}
|
|
52
|
-
return _this;
|
|
60
|
+
constructor(config = {}) {
|
|
61
|
+
super(config);
|
|
53
62
|
}
|
|
54
63
|
/**
|
|
55
64
|
* Register this TracerProvider for use with the OpenTelemetry API.
|
|
@@ -58,17 +67,10 @@ var WebTracerProvider = /** @class */ (function (_super) {
|
|
|
58
67
|
*
|
|
59
68
|
* @param config Configuration object for SDK registration
|
|
60
69
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
config.contextManager.enable();
|
|
68
|
-
}
|
|
69
|
-
_super.prototype.register.call(this, config);
|
|
70
|
-
};
|
|
71
|
-
return WebTracerProvider;
|
|
72
|
-
}(BasicTracerProvider));
|
|
73
|
-
export { WebTracerProvider };
|
|
70
|
+
register(config = {}) {
|
|
71
|
+
trace.setGlobalTracerProvider(this);
|
|
72
|
+
setupPropagator(config.propagator);
|
|
73
|
+
setupContextManager(config.contextManager);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
74
76
|
//# sourceMappingURL=WebTracerProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebTracerProvider.js","sourceRoot":"","sources":["../../src/WebTracerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"WebTracerProvider.js","sourceRoot":"","sources":["../../src/WebTracerProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,mBAAmB,GAGpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,KAAK,EACL,OAAO,EAEP,WAAW,GAEZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,SAAS,mBAAmB,CAC1B,cAAiD;IAEjD,+BAA+B;IAC/B,IAAI,cAAc,KAAK,IAAI,EAAE;QAC3B,OAAO;KACR;IAED,qCAAqC;IACrC,IAAI,cAAc,KAAK,SAAS,EAAE;QAChC,MAAM,qBAAqB,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACxD,qBAAqB,CAAC,MAAM,EAAE,CAAC;QAC/B,OAAO,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;QACvD,OAAO;KACR;IAED,cAAc,CAAC,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,eAAe,CAAC,UAAgD;IACvE,+BAA+B;IAC/B,IAAI,UAAU,KAAK,IAAI,EAAE;QACvB,OAAO;KACR;IAED,qCAAqC;IACrC,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,WAAW,CAAC,mBAAmB,CAC7B,IAAI,mBAAmB,CAAC;YACtB,WAAW,EAAE;gBACX,IAAI,yBAAyB,EAAE;gBAC/B,IAAI,oBAAoB,EAAE;aAC3B;SACF,CAAC,CACH,CAAC;QACF,OAAO;KACR;IAED,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAC9C,CAAC;AAOD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,mBAAmB;IACxD;;;OAGG;IACH,YAAY,SAA0B,EAAE;QACtC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,SAAgC,EAAE;QACzC,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACpC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACnC,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n BasicTracerProvider,\n SDKRegistrationConfig,\n TracerConfig,\n} from '@opentelemetry/sdk-trace-base';\nimport { StackContextManager } from './StackContextManager';\nimport {\n trace,\n context,\n ContextManager,\n propagation,\n TextMapPropagator,\n} from '@opentelemetry/api';\nimport {\n CompositePropagator,\n W3CBaggagePropagator,\n W3CTraceContextPropagator,\n} from '@opentelemetry/core';\n\nfunction setupContextManager(\n contextManager: ContextManager | null | undefined\n) {\n // null means 'do not register'\n if (contextManager === null) {\n return;\n }\n\n // undefined means 'register default'\n if (contextManager === undefined) {\n const defaultContextManager = new StackContextManager();\n defaultContextManager.enable();\n context.setGlobalContextManager(defaultContextManager);\n return;\n }\n\n contextManager.enable();\n context.setGlobalContextManager(contextManager);\n}\n\nfunction setupPropagator(propagator: TextMapPropagator | null | undefined) {\n // null means 'do not register'\n if (propagator === null) {\n return;\n }\n\n // undefined means 'register default'\n if (propagator === undefined) {\n propagation.setGlobalPropagator(\n new CompositePropagator({\n propagators: [\n new W3CTraceContextPropagator(),\n new W3CBaggagePropagator(),\n ],\n })\n );\n return;\n }\n\n propagation.setGlobalPropagator(propagator);\n}\n\n/**\n * WebTracerConfig provides an interface for configuring a Web Tracer.\n */\nexport type WebTracerConfig = TracerConfig;\n\n/**\n * This class represents a web tracer with {@link StackContextManager}\n */\nexport class WebTracerProvider extends BasicTracerProvider {\n /**\n * Constructs a new Tracer instance.\n * @param config Web Tracer config\n */\n constructor(config: WebTracerConfig = {}) {\n super(config);\n }\n\n /**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\n register(config: SDKRegistrationConfig = {}): void {\n trace.setGlobalTracerProvider(this);\n setupPropagator(config.propagator);\n setupContextManager(config.contextManager);\n }\n}\n"]}
|
|
@@ -19,6 +19,7 @@ export declare enum PerformanceTimingNames {
|
|
|
19
19
|
RESPONSE_END = "responseEnd",
|
|
20
20
|
RESPONSE_START = "responseStart",
|
|
21
21
|
SECURE_CONNECTION_START = "secureConnectionStart",
|
|
22
|
+
START_TIME = "startTime",
|
|
22
23
|
UNLOAD_EVENT_END = "unloadEventEnd",
|
|
23
24
|
UNLOAD_EVENT_START = "unloadEventStart"
|
|
24
25
|
}
|
|
@@ -35,6 +35,7 @@ export var PerformanceTimingNames;
|
|
|
35
35
|
PerformanceTimingNames["RESPONSE_END"] = "responseEnd";
|
|
36
36
|
PerformanceTimingNames["RESPONSE_START"] = "responseStart";
|
|
37
37
|
PerformanceTimingNames["SECURE_CONNECTION_START"] = "secureConnectionStart";
|
|
38
|
+
PerformanceTimingNames["START_TIME"] = "startTime";
|
|
38
39
|
PerformanceTimingNames["UNLOAD_EVENT_END"] = "unloadEventEnd";
|
|
39
40
|
PerformanceTimingNames["UNLOAD_EVENT_START"] = "unloadEventStart";
|
|
40
41
|
})(PerformanceTimingNames || (PerformanceTimingNames = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceTimingNames.js","sourceRoot":"","sources":["../../../src/enums/PerformanceTimingNames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"PerformanceTimingNames.js","sourceRoot":"","sources":["../../../src/enums/PerformanceTimingNames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAN,IAAY,sBAwBX;AAxBD,WAAY,sBAAsB;IAChC,oDAA0B,CAAA;IAC1B,wDAA8B,CAAA;IAC9B,+DAAqC,CAAA;IACrC,sDAA4B,CAAA;IAC5B,mFAAyD,CAAA;IACzD,uFAA6D,CAAA;IAC7D,4DAAkC,CAAA;IAClC,+DAAqC,CAAA;IACrC,mEAAyC,CAAA;IACzC,+DAAqC,CAAA;IACrC,oDAA0B,CAAA;IAC1B,yDAA+B,CAAA;IAC/B,6DAAmC,CAAA;IACnC,8DAAoC,CAAA;IACpC,sDAA4B,CAAA;IAC5B,0DAAgC,CAAA;IAChC,wDAA8B,CAAA;IAC9B,sDAA4B,CAAA;IAC5B,0DAAgC,CAAA;IAChC,2EAAiD,CAAA;IACjD,kDAAwB,CAAA;IACxB,6DAAmC,CAAA;IACnC,iEAAuC,CAAA;AACzC,CAAC,EAxBW,sBAAsB,KAAtB,sBAAsB,QAwBjC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum PerformanceTimingNames {\n CONNECT_END = 'connectEnd',\n CONNECT_START = 'connectStart',\n DECODED_BODY_SIZE = 'decodedBodySize',\n DOM_COMPLETE = 'domComplete',\n DOM_CONTENT_LOADED_EVENT_END = 'domContentLoadedEventEnd',\n DOM_CONTENT_LOADED_EVENT_START = 'domContentLoadedEventStart',\n DOM_INTERACTIVE = 'domInteractive',\n DOMAIN_LOOKUP_END = 'domainLookupEnd',\n DOMAIN_LOOKUP_START = 'domainLookupStart',\n ENCODED_BODY_SIZE = 'encodedBodySize',\n FETCH_START = 'fetchStart',\n LOAD_EVENT_END = 'loadEventEnd',\n LOAD_EVENT_START = 'loadEventStart',\n NAVIGATION_START = 'navigationStart',\n REDIRECT_END = 'redirectEnd',\n REDIRECT_START = 'redirectStart',\n REQUEST_START = 'requestStart',\n RESPONSE_END = 'responseEnd',\n RESPONSE_START = 'responseStart',\n SECURE_CONNECTION_START = 'secureConnectionStart',\n START_TIME = 'startTime',\n UNLOAD_EVENT_END = 'unloadEventEnd',\n UNLOAD_EVENT_START = 'unloadEventStart',\n}\n"]}
|
package/build/esm/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export { StackContextManager } from './StackContextManager';
|
|
|
3
3
|
export { PerformanceTimingNames } from './enums/PerformanceTimingNames';
|
|
4
4
|
export { PerformanceEntries, PerformanceLegacy, PerformanceResourceTimingInfo, PropagateTraceHeaderCorsUrls, } from './types';
|
|
5
5
|
export { URLLike, addSpanNetworkEvent, addSpanNetworkEvents, getElementXPath, getResource, hasKey, normalizeUrl, parseUrl, shouldPropagateTraceHeaders, sortResources, } from './utils';
|
|
6
|
-
export { AlwaysOffSampler, AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor, BatchSpanProcessorBrowserConfig, BufferConfig, ConsoleSpanExporter,
|
|
6
|
+
export { AlwaysOffSampler, AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor, BatchSpanProcessorBrowserConfig, BufferConfig, ConsoleSpanExporter, GeneralLimits, IdGenerator, InMemorySpanExporter, NoopSpanProcessor, ParentBasedSampler, RandomIdGenerator, ReadableSpan, Sampler, SamplingDecision, SamplingResult, SDKRegistrationConfig, SimpleSpanProcessor, Span, SpanExporter, SpanLimits, SpanProcessor, TimedEvent, TraceIdRatioBasedSampler, TracerConfig, } from '@opentelemetry/sdk-trace-base';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/build/esm/index.js
CHANGED
|
@@ -17,5 +17,5 @@ export { WebTracerProvider } from './WebTracerProvider';
|
|
|
17
17
|
export { StackContextManager } from './StackContextManager';
|
|
18
18
|
export { PerformanceTimingNames } from './enums/PerformanceTimingNames';
|
|
19
19
|
export { addSpanNetworkEvent, addSpanNetworkEvents, getElementXPath, getResource, hasKey, normalizeUrl, parseUrl, shouldPropagateTraceHeaders, sortResources, } from './utils';
|
|
20
|
-
export { AlwaysOffSampler, AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor, ConsoleSpanExporter,
|
|
20
|
+
export { AlwaysOffSampler, AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor, ConsoleSpanExporter, InMemorySpanExporter, NoopSpanProcessor, ParentBasedSampler, RandomIdGenerator, SamplingDecision, SimpleSpanProcessor, TraceIdRatioBasedSampler, } from '@opentelemetry/sdk-trace-base';
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAmB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAOxE,OAAO,EAEL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,2BAA2B,EAC3B,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAGlB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAmB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAOxE,OAAO,EAEL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,2BAA2B,EAC3B,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAGlB,mBAAmB,EAGnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAGjB,gBAAgB,EAGhB,mBAAmB,EAMnB,wBAAwB,GAEzB,MAAM,+BAA+B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { WebTracerConfig, WebTracerProvider } from './WebTracerProvider';\nexport { StackContextManager } from './StackContextManager';\nexport { PerformanceTimingNames } from './enums/PerformanceTimingNames';\nexport {\n PerformanceEntries,\n PerformanceLegacy,\n PerformanceResourceTimingInfo,\n PropagateTraceHeaderCorsUrls,\n} from './types';\nexport {\n URLLike,\n addSpanNetworkEvent,\n addSpanNetworkEvents,\n getElementXPath,\n getResource,\n hasKey,\n normalizeUrl,\n parseUrl,\n shouldPropagateTraceHeaders,\n sortResources,\n} from './utils';\nexport {\n AlwaysOffSampler,\n AlwaysOnSampler,\n BasicTracerProvider,\n BatchSpanProcessor,\n BatchSpanProcessorBrowserConfig,\n BufferConfig,\n ConsoleSpanExporter,\n GeneralLimits,\n IdGenerator,\n InMemorySpanExporter,\n NoopSpanProcessor,\n ParentBasedSampler,\n RandomIdGenerator,\n ReadableSpan,\n Sampler,\n SamplingDecision,\n SamplingResult,\n SDKRegistrationConfig,\n SimpleSpanProcessor,\n Span,\n SpanExporter,\n SpanLimits,\n SpanProcessor,\n TimedEvent,\n TraceIdRatioBasedSampler,\n TracerConfig,\n} from '@opentelemetry/sdk-trace-base';\n"]}
|
package/build/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PerformanceTimingNames } from './enums/PerformanceTimingNames';
|
|
2
|
-
export
|
|
2
|
+
export type PerformanceEntries = {
|
|
3
3
|
[PerformanceTimingNames.CONNECT_END]?: number;
|
|
4
4
|
[PerformanceTimingNames.CONNECT_START]?: number;
|
|
5
5
|
[PerformanceTimingNames.DECODED_BODY_SIZE]?: number;
|
|
@@ -19,6 +19,7 @@ export declare type PerformanceEntries = {
|
|
|
19
19
|
[PerformanceTimingNames.RESPONSE_END]?: number;
|
|
20
20
|
[PerformanceTimingNames.RESPONSE_START]?: number;
|
|
21
21
|
[PerformanceTimingNames.SECURE_CONNECTION_START]?: number;
|
|
22
|
+
[PerformanceTimingNames.START_TIME]?: number;
|
|
22
23
|
[PerformanceTimingNames.UNLOAD_EVENT_END]?: number;
|
|
23
24
|
[PerformanceTimingNames.UNLOAD_EVENT_START]?: number;
|
|
24
25
|
};
|
|
@@ -37,10 +38,10 @@ export interface PerformanceResourceTimingInfo {
|
|
|
37
38
|
corsPreFlightRequest?: PerformanceResourceTiming;
|
|
38
39
|
mainRequest?: PerformanceResourceTiming;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
type PropagateTraceHeaderCorsUrl = string | RegExp;
|
|
41
42
|
/**
|
|
42
43
|
* urls which should include trace headers when origin doesn't match
|
|
43
44
|
*/
|
|
44
|
-
export
|
|
45
|
+
export type PropagateTraceHeaderCorsUrls = PropagateTraceHeaderCorsUrl | PropagateTraceHeaderCorsUrl[];
|
|
45
46
|
export {};
|
|
46
47
|
//# sourceMappingURL=types.d.ts.map
|
package/build/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { PerformanceTimingNames } from './enums/PerformanceTimingNames';\n\nexport type PerformanceEntries = {\n [PerformanceTimingNames.CONNECT_END]?: number;\n [PerformanceTimingNames.CONNECT_START]?: number;\n [PerformanceTimingNames.DECODED_BODY_SIZE]?: number;\n [PerformanceTimingNames.DOM_COMPLETE]?: number;\n [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END]?: number;\n [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START]?: number;\n [PerformanceTimingNames.DOM_INTERACTIVE]?: number;\n [PerformanceTimingNames.DOMAIN_LOOKUP_END]?: number;\n [PerformanceTimingNames.DOMAIN_LOOKUP_START]?: number;\n [PerformanceTimingNames.ENCODED_BODY_SIZE]?: number;\n [PerformanceTimingNames.FETCH_START]?: number;\n [PerformanceTimingNames.LOAD_EVENT_END]?: number;\n [PerformanceTimingNames.LOAD_EVENT_START]?: number;\n [PerformanceTimingNames.REDIRECT_END]?: number;\n [PerformanceTimingNames.REDIRECT_START]?: number;\n [PerformanceTimingNames.REQUEST_START]?: number;\n [PerformanceTimingNames.RESPONSE_END]?: number;\n [PerformanceTimingNames.RESPONSE_START]?: number;\n [PerformanceTimingNames.SECURE_CONNECTION_START]?: number;\n [PerformanceTimingNames.UNLOAD_EVENT_END]?: number;\n [PerformanceTimingNames.UNLOAD_EVENT_START]?: number;\n};\n\n/**\n * This interface defines a fallback to read performance metrics,\n * this happens for example on Safari Mac\n */\nexport interface PerformanceLegacy {\n timing?: PerformanceEntries;\n}\n\n/**\n * This interface is used in {@link getResource} function to return\n * main request and it's corresponding PreFlight request\n */\nexport interface PerformanceResourceTimingInfo {\n corsPreFlightRequest?: PerformanceResourceTiming;\n mainRequest?: PerformanceResourceTiming;\n}\n\ntype PropagateTraceHeaderCorsUrl = string | RegExp;\n\n/**\n * urls which should include trace headers when origin doesn't match\n */\nexport type PropagateTraceHeaderCorsUrls =\n | PropagateTraceHeaderCorsUrl\n | PropagateTraceHeaderCorsUrl[];\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { PerformanceTimingNames } from './enums/PerformanceTimingNames';\n\nexport type PerformanceEntries = {\n [PerformanceTimingNames.CONNECT_END]?: number;\n [PerformanceTimingNames.CONNECT_START]?: number;\n [PerformanceTimingNames.DECODED_BODY_SIZE]?: number;\n [PerformanceTimingNames.DOM_COMPLETE]?: number;\n [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_END]?: number;\n [PerformanceTimingNames.DOM_CONTENT_LOADED_EVENT_START]?: number;\n [PerformanceTimingNames.DOM_INTERACTIVE]?: number;\n [PerformanceTimingNames.DOMAIN_LOOKUP_END]?: number;\n [PerformanceTimingNames.DOMAIN_LOOKUP_START]?: number;\n [PerformanceTimingNames.ENCODED_BODY_SIZE]?: number;\n [PerformanceTimingNames.FETCH_START]?: number;\n [PerformanceTimingNames.LOAD_EVENT_END]?: number;\n [PerformanceTimingNames.LOAD_EVENT_START]?: number;\n [PerformanceTimingNames.REDIRECT_END]?: number;\n [PerformanceTimingNames.REDIRECT_START]?: number;\n [PerformanceTimingNames.REQUEST_START]?: number;\n [PerformanceTimingNames.RESPONSE_END]?: number;\n [PerformanceTimingNames.RESPONSE_START]?: number;\n [PerformanceTimingNames.SECURE_CONNECTION_START]?: number;\n [PerformanceTimingNames.START_TIME]?: number;\n [PerformanceTimingNames.UNLOAD_EVENT_END]?: number;\n [PerformanceTimingNames.UNLOAD_EVENT_START]?: number;\n};\n\n/**\n * This interface defines a fallback to read performance metrics,\n * this happens for example on Safari Mac\n */\nexport interface PerformanceLegacy {\n timing?: PerformanceEntries;\n}\n\n/**\n * This interface is used in {@link getResource} function to return\n * main request and it's corresponding PreFlight request\n */\nexport interface PerformanceResourceTimingInfo {\n corsPreFlightRequest?: PerformanceResourceTiming;\n mainRequest?: PerformanceResourceTiming;\n}\n\ntype PropagateTraceHeaderCorsUrl = string | RegExp;\n\n/**\n * urls which should include trace headers when origin doesn't match\n */\nexport type PropagateTraceHeaderCorsUrls =\n | PropagateTraceHeaderCorsUrl\n | PropagateTraceHeaderCorsUrl[];\n"]}
|
package/build/esm/utils.d.ts
CHANGED
|
@@ -5,22 +5,23 @@ import * as api from '@opentelemetry/api';
|
|
|
5
5
|
* @param obj
|
|
6
6
|
* @param key
|
|
7
7
|
*/
|
|
8
|
-
export declare function hasKey<O extends object>(obj: O, key:
|
|
8
|
+
export declare function hasKey<O extends object>(obj: O, key: PropertyKey): key is keyof O;
|
|
9
9
|
/**
|
|
10
10
|
* Helper function for starting an event on span based on {@link PerformanceEntries}
|
|
11
11
|
* @param span
|
|
12
12
|
* @param performanceName name of performance entry for time start
|
|
13
13
|
* @param entries
|
|
14
|
-
* @param
|
|
14
|
+
* @param ignoreZeros
|
|
15
15
|
*/
|
|
16
|
-
export declare function addSpanNetworkEvent(span: api.Span, performanceName: string, entries: PerformanceEntries,
|
|
16
|
+
export declare function addSpanNetworkEvent(span: api.Span, performanceName: string, entries: PerformanceEntries, ignoreZeros?: boolean): api.Span | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* Helper function for adding network events and content length attributes
|
|
19
19
|
* @param span
|
|
20
20
|
* @param resource
|
|
21
21
|
* @param ignoreNetworkEvents
|
|
22
|
+
* @param ignoreZeros
|
|
22
23
|
*/
|
|
23
|
-
export declare function addSpanNetworkEvents(span: api.Span, resource: PerformanceEntries, ignoreNetworkEvents?: boolean): void;
|
|
24
|
+
export declare function addSpanNetworkEvents(span: api.Span, resource: PerformanceEntries, ignoreNetworkEvents?: boolean, ignoreZeros?: boolean): void;
|
|
24
25
|
/**
|
|
25
26
|
* sort resources by startTime
|
|
26
27
|
* @param filteredResources
|