@opentelemetry/instrumentation-xml-http-request 0.25.1-alpha.7 → 0.28.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.
- package/README.md +0 -6
- package/build/esm/enums/AttributeNames.js.map +1 -1
- package/build/esm/enums/EventNames.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/types.d.ts +1 -1
- package/build/esm/types.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/esm/xhr.d.ts +10 -2
- package/build/esm/xhr.js +15 -11
- package/build/esm/xhr.js.map +1 -1
- package/build/esnext/enums/AttributeNames.d.ts +7 -0
- package/build/esnext/enums/AttributeNames.js +23 -0
- package/build/esnext/enums/AttributeNames.js.map +1 -0
- package/build/esnext/enums/EventNames.d.ts +9 -0
- package/build/esnext/enums/EventNames.js +25 -0
- package/build/esnext/enums/EventNames.js.map +1 -0
- package/build/esnext/index.d.ts +2 -0
- package/build/esnext/index.js +17 -0
- package/build/esnext/index.js.map +1 -0
- package/build/esnext/types.d.ts +29 -0
- package/build/esnext/types.js +17 -0
- package/build/esnext/types.js.map +1 -0
- package/build/esnext/version.d.ts +2 -0
- package/build/esnext/version.js +18 -0
- package/build/esnext/version.js.map +1 -0
- package/build/esnext/xhr.d.ts +126 -0
- package/build/esnext/xhr.js +392 -0
- package/build/esnext/xhr.js.map +1 -0
- package/build/src/enums/AttributeNames.js.map +1 -1
- package/build/src/enums/EventNames.js.map +1 -1
- package/build/src/index.js.map +1 -1
- package/build/src/types.d.ts +1 -1
- package/build/src/types.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/build/src/xhr.d.ts +10 -2
- package/build/src/xhr.js +24 -19
- package/build/src/xhr.js.map +1 -1
- package/package.json +34 -26
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright The OpenTelemetry Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as api from '@opentelemetry/api';
|
|
17
|
+
import { isWrapped, InstrumentationBase, safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation';
|
|
18
|
+
import { hrTime, isUrlIgnored, otperformance } from '@opentelemetry/core';
|
|
19
|
+
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
|
20
|
+
import { addSpanNetworkEvents, getResource, PerformanceTimingNames as PTN, shouldPropagateTraceHeaders } from '@opentelemetry/sdk-trace-web';
|
|
21
|
+
import { EventNames } from './enums/EventNames';
|
|
22
|
+
import { VERSION } from './version';
|
|
23
|
+
import { AttributeNames } from './enums/AttributeNames';
|
|
24
|
+
function parseUrl(url) {
|
|
25
|
+
const element = document.createElement('a');
|
|
26
|
+
element.href = url;
|
|
27
|
+
return element;
|
|
28
|
+
}
|
|
29
|
+
// how long to wait for observer to collect information about resources
|
|
30
|
+
// this is needed as event "load" is called before observer
|
|
31
|
+
// hard to say how long it should really wait, seems like 300ms is
|
|
32
|
+
// safe enough
|
|
33
|
+
const OBSERVER_WAIT_TIME_MS = 300;
|
|
34
|
+
/**
|
|
35
|
+
* This class represents a XMLHttpRequest plugin for auto instrumentation
|
|
36
|
+
*/
|
|
37
|
+
export class XMLHttpRequestInstrumentation extends InstrumentationBase {
|
|
38
|
+
constructor(config) {
|
|
39
|
+
super('@opentelemetry/instrumentation-xml-http-request', VERSION, config);
|
|
40
|
+
this.component = 'xml-http-request';
|
|
41
|
+
this.version = VERSION;
|
|
42
|
+
this.moduleName = this.component;
|
|
43
|
+
this._tasksCount = 0;
|
|
44
|
+
this._xhrMem = new WeakMap();
|
|
45
|
+
this._usedResources = new WeakSet();
|
|
46
|
+
}
|
|
47
|
+
init() { }
|
|
48
|
+
_getConfig() {
|
|
49
|
+
return this._config;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Adds custom headers to XMLHttpRequest
|
|
53
|
+
* @param xhr
|
|
54
|
+
* @param spanUrl
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
_addHeaders(xhr, spanUrl) {
|
|
58
|
+
const url = parseUrl(spanUrl).href;
|
|
59
|
+
if (!shouldPropagateTraceHeaders(url, this._getConfig().propagateTraceHeaderCorsUrls)) {
|
|
60
|
+
const headers = {};
|
|
61
|
+
api.propagation.inject(api.context.active(), headers);
|
|
62
|
+
if (Object.keys(headers).length > 0) {
|
|
63
|
+
this._diag.debug('headers inject skipped due to CORS policy');
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const headers = {};
|
|
68
|
+
api.propagation.inject(api.context.active(), headers);
|
|
69
|
+
Object.keys(headers).forEach(key => {
|
|
70
|
+
xhr.setRequestHeader(key, String(headers[key]));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Add cors pre flight child span
|
|
75
|
+
* @param span
|
|
76
|
+
* @param corsPreFlightRequest
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
_addChildSpan(span, corsPreFlightRequest) {
|
|
80
|
+
api.context.with(api.trace.setSpan(api.context.active(), span), () => {
|
|
81
|
+
const childSpan = this.tracer.startSpan('CORS Preflight', {
|
|
82
|
+
startTime: corsPreFlightRequest[PTN.FETCH_START],
|
|
83
|
+
});
|
|
84
|
+
addSpanNetworkEvents(childSpan, corsPreFlightRequest);
|
|
85
|
+
childSpan.end(corsPreFlightRequest[PTN.RESPONSE_END]);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Add attributes when span is going to end
|
|
90
|
+
* @param span
|
|
91
|
+
* @param xhr
|
|
92
|
+
* @param spanUrl
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
_addFinalSpanAttributes(span, xhrMem, spanUrl) {
|
|
96
|
+
if (typeof spanUrl === 'string') {
|
|
97
|
+
const parsedUrl = parseUrl(spanUrl);
|
|
98
|
+
if (xhrMem.status !== undefined) {
|
|
99
|
+
span.setAttribute(SemanticAttributes.HTTP_STATUS_CODE, xhrMem.status);
|
|
100
|
+
}
|
|
101
|
+
if (xhrMem.statusText !== undefined) {
|
|
102
|
+
span.setAttribute(AttributeNames.HTTP_STATUS_TEXT, xhrMem.statusText);
|
|
103
|
+
}
|
|
104
|
+
span.setAttribute(SemanticAttributes.HTTP_HOST, parsedUrl.host);
|
|
105
|
+
span.setAttribute(SemanticAttributes.HTTP_SCHEME, parsedUrl.protocol.replace(':', ''));
|
|
106
|
+
// @TODO do we want to collect this or it will be collected earlier once only or
|
|
107
|
+
// maybe when parent span is not available ?
|
|
108
|
+
span.setAttribute(SemanticAttributes.HTTP_USER_AGENT, navigator.userAgent);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
_applyAttributesAfterXHR(span, xhr) {
|
|
112
|
+
const applyCustomAttributesOnSpan = this._getConfig()
|
|
113
|
+
.applyCustomAttributesOnSpan;
|
|
114
|
+
if (typeof applyCustomAttributesOnSpan === 'function') {
|
|
115
|
+
safeExecuteInTheMiddle(() => applyCustomAttributesOnSpan(span, xhr), error => {
|
|
116
|
+
if (!error) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
this._diag.error('applyCustomAttributesOnSpan', error);
|
|
120
|
+
}, true);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* will collect information about all resources created
|
|
125
|
+
* between "send" and "end" with additional waiting for main resource
|
|
126
|
+
* @param xhr
|
|
127
|
+
* @param spanUrl
|
|
128
|
+
* @private
|
|
129
|
+
*/
|
|
130
|
+
_addResourceObserver(xhr, spanUrl) {
|
|
131
|
+
const xhrMem = this._xhrMem.get(xhr);
|
|
132
|
+
if (!xhrMem ||
|
|
133
|
+
PerformanceObserver == null ||
|
|
134
|
+
PerformanceResourceTiming == null) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
xhrMem.createdResources = {
|
|
138
|
+
observer: new PerformanceObserver(list => {
|
|
139
|
+
const entries = list.getEntries();
|
|
140
|
+
const parsedUrl = parseUrl(spanUrl);
|
|
141
|
+
entries.forEach(entry => {
|
|
142
|
+
if (entry.initiatorType === 'xmlhttprequest' &&
|
|
143
|
+
entry.name === parsedUrl.href) {
|
|
144
|
+
if (xhrMem.createdResources) {
|
|
145
|
+
xhrMem.createdResources.entries.push(entry);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}),
|
|
150
|
+
entries: [],
|
|
151
|
+
};
|
|
152
|
+
xhrMem.createdResources.observer.observe({
|
|
153
|
+
entryTypes: ['resource'],
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Clears the resource timings and all resources assigned with spans
|
|
158
|
+
* when {@link XMLHttpRequestInstrumentationConfig.clearTimingResources} is
|
|
159
|
+
* set to true (default false)
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
_clearResources() {
|
|
163
|
+
if (this._tasksCount === 0 && this._getConfig().clearTimingResources) {
|
|
164
|
+
otperformance.clearResourceTimings();
|
|
165
|
+
this._xhrMem = new WeakMap();
|
|
166
|
+
this._usedResources = new WeakSet();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Finds appropriate resource and add network events to the span
|
|
171
|
+
* @param span
|
|
172
|
+
*/
|
|
173
|
+
_findResourceAndAddNetworkEvents(xhrMem, span, spanUrl, startTime, endTime) {
|
|
174
|
+
if (!spanUrl || !startTime || !endTime || !xhrMem.createdResources) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
let resources = xhrMem.createdResources.entries;
|
|
178
|
+
if (!resources || !resources.length) {
|
|
179
|
+
// fallback - either Observer is not available or it took longer
|
|
180
|
+
// then OBSERVER_WAIT_TIME_MS and observer didn't collect enough
|
|
181
|
+
// information
|
|
182
|
+
// ts thinks this is the perf_hooks module, but it is the browser performance api
|
|
183
|
+
resources = otperformance.getEntriesByType('resource');
|
|
184
|
+
}
|
|
185
|
+
const resource = getResource(parseUrl(spanUrl).href, startTime, endTime, resources, this._usedResources);
|
|
186
|
+
if (resource.mainRequest) {
|
|
187
|
+
const mainRequest = resource.mainRequest;
|
|
188
|
+
this._markResourceAsUsed(mainRequest);
|
|
189
|
+
const corsPreFlightRequest = resource.corsPreFlightRequest;
|
|
190
|
+
if (corsPreFlightRequest) {
|
|
191
|
+
this._addChildSpan(span, corsPreFlightRequest);
|
|
192
|
+
this._markResourceAsUsed(corsPreFlightRequest);
|
|
193
|
+
}
|
|
194
|
+
addSpanNetworkEvents(span, mainRequest);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Removes the previous information about span.
|
|
199
|
+
* This might happened when the same xhr is used again.
|
|
200
|
+
* @param xhr
|
|
201
|
+
* @private
|
|
202
|
+
*/
|
|
203
|
+
_cleanPreviousSpanInformation(xhr) {
|
|
204
|
+
const xhrMem = this._xhrMem.get(xhr);
|
|
205
|
+
if (xhrMem) {
|
|
206
|
+
const callbackToRemoveEvents = xhrMem.callbackToRemoveEvents;
|
|
207
|
+
if (callbackToRemoveEvents) {
|
|
208
|
+
callbackToRemoveEvents();
|
|
209
|
+
}
|
|
210
|
+
this._xhrMem.delete(xhr);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Creates a new span when method "open" is called
|
|
215
|
+
* @param xhr
|
|
216
|
+
* @param url
|
|
217
|
+
* @param method
|
|
218
|
+
* @private
|
|
219
|
+
*/
|
|
220
|
+
_createSpan(xhr, url, method) {
|
|
221
|
+
if (isUrlIgnored(url, this._getConfig().ignoreUrls)) {
|
|
222
|
+
this._diag.debug('ignoring span as url matches ignored url');
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const spanName = `HTTP ${method.toUpperCase()}`;
|
|
226
|
+
const currentSpan = this.tracer.startSpan(spanName, {
|
|
227
|
+
kind: api.SpanKind.CLIENT,
|
|
228
|
+
attributes: {
|
|
229
|
+
[SemanticAttributes.HTTP_METHOD]: method,
|
|
230
|
+
[SemanticAttributes.HTTP_URL]: url,
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
currentSpan.addEvent(EventNames.METHOD_OPEN);
|
|
234
|
+
this._cleanPreviousSpanInformation(xhr);
|
|
235
|
+
this._xhrMem.set(xhr, {
|
|
236
|
+
span: currentSpan,
|
|
237
|
+
spanUrl: url,
|
|
238
|
+
});
|
|
239
|
+
return currentSpan;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Marks certain [resource]{@link PerformanceResourceTiming} when information
|
|
243
|
+
* from this is used to add events to span.
|
|
244
|
+
* This is done to avoid reusing the same resource again for next span
|
|
245
|
+
* @param resource
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
_markResourceAsUsed(resource) {
|
|
249
|
+
this._usedResources.add(resource);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Patches the method open
|
|
253
|
+
* @private
|
|
254
|
+
*/
|
|
255
|
+
_patchOpen() {
|
|
256
|
+
return (original) => {
|
|
257
|
+
const plugin = this;
|
|
258
|
+
return function patchOpen(...args) {
|
|
259
|
+
const method = args[0];
|
|
260
|
+
const url = args[1];
|
|
261
|
+
plugin._createSpan(this, url, method);
|
|
262
|
+
return original.apply(this, args);
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Patches the method send
|
|
268
|
+
* @private
|
|
269
|
+
*/
|
|
270
|
+
_patchSend() {
|
|
271
|
+
const plugin = this;
|
|
272
|
+
function endSpanTimeout(eventName, xhrMem, endTime) {
|
|
273
|
+
const callbackToRemoveEvents = xhrMem.callbackToRemoveEvents;
|
|
274
|
+
if (typeof callbackToRemoveEvents === 'function') {
|
|
275
|
+
callbackToRemoveEvents();
|
|
276
|
+
}
|
|
277
|
+
const { span, spanUrl, sendStartTime } = xhrMem;
|
|
278
|
+
if (span) {
|
|
279
|
+
plugin._findResourceAndAddNetworkEvents(xhrMem, span, spanUrl, sendStartTime, endTime);
|
|
280
|
+
span.addEvent(eventName, endTime);
|
|
281
|
+
plugin._addFinalSpanAttributes(span, xhrMem, spanUrl);
|
|
282
|
+
span.end(endTime);
|
|
283
|
+
plugin._tasksCount--;
|
|
284
|
+
}
|
|
285
|
+
plugin._clearResources();
|
|
286
|
+
}
|
|
287
|
+
function endSpan(eventName, xhr) {
|
|
288
|
+
const xhrMem = plugin._xhrMem.get(xhr);
|
|
289
|
+
if (!xhrMem) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
xhrMem.status = xhr.status;
|
|
293
|
+
xhrMem.statusText = xhr.statusText;
|
|
294
|
+
plugin._xhrMem.delete(xhr);
|
|
295
|
+
if (xhrMem.span) {
|
|
296
|
+
plugin._applyAttributesAfterXHR(xhrMem.span, xhr);
|
|
297
|
+
}
|
|
298
|
+
const endTime = hrTime();
|
|
299
|
+
// the timeout is needed as observer doesn't have yet information
|
|
300
|
+
// when event "load" is called. Also the time may differ depends on
|
|
301
|
+
// browser and speed of computer
|
|
302
|
+
setTimeout(() => {
|
|
303
|
+
endSpanTimeout(eventName, xhrMem, endTime);
|
|
304
|
+
}, OBSERVER_WAIT_TIME_MS);
|
|
305
|
+
}
|
|
306
|
+
function onError() {
|
|
307
|
+
endSpan(EventNames.EVENT_ERROR, this);
|
|
308
|
+
}
|
|
309
|
+
function onAbort() {
|
|
310
|
+
endSpan(EventNames.EVENT_ABORT, this);
|
|
311
|
+
}
|
|
312
|
+
function onTimeout() {
|
|
313
|
+
endSpan(EventNames.EVENT_TIMEOUT, this);
|
|
314
|
+
}
|
|
315
|
+
function onLoad() {
|
|
316
|
+
if (this.status < 299) {
|
|
317
|
+
endSpan(EventNames.EVENT_LOAD, this);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
endSpan(EventNames.EVENT_ERROR, this);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function unregister(xhr) {
|
|
324
|
+
xhr.removeEventListener('abort', onAbort);
|
|
325
|
+
xhr.removeEventListener('error', onError);
|
|
326
|
+
xhr.removeEventListener('load', onLoad);
|
|
327
|
+
xhr.removeEventListener('timeout', onTimeout);
|
|
328
|
+
const xhrMem = plugin._xhrMem.get(xhr);
|
|
329
|
+
if (xhrMem) {
|
|
330
|
+
xhrMem.callbackToRemoveEvents = undefined;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return (original) => {
|
|
334
|
+
return function patchSend(...args) {
|
|
335
|
+
const xhrMem = plugin._xhrMem.get(this);
|
|
336
|
+
if (!xhrMem) {
|
|
337
|
+
return original.apply(this, args);
|
|
338
|
+
}
|
|
339
|
+
const currentSpan = xhrMem.span;
|
|
340
|
+
const spanUrl = xhrMem.spanUrl;
|
|
341
|
+
if (currentSpan && spanUrl) {
|
|
342
|
+
api.context.with(api.trace.setSpan(api.context.active(), currentSpan), () => {
|
|
343
|
+
plugin._tasksCount++;
|
|
344
|
+
xhrMem.sendStartTime = hrTime();
|
|
345
|
+
currentSpan.addEvent(EventNames.METHOD_SEND);
|
|
346
|
+
this.addEventListener('abort', onAbort);
|
|
347
|
+
this.addEventListener('error', onError);
|
|
348
|
+
this.addEventListener('load', onLoad);
|
|
349
|
+
this.addEventListener('timeout', onTimeout);
|
|
350
|
+
xhrMem.callbackToRemoveEvents = () => {
|
|
351
|
+
unregister(this);
|
|
352
|
+
if (xhrMem.createdResources) {
|
|
353
|
+
xhrMem.createdResources.observer.disconnect();
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
plugin._addHeaders(this, spanUrl);
|
|
357
|
+
plugin._addResourceObserver(this, spanUrl);
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
return original.apply(this, args);
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* implements enable function
|
|
366
|
+
*/
|
|
367
|
+
enable() {
|
|
368
|
+
this._diag.debug('applying patch to', this.moduleName, this.version);
|
|
369
|
+
if (isWrapped(XMLHttpRequest.prototype.open)) {
|
|
370
|
+
this._unwrap(XMLHttpRequest.prototype, 'open');
|
|
371
|
+
this._diag.debug('removing previous patch from method open');
|
|
372
|
+
}
|
|
373
|
+
if (isWrapped(XMLHttpRequest.prototype.send)) {
|
|
374
|
+
this._unwrap(XMLHttpRequest.prototype, 'send');
|
|
375
|
+
this._diag.debug('removing previous patch from method send');
|
|
376
|
+
}
|
|
377
|
+
this._wrap(XMLHttpRequest.prototype, 'open', this._patchOpen());
|
|
378
|
+
this._wrap(XMLHttpRequest.prototype, 'send', this._patchSend());
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* implements disable function
|
|
382
|
+
*/
|
|
383
|
+
disable() {
|
|
384
|
+
this._diag.debug('removing patch from', this.moduleName, this.version);
|
|
385
|
+
this._unwrap(XMLHttpRequest.prototype, 'open');
|
|
386
|
+
this._unwrap(XMLHttpRequest.prototype, 'send');
|
|
387
|
+
this._tasksCount = 0;
|
|
388
|
+
this._xhrMem = new WeakMap();
|
|
389
|
+
this._usedResources = new WeakSet();
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
//# sourceMappingURL=xhr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../src/xhr.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AE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACM,OAAO;QACd,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAEvE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE/C,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,EAA0B,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,IAAI,OAAO,EAA6B,CAAC;IACjE,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 * as api from '@opentelemetry/api';\nimport {\n isWrapped,\n InstrumentationBase,\n InstrumentationConfig,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport { hrTime, isUrlIgnored, otperformance } from '@opentelemetry/core';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport {\n addSpanNetworkEvents,\n getResource,\n PerformanceTimingNames as PTN,\n shouldPropagateTraceHeaders,\n URLLike\n} from '@opentelemetry/sdk-trace-web';\nimport { EventNames } from './enums/EventNames';\nimport {\n OpenFunction,\n PropagateTraceHeaderCorsUrls,\n SendFunction,\n XhrMem,\n} from './types';\nimport { VERSION } from './version';\nimport { AttributeNames } from './enums/AttributeNames';\n\nfunction parseUrl(url: string): URLLike {\n const element = document.createElement('a');\n element.href = url;\n return element;\n}\n\n// how long to wait for observer to collect information about resources\n// this is needed as event \"load\" is called before observer\n// hard to say how long it should really wait, seems like 300ms is\n// safe enough\nconst OBSERVER_WAIT_TIME_MS = 300;\n\nexport type XHRCustomAttributeFunction = (\n span: api.Span,\n xhr: XMLHttpRequest\n) => void;\n\n/**\n * XMLHttpRequest config\n */\nexport interface XMLHttpRequestInstrumentationConfig\n extends InstrumentationConfig {\n /**\n * The number of timing resources is limited, after the limit\n * (chrome 250, safari 150) the information is not collected anymore.\n * The only way to prevent that is to regularly clean the resources\n * whenever it is possible. This is needed only when PerformanceObserver\n * is not available\n */\n clearTimingResources?: boolean;\n /** URLs which should include trace headers when origin doesn't match */\n propagateTraceHeaderCorsUrls?: PropagateTraceHeaderCorsUrls;\n /**\n * URLs that partially match any regex in ignoreUrls will not be traced.\n * In addition, URLs that are _exact matches_ of strings in ignoreUrls will\n * also not be traced.\n */\n ignoreUrls?: Array<string | RegExp>;\n /** Function for adding custom attributes on the span */\n applyCustomAttributesOnSpan?: XHRCustomAttributeFunction;\n}\n\n/**\n * This class represents a XMLHttpRequest plugin for auto instrumentation\n */\nexport class XMLHttpRequestInstrumentation extends InstrumentationBase<XMLHttpRequest> {\n readonly component: string = 'xml-http-request';\n readonly version: string = VERSION;\n moduleName = this.component;\n\n private _tasksCount = 0;\n private _xhrMem = new WeakMap<XMLHttpRequest, XhrMem>();\n private _usedResources = new WeakSet<PerformanceResourceTiming>();\n\n constructor(config?: XMLHttpRequestInstrumentationConfig) {\n super(\n '@opentelemetry/instrumentation-xml-http-request',\n VERSION,\n config\n );\n }\n\n init() {}\n\n private _getConfig(): XMLHttpRequestInstrumentationConfig {\n return this._config;\n }\n\n /**\n * Adds custom headers to XMLHttpRequest\n * @param xhr\n * @param spanUrl\n * @private\n */\n private _addHeaders(xhr: XMLHttpRequest, spanUrl: string) {\n const url = parseUrl(spanUrl).href;\n if (\n !shouldPropagateTraceHeaders(\n url,\n this._getConfig().propagateTraceHeaderCorsUrls\n )\n ) {\n const headers: Partial<Record<string, unknown>> = {};\n api.propagation.inject(api.context.active(), headers);\n if (Object.keys(headers).length > 0) {\n this._diag.debug('headers inject skipped due to CORS policy');\n }\n return;\n }\n const headers: { [key: string]: unknown } = {};\n api.propagation.inject(api.context.active(), headers);\n Object.keys(headers).forEach(key => {\n xhr.setRequestHeader(key, String(headers[key]));\n });\n }\n\n /**\n * Add cors pre flight child span\n * @param span\n * @param corsPreFlightRequest\n * @private\n */\n private _addChildSpan(\n span: api.Span,\n corsPreFlightRequest: PerformanceResourceTiming\n ): void {\n api.context.with(api.trace.setSpan(api.context.active(), span), () => {\n const childSpan = this.tracer.startSpan('CORS Preflight', {\n startTime: corsPreFlightRequest[PTN.FETCH_START],\n });\n addSpanNetworkEvents(childSpan, corsPreFlightRequest);\n childSpan.end(corsPreFlightRequest[PTN.RESPONSE_END]);\n });\n }\n\n /**\n * Add attributes when span is going to end\n * @param span\n * @param xhr\n * @param spanUrl\n * @private\n */\n _addFinalSpanAttributes(span: api.Span, xhrMem: XhrMem, spanUrl?: string) {\n if (typeof spanUrl === 'string') {\n const parsedUrl = parseUrl(spanUrl);\n if (xhrMem.status !== undefined) {\n span.setAttribute(SemanticAttributes.HTTP_STATUS_CODE, xhrMem.status);\n }\n if (xhrMem.statusText !== undefined) {\n span.setAttribute(AttributeNames.HTTP_STATUS_TEXT, xhrMem.statusText);\n }\n span.setAttribute(SemanticAttributes.HTTP_HOST, parsedUrl.host);\n span.setAttribute(\n SemanticAttributes.HTTP_SCHEME,\n parsedUrl.protocol.replace(':', '')\n );\n\n // @TODO do we want to collect this or it will be collected earlier once only or\n // maybe when parent span is not available ?\n span.setAttribute(\n SemanticAttributes.HTTP_USER_AGENT,\n navigator.userAgent\n );\n }\n }\n\n private _applyAttributesAfterXHR(span: api.Span, xhr: XMLHttpRequest) {\n const applyCustomAttributesOnSpan = this._getConfig()\n .applyCustomAttributesOnSpan;\n if (typeof applyCustomAttributesOnSpan === 'function') {\n safeExecuteInTheMiddle(\n () => applyCustomAttributesOnSpan(span, xhr),\n error => {\n if (!error) {\n return;\n }\n\n this._diag.error('applyCustomAttributesOnSpan', error);\n },\n true\n );\n }\n }\n\n /**\n * will collect information about all resources created\n * between \"send\" and \"end\" with additional waiting for main resource\n * @param xhr\n * @param spanUrl\n * @private\n */\n private _addResourceObserver(xhr: XMLHttpRequest, spanUrl: string) {\n const xhrMem = this._xhrMem.get(xhr);\n if (\n !xhrMem ||\n PerformanceObserver == null ||\n PerformanceResourceTiming == null\n ) {\n return;\n }\n xhrMem.createdResources = {\n observer: new PerformanceObserver(list => {\n const entries = list.getEntries() as PerformanceResourceTiming[];\n const parsedUrl = parseUrl(spanUrl);\n\n entries.forEach(entry => {\n if (\n entry.initiatorType === 'xmlhttprequest' &&\n entry.name === parsedUrl.href\n ) {\n if (xhrMem.createdResources) {\n xhrMem.createdResources.entries.push(entry);\n }\n }\n });\n }),\n entries: [],\n };\n xhrMem.createdResources.observer.observe({\n entryTypes: ['resource'],\n });\n }\n\n /**\n * Clears the resource timings and all resources assigned with spans\n * when {@link XMLHttpRequestInstrumentationConfig.clearTimingResources} is\n * set to true (default false)\n * @private\n */\n private _clearResources() {\n if (this._tasksCount === 0 && this._getConfig().clearTimingResources) {\n ((otperformance as unknown) as Performance).clearResourceTimings();\n this._xhrMem = new WeakMap<XMLHttpRequest, XhrMem>();\n this._usedResources = new WeakSet<PerformanceResourceTiming>();\n }\n }\n\n /**\n * Finds appropriate resource and add network events to the span\n * @param span\n */\n private _findResourceAndAddNetworkEvents(\n xhrMem: XhrMem,\n span: api.Span,\n spanUrl?: string,\n startTime?: api.HrTime,\n endTime?: api.HrTime\n ): void {\n if (!spanUrl || !startTime || !endTime || !xhrMem.createdResources) {\n return;\n }\n\n let resources: PerformanceResourceTiming[] =\n xhrMem.createdResources.entries;\n\n if (!resources || !resources.length) {\n // fallback - either Observer is not available or it took longer\n // then OBSERVER_WAIT_TIME_MS and observer didn't collect enough\n // information\n // ts thinks this is the perf_hooks module, but it is the browser performance api\n resources = ((otperformance as unknown) as Performance).getEntriesByType(\n 'resource'\n ) as PerformanceResourceTiming[];\n }\n\n const resource = getResource(\n parseUrl(spanUrl).href,\n startTime,\n endTime,\n resources,\n this._usedResources\n );\n\n if (resource.mainRequest) {\n const mainRequest = resource.mainRequest;\n this._markResourceAsUsed(mainRequest);\n\n const corsPreFlightRequest = resource.corsPreFlightRequest;\n if (corsPreFlightRequest) {\n this._addChildSpan(span, corsPreFlightRequest);\n this._markResourceAsUsed(corsPreFlightRequest);\n }\n addSpanNetworkEvents(span, mainRequest);\n }\n }\n\n /**\n * Removes the previous information about span.\n * This might happened when the same xhr is used again.\n * @param xhr\n * @private\n */\n private _cleanPreviousSpanInformation(xhr: XMLHttpRequest) {\n const xhrMem = this._xhrMem.get(xhr);\n if (xhrMem) {\n const callbackToRemoveEvents = xhrMem.callbackToRemoveEvents;\n if (callbackToRemoveEvents) {\n callbackToRemoveEvents();\n }\n this._xhrMem.delete(xhr);\n }\n }\n\n /**\n * Creates a new span when method \"open\" is called\n * @param xhr\n * @param url\n * @param method\n * @private\n */\n private _createSpan(\n xhr: XMLHttpRequest,\n url: string,\n method: string\n ): api.Span | undefined {\n if (isUrlIgnored(url, this._getConfig().ignoreUrls)) {\n this._diag.debug('ignoring span as url matches ignored url');\n return;\n }\n const spanName = `HTTP ${method.toUpperCase()}`;\n\n const currentSpan = this.tracer.startSpan(spanName, {\n kind: api.SpanKind.CLIENT,\n attributes: {\n [SemanticAttributes.HTTP_METHOD]: method,\n [SemanticAttributes.HTTP_URL]: url,\n },\n });\n\n currentSpan.addEvent(EventNames.METHOD_OPEN);\n\n this._cleanPreviousSpanInformation(xhr);\n\n this._xhrMem.set(xhr, {\n span: currentSpan,\n spanUrl: url,\n });\n\n return currentSpan;\n }\n\n /**\n * Marks certain [resource]{@link PerformanceResourceTiming} when information\n * from this is used to add events to span.\n * This is done to avoid reusing the same resource again for next span\n * @param resource\n * @private\n */\n private _markResourceAsUsed(resource: PerformanceResourceTiming) {\n this._usedResources.add(resource);\n }\n\n /**\n * Patches the method open\n * @private\n */\n protected _patchOpen() {\n return (original: OpenFunction): OpenFunction => {\n const plugin = this;\n return function patchOpen(this: XMLHttpRequest, ...args): void {\n const method: string = args[0];\n const url: string = args[1];\n plugin._createSpan(this, url, method);\n\n return original.apply(this, args);\n };\n };\n }\n\n /**\n * Patches the method send\n * @private\n */\n protected _patchSend() {\n const plugin = this;\n\n function endSpanTimeout(\n eventName: string,\n xhrMem: XhrMem,\n endTime: api.HrTime\n ) {\n const callbackToRemoveEvents = xhrMem.callbackToRemoveEvents;\n\n if (typeof callbackToRemoveEvents === 'function') {\n callbackToRemoveEvents();\n }\n\n const { span, spanUrl, sendStartTime } = xhrMem;\n\n if (span) {\n plugin._findResourceAndAddNetworkEvents(\n xhrMem,\n span,\n spanUrl,\n sendStartTime,\n endTime\n );\n span.addEvent(eventName, endTime);\n plugin._addFinalSpanAttributes(span, xhrMem, spanUrl);\n span.end(endTime);\n plugin._tasksCount--;\n }\n plugin._clearResources();\n }\n\n function endSpan(eventName: string, xhr: XMLHttpRequest) {\n const xhrMem = plugin._xhrMem.get(xhr);\n if (!xhrMem) {\n return;\n }\n xhrMem.status = xhr.status;\n xhrMem.statusText = xhr.statusText;\n plugin._xhrMem.delete(xhr);\n\n if (xhrMem.span) {\n plugin._applyAttributesAfterXHR(xhrMem.span, xhr);\n }\n const endTime = hrTime();\n\n // the timeout is needed as observer doesn't have yet information\n // when event \"load\" is called. Also the time may differ depends on\n // browser and speed of computer\n setTimeout(() => {\n endSpanTimeout(eventName, xhrMem, endTime);\n }, OBSERVER_WAIT_TIME_MS);\n }\n\n function onError(this: XMLHttpRequest) {\n endSpan(EventNames.EVENT_ERROR, this);\n }\n\n function onAbort(this: XMLHttpRequest) {\n endSpan(EventNames.EVENT_ABORT, this);\n }\n\n function onTimeout(this: XMLHttpRequest) {\n endSpan(EventNames.EVENT_TIMEOUT, this);\n }\n\n function onLoad(this: XMLHttpRequest) {\n if (this.status < 299) {\n endSpan(EventNames.EVENT_LOAD, this);\n } else {\n endSpan(EventNames.EVENT_ERROR, this);\n }\n }\n\n function unregister(xhr: XMLHttpRequest) {\n xhr.removeEventListener('abort', onAbort);\n xhr.removeEventListener('error', onError);\n xhr.removeEventListener('load', onLoad);\n xhr.removeEventListener('timeout', onTimeout);\n const xhrMem = plugin._xhrMem.get(xhr);\n if (xhrMem) {\n xhrMem.callbackToRemoveEvents = undefined;\n }\n }\n\n return (original: SendFunction): SendFunction => {\n return function patchSend(this: XMLHttpRequest, ...args): void {\n const xhrMem = plugin._xhrMem.get(this);\n if (!xhrMem) {\n return original.apply(this, args);\n }\n const currentSpan = xhrMem.span;\n const spanUrl = xhrMem.spanUrl;\n\n if (currentSpan && spanUrl) {\n api.context.with(\n api.trace.setSpan(api.context.active(), currentSpan),\n () => {\n plugin._tasksCount++;\n xhrMem.sendStartTime = hrTime();\n currentSpan.addEvent(EventNames.METHOD_SEND);\n\n this.addEventListener('abort', onAbort);\n this.addEventListener('error', onError);\n this.addEventListener('load', onLoad);\n this.addEventListener('timeout', onTimeout);\n\n xhrMem.callbackToRemoveEvents = () => {\n unregister(this);\n if (xhrMem.createdResources) {\n xhrMem.createdResources.observer.disconnect();\n }\n };\n plugin._addHeaders(this, spanUrl);\n plugin._addResourceObserver(this, spanUrl);\n }\n );\n }\n return original.apply(this, args);\n };\n };\n }\n\n /**\n * implements enable function\n */\n override enable() {\n this._diag.debug('applying patch to', this.moduleName, this.version);\n\n if (isWrapped(XMLHttpRequest.prototype.open)) {\n this._unwrap(XMLHttpRequest.prototype, 'open');\n this._diag.debug('removing previous patch from method open');\n }\n\n if (isWrapped(XMLHttpRequest.prototype.send)) {\n this._unwrap(XMLHttpRequest.prototype, 'send');\n this._diag.debug('removing previous patch from method send');\n }\n\n this._wrap(XMLHttpRequest.prototype, 'open', this._patchOpen());\n this._wrap(XMLHttpRequest.prototype, 'send', this._patchSend());\n }\n\n /**\n * implements disable function\n */\n override disable() {\n this._diag.debug('removing patch from', this.moduleName, this.version);\n\n this._unwrap(XMLHttpRequest.prototype, 'open');\n this._unwrap(XMLHttpRequest.prototype, 'send');\n\n this._tasksCount = 0;\n this._xhrMem = new WeakMap<XMLHttpRequest, XhrMem>();\n this._usedResources = new WeakSet<PerformanceResourceTiming>();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributeNames.js","sourceRoot":"","sources":["../../../src/enums/AttributeNames.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,uDAAqC,CAAA;AACvC,CAAC,EAFW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAEzB"}
|
|
1
|
+
{"version":3,"file":"AttributeNames.js","sourceRoot":"","sources":["../../../src/enums/AttributeNames.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,uDAAqC,CAAA;AACvC,CAAC,EAFW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAEzB","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\n/**\n * https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/http.md\n */\nexport enum AttributeNames {\n HTTP_STATUS_TEXT = 'http.status_text',\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventNames.js","sourceRoot":"","sources":["../../../src/enums/EventNames.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,kCAAoB,CAAA;IACpB,kCAAoB,CAAA;IACpB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;IACrB,uCAAyB,CAAA;AAC3B,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB"}
|
|
1
|
+
{"version":3,"file":"EventNames.js","sourceRoot":"","sources":["../../../src/enums/EventNames.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,kCAAoB,CAAA;IACpB,kCAAoB,CAAA;IACpB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;IACrB,uCAAyB,CAAA;AAC3B,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB","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 EventNames {\n METHOD_OPEN = 'open',\n METHOD_SEND = 'send',\n EVENT_ABORT = 'abort',\n EVENT_ERROR = 'error',\n EVENT_LOAD = 'loaded',\n EVENT_TIMEOUT = 'timeout',\n}\n"]}
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,wCAAsB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;AAEH,wCAAsB","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 * from './xhr';\n"]}
|
package/build/src/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type OpenFunction = (method: string, url: string, async?: boolean
|
|
|
6
6
|
/**
|
|
7
7
|
* method "send" from XMLHttpRequest
|
|
8
8
|
*/
|
|
9
|
-
export declare type SendFunction =
|
|
9
|
+
export declare type SendFunction = typeof XMLHttpRequest.prototype.send;
|
|
10
10
|
export declare type SendBody = string | Document | Blob | ArrayBufferView | ArrayBuffer | FormData | URLSearchParams | ReadableStream<Uint8Array> | null;
|
|
11
11
|
/**
|
|
12
12
|
* interface to store information in weak map about spans, resources and
|
package/build/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","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 * as api from '@opentelemetry/api';\n\n/**\n * method \"open\" from XMLHttpRequest\n */\nexport type OpenFunction = (\n method: string,\n url: string,\n async?: boolean,\n user?: string | null,\n pass?: string | null\n) => void;\n\n/**\n * method \"send\" from XMLHttpRequest\n */\nexport type SendFunction = typeof XMLHttpRequest.prototype.send;\n\nexport type SendBody =\n | string\n | Document\n | Blob\n | ArrayBufferView\n | ArrayBuffer\n | FormData\n // eslint-disable-next-line node/no-unsupported-features/node-builtins\n | URLSearchParams\n | ReadableStream<Uint8Array>\n | null;\n\n/**\n * interface to store information in weak map about spans, resources and\n * callbacks\n */\nexport interface XhrMem {\n status?: number;\n statusText?: string;\n // span assigned to xhr\n span: api.Span;\n // span url - not available on types.Span\n spanUrl?: string;\n // startTime of send function - used to filter cors preflight requests\n sendStartTime?: api.HrTime;\n // resources created between send and end plus some additional timeout\n createdResources?: {\n observer: PerformanceObserver;\n entries: PerformanceResourceTiming[];\n };\n // callback to remove events from xhr once the span ends\n callbackToRemoveEvents?: Function;\n}\n\nexport type PropagateTraceHeaderCorsUrl = string | RegExp;\n\nexport type PropagateTraceHeaderCorsUrls =\n | PropagateTraceHeaderCorsUrl\n | PropagateTraceHeaderCorsUrl[];\n"]}
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.28.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/build/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,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\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.28.0';\n"]}
|
package/build/src/xhr.d.ts
CHANGED
|
@@ -6,7 +6,15 @@ export declare type XHRCustomAttributeFunction = (span: api.Span, xhr: XMLHttpRe
|
|
|
6
6
|
* XMLHttpRequest config
|
|
7
7
|
*/
|
|
8
8
|
export interface XMLHttpRequestInstrumentationConfig extends InstrumentationConfig {
|
|
9
|
+
/**
|
|
10
|
+
* The number of timing resources is limited, after the limit
|
|
11
|
+
* (chrome 250, safari 150) the information is not collected anymore.
|
|
12
|
+
* The only way to prevent that is to regularly clean the resources
|
|
13
|
+
* whenever it is possible. This is needed only when PerformanceObserver
|
|
14
|
+
* is not available
|
|
15
|
+
*/
|
|
9
16
|
clearTimingResources?: boolean;
|
|
17
|
+
/** URLs which should include trace headers when origin doesn't match */
|
|
10
18
|
propagateTraceHeaderCorsUrls?: PropagateTraceHeaderCorsUrls;
|
|
11
19
|
/**
|
|
12
20
|
* URLs that partially match any regex in ignoreUrls will not be traced.
|
|
@@ -27,13 +35,13 @@ export declare class XMLHttpRequestInstrumentation extends InstrumentationBase<X
|
|
|
27
35
|
private _tasksCount;
|
|
28
36
|
private _xhrMem;
|
|
29
37
|
private _usedResources;
|
|
30
|
-
constructor(config?: XMLHttpRequestInstrumentationConfig
|
|
38
|
+
constructor(config?: XMLHttpRequestInstrumentationConfig);
|
|
31
39
|
init(): void;
|
|
32
40
|
private _getConfig;
|
|
33
41
|
/**
|
|
34
42
|
* Adds custom headers to XMLHttpRequest
|
|
35
43
|
* @param xhr
|
|
36
|
-
* @param
|
|
44
|
+
* @param spanUrl
|
|
37
45
|
* @private
|
|
38
46
|
*/
|
|
39
47
|
private _addHeaders;
|