@opentelemetry/instrumentation-fetch 0.222.0 → 0.300.0-development.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.
Files changed (85) hide show
  1. package/README.md +14 -11
  2. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  3. package/dist/fetch.cjs +318 -0
  4. package/dist/fetch.cjs.map +1 -0
  5. package/dist/fetch.d.cts +121 -0
  6. package/dist/fetch.d.cts.map +1 -0
  7. package/dist/fetch.d.mts +121 -0
  8. package/dist/fetch.d.mts.map +1 -0
  9. package/dist/fetch.mjs +315 -0
  10. package/dist/fetch.mjs.map +1 -0
  11. package/dist/index.cjs +3 -0
  12. package/dist/index.d.cts +2 -0
  13. package/dist/index.d.mts +2 -0
  14. package/dist/index.mjs +2 -0
  15. package/dist/semconv.cjs +13 -0
  16. package/dist/semconv.cjs.map +1 -0
  17. package/dist/semconv.mjs +13 -0
  18. package/dist/semconv.mjs.map +1 -0
  19. package/dist/types.d.cts +12 -0
  20. package/dist/types.d.cts.map +1 -0
  21. package/dist/types.d.mts +12 -0
  22. package/dist/types.d.mts.map +1 -0
  23. package/dist/utils.cjs +157 -0
  24. package/dist/utils.cjs.map +1 -0
  25. package/dist/utils.mjs +154 -0
  26. package/dist/utils.mjs.map +1 -0
  27. package/dist/version.cjs +6 -0
  28. package/dist/version.cjs.map +1 -0
  29. package/dist/version.mjs +6 -0
  30. package/dist/version.mjs.map +1 -0
  31. package/package.json +36 -34
  32. package/build/esm/fetch.d.ts +0 -118
  33. package/build/esm/fetch.js +0 -412
  34. package/build/esm/fetch.js.map +0 -1
  35. package/build/esm/index.d.ts +0 -3
  36. package/build/esm/index.js +0 -6
  37. package/build/esm/index.js.map +0 -1
  38. package/build/esm/semconv.d.ts +0 -9
  39. package/build/esm/semconv.js +0 -18
  40. package/build/esm/semconv.js.map +0 -1
  41. package/build/esm/types.d.ts +0 -27
  42. package/build/esm/types.js +0 -6
  43. package/build/esm/types.js.map +0 -1
  44. package/build/esm/utils.d.ts +0 -43
  45. package/build/esm/utils.js +0 -205
  46. package/build/esm/utils.js.map +0 -1
  47. package/build/esm/version.d.ts +0 -2
  48. package/build/esm/version.js +0 -7
  49. package/build/esm/version.js.map +0 -1
  50. package/build/esnext/fetch.d.ts +0 -118
  51. package/build/esnext/fetch.js +0 -412
  52. package/build/esnext/fetch.js.map +0 -1
  53. package/build/esnext/index.d.ts +0 -3
  54. package/build/esnext/index.js +0 -6
  55. package/build/esnext/index.js.map +0 -1
  56. package/build/esnext/semconv.d.ts +0 -9
  57. package/build/esnext/semconv.js +0 -18
  58. package/build/esnext/semconv.js.map +0 -1
  59. package/build/esnext/types.d.ts +0 -27
  60. package/build/esnext/types.js +0 -6
  61. package/build/esnext/types.js.map +0 -1
  62. package/build/esnext/utils.d.ts +0 -43
  63. package/build/esnext/utils.js +0 -205
  64. package/build/esnext/utils.js.map +0 -1
  65. package/build/esnext/version.d.ts +0 -2
  66. package/build/esnext/version.js +0 -7
  67. package/build/esnext/version.js.map +0 -1
  68. package/build/src/fetch.d.ts +0 -118
  69. package/build/src/fetch.js +0 -416
  70. package/build/src/fetch.js.map +0 -1
  71. package/build/src/index.d.ts +0 -3
  72. package/build/src/index.js +0 -10
  73. package/build/src/index.js.map +0 -1
  74. package/build/src/semconv.d.ts +0 -9
  75. package/build/src/semconv.js +0 -21
  76. package/build/src/semconv.js.map +0 -1
  77. package/build/src/types.d.ts +0 -27
  78. package/build/src/types.js +0 -7
  79. package/build/src/types.js.map +0 -1
  80. package/build/src/utils.d.ts +0 -43
  81. package/build/src/utils.js +0 -212
  82. package/build/src/utils.js.map +0 -1
  83. package/build/src/version.d.ts +0 -2
  84. package/build/src/version.js +0 -10
  85. package/build/src/version.js.map +0 -1
@@ -1,416 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.FetchInstrumentation = void 0;
8
- const api_1 = require("@opentelemetry/api");
9
- const instrumentation_1 = require("@opentelemetry/instrumentation");
10
- const core = require("@opentelemetry/core");
11
- const web = require("@opentelemetry/sdk-trace-web");
12
- const semconv_1 = require("./semconv");
13
- const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
14
- const utils_1 = require("./utils");
15
- const version_1 = require("./version");
16
- // how long to wait for observer to collect information about resources
17
- // this is needed as event "load" is called before observer
18
- // hard to say how long it should really wait, seems like 300ms is
19
- // safe enough
20
- const OBSERVER_WAIT_TIME_MS = 300;
21
- const hasBrowserPerformanceAPI = typeof PerformanceObserver !== 'undefined';
22
- /**
23
- * This class represents a fetch plugin for auto instrumentation
24
- */
25
- class FetchInstrumentation extends instrumentation_1.InstrumentationBase {
26
- component = 'fetch';
27
- version = version_1.VERSION;
28
- moduleName = this.component;
29
- _usedResources = new WeakSet();
30
- _tasksCount = 0;
31
- constructor(config = {}) {
32
- super('@opentelemetry/instrumentation-fetch', version_1.VERSION, config);
33
- }
34
- init() { }
35
- /**
36
- * Add cors pre flight child span
37
- * @param span
38
- * @param corsPreFlightRequest
39
- */
40
- _addChildSpan(span, corsPreFlightRequest) {
41
- const childSpan = this.tracer.startSpan('CORS Preflight', {
42
- startTime: corsPreFlightRequest[web.PerformanceTimingNames.FETCH_START],
43
- }, api_1.trace.setSpan(api_1.context.active(), span));
44
- web.addSpanNetworkEvents(childSpan, corsPreFlightRequest, this.getConfig().ignoreNetworkEvents, undefined, true);
45
- childSpan.end(corsPreFlightRequest[web.PerformanceTimingNames.RESPONSE_END]);
46
- }
47
- /**
48
- * Adds more attributes to span just before ending it
49
- * @param span
50
- * @param response
51
- */
52
- _addFinalSpanAttributes(span, response) {
53
- const parsedUrl = web.parseUrl(response.url);
54
- span.setAttribute(semantic_conventions_1.ATTR_HTTP_RESPONSE_STATUS_CODE, response.status);
55
- // TODO: Set server.{address,port} at span creation for sampling decisions
56
- // (a "SHOULD" requirement in semconv).
57
- span.setAttribute(semantic_conventions_1.ATTR_SERVER_ADDRESS, parsedUrl.hostname);
58
- const serverPort = (0, utils_1.serverPortFromUrl)(parsedUrl);
59
- if (serverPort) {
60
- span.setAttribute(semantic_conventions_1.ATTR_SERVER_PORT, serverPort);
61
- }
62
- }
63
- /**
64
- * Add headers
65
- * @param options
66
- * @param spanUrl
67
- */
68
- _addHeaders(options, spanUrl) {
69
- if (!web.shouldPropagateTraceHeaders(spanUrl, this.getConfig().propagateTraceHeaderCorsUrls)) {
70
- const headers = {};
71
- api_1.propagation.inject(api_1.context.active(), headers);
72
- if (Object.keys(headers).length > 0) {
73
- this._diag.debug('headers inject skipped due to CORS policy');
74
- }
75
- return;
76
- }
77
- if (options instanceof Request) {
78
- // This mutates `Request.headers` in-place, because it is read-only
79
- // (per https://developer.mozilla.org/en-US/docs/Web/API/Request/headers),
80
- // so we cannot (easily) replace it.
81
- api_1.propagation.inject(api_1.context.active(), options.headers, {
82
- set: (h, k, v) => h.set(k, typeof v === 'string' ? v : String(v)),
83
- });
84
- }
85
- else {
86
- // Otherwise, create a new Headers to avoid mutating the caller's
87
- // possibly re-used headers.
88
- const headers = new Headers(options.headers);
89
- api_1.propagation.inject(api_1.context.active(), headers, {
90
- set: (h, k, v) => h.set(k, typeof v === 'string' ? v : String(v)),
91
- });
92
- options.headers = headers;
93
- }
94
- }
95
- /**
96
- * Clears the resource timings and all resources assigned with spans
97
- * when {@link FetchPluginConfig.clearTimingResources} is
98
- * set to true (default false)
99
- * @private
100
- */
101
- _clearResources() {
102
- if (this._tasksCount === 0 && this.getConfig().clearTimingResources) {
103
- performance.clearResourceTimings();
104
- this._usedResources = new WeakSet();
105
- }
106
- }
107
- /**
108
- * Creates a new span
109
- * @param url
110
- * @param options
111
- */
112
- _createSpan(url, options = {}) {
113
- if (core.isUrlIgnored(url, this.getConfig().ignoreUrls)) {
114
- this._diag.debug('ignoring span as url matches ignored url');
115
- return;
116
- }
117
- const attributes = {};
118
- const origMethod = options.method;
119
- const normMethod = (0, utils_1.normalizeHttpRequestMethod)(options.method || 'GET');
120
- const name = normMethod;
121
- attributes[semantic_conventions_1.ATTR_HTTP_REQUEST_METHOD] = normMethod;
122
- if (normMethod !== origMethod) {
123
- attributes[semantic_conventions_1.ATTR_HTTP_REQUEST_METHOD_ORIGINAL] = origMethod;
124
- }
125
- attributes[semantic_conventions_1.ATTR_URL_FULL] = url;
126
- return this.tracer.startSpan(name, {
127
- kind: api_1.SpanKind.CLIENT,
128
- attributes,
129
- });
130
- }
131
- /**
132
- * Finds appropriate resource and add network events to the span
133
- * @param span
134
- * @param resourcesObserver
135
- * @param endTime
136
- */
137
- _findResourceAndAddNetworkEvents(span, resourcesObserver, endTime) {
138
- let resources = resourcesObserver.entries;
139
- if (!resources.length) {
140
- if (!performance.getEntriesByType) {
141
- return;
142
- }
143
- // fallback - either Observer is not available or it took longer
144
- // then OBSERVER_WAIT_TIME_MS and observer didn't collect enough
145
- // information
146
- resources = performance.getEntriesByType('resource');
147
- }
148
- const resource = web.getResource(resourcesObserver.spanUrl, resourcesObserver.startTime, endTime, resources, this._usedResources, 'fetch');
149
- if (resource.mainRequest) {
150
- const mainRequest = resource.mainRequest;
151
- this._markResourceAsUsed(mainRequest);
152
- const corsPreFlightRequest = resource.corsPreFlightRequest;
153
- if (corsPreFlightRequest) {
154
- this._addChildSpan(span, corsPreFlightRequest);
155
- this._markResourceAsUsed(corsPreFlightRequest);
156
- }
157
- web.addSpanNetworkEvents(span, mainRequest, this.getConfig().ignoreNetworkEvents, undefined, true);
158
- }
159
- }
160
- /**
161
- * Marks certain [resource]{@link PerformanceResourceTiming} when information
162
- * from this is used to add events to span.
163
- * This is done to avoid reusing the same resource again for next span
164
- * @param resource
165
- */
166
- _markResourceAsUsed(resource) {
167
- this._usedResources.add(resource);
168
- }
169
- /**
170
- * Finish span, add attributes, network events etc.
171
- * @param span
172
- * @param spanData
173
- * @param response
174
- */
175
- _endSpan(span, spanData, response) {
176
- const endTime = core.millisToHrTime(Date.now());
177
- const performanceEndTime = core.hrTime();
178
- this._addFinalSpanAttributes(span, response);
179
- // https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#status
180
- if (response.status >= 400) {
181
- span.setStatus({ code: api_1.SpanStatusCode.ERROR });
182
- span.setAttribute(semantic_conventions_1.ATTR_ERROR_TYPE, String(response.status));
183
- }
184
- setTimeout(() => {
185
- spanData.observer?.disconnect();
186
- this._findResourceAndAddNetworkEvents(span, spanData, performanceEndTime);
187
- this._tasksCount--;
188
- this._clearResources();
189
- span.end(endTime);
190
- }, OBSERVER_WAIT_TIME_MS);
191
- }
192
- /**
193
- * Patches the constructor of fetch
194
- */
195
- _patchConstructor() {
196
- return original => {
197
- const plugin = this;
198
- return function patchConstructor(...args) {
199
- if (!plugin._isEnabled) {
200
- return original.apply(this, args);
201
- }
202
- const self = this;
203
- const url = web.parseUrl(args[0] instanceof Request ? args[0].url : String(args[0])).href;
204
- // Per the Fetch spec, when fetch() is called with a Request object
205
- // and a separate init object, the init properties override the
206
- // Request's properties. Merge them into a new Request so that
207
- // downstream consumers (hooks, header injection, the actual fetch
208
- // call) see the correct final values.
209
- // See: https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#parameters
210
- let options;
211
- if (args[0] instanceof Request) {
212
- options = args[1] != null ? new Request(args[0], args[1]) : args[0];
213
- }
214
- else {
215
- options = args[1] || {};
216
- }
217
- const createdSpan = plugin._createSpan(url, options);
218
- if (!createdSpan) {
219
- return original.apply(this, args);
220
- }
221
- const spanData = plugin._prepareSpanData(url);
222
- if (plugin.getConfig().measureRequestSize) {
223
- (0, utils_1.getFetchBodyLength)(...args)
224
- .then(bodyLength => {
225
- if (!bodyLength)
226
- return;
227
- createdSpan.setAttribute(semconv_1.ATTR_HTTP_REQUEST_BODY_SIZE, bodyLength);
228
- })
229
- .catch(error => {
230
- plugin._diag.warn('getFetchBodyLength', error);
231
- });
232
- }
233
- function endSpanOnError(span, error) {
234
- plugin._applyAttributesAfterFetch(span, options, error);
235
- plugin._endSpan(span, spanData, {
236
- status: error.status || 0,
237
- statusText: error.message,
238
- url,
239
- });
240
- }
241
- function endSpanOnSuccess(span, response) {
242
- plugin._applyAttributesAfterFetch(span, options, response);
243
- if (response.status >= 200 && response.status < 400) {
244
- plugin._endSpan(span, spanData, response);
245
- }
246
- else {
247
- plugin._endSpan(span, spanData, {
248
- status: response.status,
249
- statusText: response.statusText,
250
- url,
251
- });
252
- }
253
- }
254
- function onSuccess(span, response) {
255
- try {
256
- // Clone the response and eagerly consume the clone to detect
257
- // when the body transfer completes. The original response is
258
- // returned to the caller untouched so that it passes internal
259
- // brand-checks required by APIs such as
260
- // WebAssembly.compileStreaming.
261
- // TODO: Switch to a consumer-driven model and drop `resClone`.
262
- // Keeping eager consumption here to preserve current behavior and avoid breaking existing tests.
263
- // Context: discussion in PR #5894 → https://github.com/open-telemetry/opentelemetry-js/pull/5894
264
- const resClone = response.clone();
265
- const body = resClone.body;
266
- if (body) {
267
- const reader = body.getReader();
268
- const read = () => {
269
- reader.read().then(({ done }) => {
270
- if (done) {
271
- endSpanOnSuccess(span, response);
272
- }
273
- else {
274
- read();
275
- }
276
- }, error => {
277
- endSpanOnError(span, error);
278
- });
279
- };
280
- read();
281
- }
282
- else {
283
- // some older browsers don't have .body implemented
284
- endSpanOnSuccess(span, response);
285
- }
286
- }
287
- catch (error) {
288
- // Setup failed (e.g. clone() or getReader() threw).
289
- // End the span and clean up so _tasksCount doesn't leak.
290
- plugin._diag.error('Failed to read fetch response body', error);
291
- plugin._endSpan(span, spanData, {
292
- status: 0,
293
- url,
294
- });
295
- }
296
- return response;
297
- }
298
- function onError(span, error) {
299
- try {
300
- endSpanOnError(span, error);
301
- }
302
- catch (e) {
303
- // endSpanOnError failed — fall back to ending the span
304
- // directly so _tasksCount doesn't leak.
305
- plugin._diag.error('Failed to end span on fetch error', e);
306
- plugin._endSpan(span, spanData, {
307
- status: error.status || 0,
308
- url,
309
- });
310
- }
311
- throw error;
312
- }
313
- return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), createdSpan), () => {
314
- // Call request hook before injection so hooks cannot tamper with propagation headers.
315
- // Also, this means the hook will see `options.headers` in the same type as passed in,
316
- // rather than as a `Headers` instance set by `_addHeaders()`.
317
- plugin._callRequestHook(createdSpan, options);
318
- plugin._addHeaders(options, url);
319
- plugin._tasksCount++;
320
- return original
321
- .apply(self, options instanceof Request ? [options] : [url, options])
322
- .then(onSuccess.bind(self, createdSpan), onError.bind(self, createdSpan));
323
- });
324
- };
325
- };
326
- }
327
- _applyAttributesAfterFetch(span, request, result) {
328
- const applyCustomAttributesOnSpan = this.getConfig().applyCustomAttributesOnSpan;
329
- if (applyCustomAttributesOnSpan) {
330
- (0, instrumentation_1.safeExecuteInTheMiddle)(() => applyCustomAttributesOnSpan(span, request, result), error => {
331
- if (!error) {
332
- return;
333
- }
334
- this._diag.error('applyCustomAttributesOnSpan', error);
335
- }, true);
336
- }
337
- }
338
- _callRequestHook(span, request) {
339
- const requestHook = this.getConfig().requestHook;
340
- if (requestHook) {
341
- (0, instrumentation_1.safeExecuteInTheMiddle)(() => requestHook(span, request), error => {
342
- if (!error) {
343
- return;
344
- }
345
- this._diag.error('requestHook', error);
346
- }, true);
347
- }
348
- }
349
- /**
350
- * Prepares a span data - needed later for matching appropriate network
351
- * resources
352
- * @param spanUrl
353
- */
354
- _prepareSpanData(spanUrl) {
355
- const startTime = core.hrTime();
356
- const entries = [];
357
- if (typeof PerformanceObserver !== 'function') {
358
- return { entries, startTime, spanUrl };
359
- }
360
- const observer = new PerformanceObserver(list => {
361
- const perfObsEntries = list.getEntries();
362
- perfObsEntries.forEach(entry => {
363
- if (entry.initiatorType === 'fetch' && entry.name === spanUrl) {
364
- entries.push(entry);
365
- }
366
- });
367
- });
368
- observer.observe({
369
- entryTypes: ['resource'],
370
- });
371
- return { entries, observer, startTime, spanUrl };
372
- }
373
- /**
374
- * implements enable function
375
- */
376
- enable() {
377
- if (!hasBrowserPerformanceAPI) {
378
- this._diag.warn('this instrumentation is intended for web usage only, it does not instrument server-side fetch()');
379
- return;
380
- }
381
- if (this._isEnabled) {
382
- return;
383
- }
384
- if (this._isFetchPatched) {
385
- this._diag.debug('fetch constructor already patched');
386
- this._isEnabled = true;
387
- return;
388
- }
389
- try {
390
- // `_wrap` throws if a third-party script has locked globalThis.fetch via
391
- // Object.defineProperty(window, 'fetch', { writable: false, ... }).
392
- this._wrap(globalThis, 'fetch', this._patchConstructor());
393
- this._isFetchPatched = true;
394
- this._isEnabled = true;
395
- }
396
- catch (err) {
397
- this._diag.warn('Failed to patch globalThis.fetch; instrumentation will not be enabled. ' +
398
- 'Another script may have locked globalThis.fetch via Object.defineProperty.', err);
399
- }
400
- }
401
- /**
402
- * deactivates fetch instrumentation
403
- */
404
- disable() {
405
- if (!hasBrowserPerformanceAPI) {
406
- return;
407
- }
408
- if (!this._isEnabled) {
409
- return;
410
- }
411
- this._isEnabled = false;
412
- this._usedResources = new WeakSet();
413
- }
414
- }
415
- exports.FetchInstrumentation = FetchInstrumentation;
416
- //# sourceMappingURL=fetch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/fetch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4CAM4B;AAG5B,oEAGwC;AACxC,4CAA4C;AAC5C,oDAAoD;AACpD,uCAAwD;AACxD,8EAQ6C;AAE7C,mCAIiB;AACjB,uCAAoC;AAEpC,uEAAuE;AACvE,2DAA2D;AAC3D,kEAAkE;AAClE,cAAc;AACd,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAM,wBAAwB,GAAG,OAAO,mBAAmB,KAAK,WAAW,CAAC;AA0C5E;;GAEG;AACH,MAAa,oBAAqB,SAAQ,qCAA+C;IAC9E,SAAS,GAAW,OAAO,CAAC;IAC5B,OAAO,GAAW,iBAAO,CAAC;IACnC,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC;IACpB,cAAc,GAAG,IAAI,OAAO,EAA6B,CAAC;IA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SACxB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,IAAI,CACb,yEAAyE;gBACvE,4EAA4E,EAC9E,GAAG,CACJ,CAAC;SACH;IACH,CAAC;IAED;;OAEG;IACM,OAAO;QACd,IAAI,CAAC,wBAAwB,EAAE;YAC7B,OAAO;SACR;QACD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,OAAO;SACR;QACD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,IAAI,OAAO,EAA6B,CAAC;IACjE,CAAC;CACF;AA3fD,oDA2fC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n context,\n propagation,\n SpanKind,\n SpanStatusCode,\n trace,\n} from '@opentelemetry/api';\nimport type { Attributes, HrTime, Span } from '@opentelemetry/api';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport {\n InstrumentationBase,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport * as core from '@opentelemetry/core';\nimport * as web from '@opentelemetry/sdk-trace-web';\nimport { ATTR_HTTP_REQUEST_BODY_SIZE } from './semconv';\nimport {\n ATTR_ERROR_TYPE,\n ATTR_HTTP_REQUEST_METHOD,\n ATTR_HTTP_REQUEST_METHOD_ORIGINAL,\n ATTR_HTTP_RESPONSE_STATUS_CODE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n ATTR_URL_FULL,\n} from '@opentelemetry/semantic-conventions';\nimport type { FetchError, FetchResponse, SpanData } from './types';\nimport {\n getFetchBodyLength,\n normalizeHttpRequestMethod,\n serverPortFromUrl,\n} from './utils';\nimport { VERSION } from './version';\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\nconst hasBrowserPerformanceAPI = typeof PerformanceObserver !== 'undefined';\n\nexport interface FetchCustomAttributeFunction {\n (\n span: Span,\n request: Request | RequestInit,\n result: Response | FetchError\n ): void;\n}\n\nexport interface FetchRequestHookFunction {\n (span: Span, request: Request | RequestInit): void;\n}\n\n/**\n * FetchPlugin Config\n */\nexport interface FetchInstrumentationConfig extends InstrumentationConfig {\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 clearTimingResources?: boolean;\n // urls which should include trace headers when origin doesn't match\n propagateTraceHeaderCorsUrls?: web.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?: FetchCustomAttributeFunction;\n /** Function for adding custom attributes or headers before the request is handled */\n requestHook?: FetchRequestHookFunction;\n // Ignore adding network events as span events\n ignoreNetworkEvents?: boolean;\n /** Measure outgoing request size */\n measureRequestSize?: boolean;\n}\n\n/**\n * This class represents a fetch plugin for auto instrumentation\n */\nexport class FetchInstrumentation extends InstrumentationBase<FetchInstrumentationConfig> {\n readonly component: string = 'fetch';\n readonly version: string = VERSION;\n moduleName = this.component;\n private _usedResources = new WeakSet<PerformanceResourceTiming>();\n private _tasksCount = 0;\n\n // Note: Intentionally *not* using `_enabled` as the field name to avoid\n // any possible confusion with the `_enabled` field used on the *Node.js*\n // InstrumentationBase class.\n // Also not initializing the fields to `false` because the base class\n // constructor already call `enable` modifying their values and it will\n // set the instrumentaitons in a bas state (enabled, patched but with flags set to false)\n declare private _isEnabled: boolean;\n declare private _isFetchPatched: boolean;\n\n constructor(config: FetchInstrumentationConfig = {}) {\n super('@opentelemetry/instrumentation-fetch', VERSION, config);\n }\n\n init(): void {}\n\n /**\n * Add cors pre flight child span\n * @param span\n * @param corsPreFlightRequest\n */\n private _addChildSpan(\n span: Span,\n corsPreFlightRequest: PerformanceResourceTiming\n ): void {\n const childSpan = this.tracer.startSpan(\n 'CORS Preflight',\n {\n startTime: corsPreFlightRequest[web.PerformanceTimingNames.FETCH_START],\n },\n trace.setSpan(context.active(), span)\n );\n web.addSpanNetworkEvents(\n childSpan,\n corsPreFlightRequest,\n this.getConfig().ignoreNetworkEvents,\n undefined,\n true\n );\n childSpan.end(\n corsPreFlightRequest[web.PerformanceTimingNames.RESPONSE_END]\n );\n }\n\n /**\n * Adds more attributes to span just before ending it\n * @param span\n * @param response\n */\n private _addFinalSpanAttributes(span: Span, response: FetchResponse): void {\n const parsedUrl = web.parseUrl(response.url);\n span.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE, response.status);\n // TODO: Set server.{address,port} at span creation for sampling decisions\n // (a \"SHOULD\" requirement in semconv).\n span.setAttribute(ATTR_SERVER_ADDRESS, parsedUrl.hostname);\n const serverPort = serverPortFromUrl(parsedUrl);\n if (serverPort) {\n span.setAttribute(ATTR_SERVER_PORT, serverPort);\n }\n }\n\n /**\n * Add headers\n * @param options\n * @param spanUrl\n */\n private _addHeaders(options: Request | RequestInit, spanUrl: string): void {\n if (\n !web.shouldPropagateTraceHeaders(\n spanUrl,\n this.getConfig().propagateTraceHeaderCorsUrls\n )\n ) {\n const headers: Partial<Record<string, unknown>> = {};\n propagation.inject(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\n if (options instanceof Request) {\n // This mutates `Request.headers` in-place, because it is read-only\n // (per https://developer.mozilla.org/en-US/docs/Web/API/Request/headers),\n // so we cannot (easily) replace it.\n propagation.inject(context.active(), options.headers, {\n set: (h, k, v) => h.set(k, typeof v === 'string' ? v : String(v)),\n });\n } else {\n // Otherwise, create a new Headers to avoid mutating the caller's\n // possibly re-used headers.\n const headers = new Headers(options.headers);\n propagation.inject(context.active(), headers, {\n set: (h, k, v) => h.set(k, typeof v === 'string' ? v : String(v)),\n });\n options.headers = headers;\n }\n }\n\n /**\n * Clears the resource timings and all resources assigned with spans\n * when {@link FetchPluginConfig.clearTimingResources} is\n * set to true (default false)\n * @private\n */\n private _clearResources() {\n if (this._tasksCount === 0 && this.getConfig().clearTimingResources) {\n performance.clearResourceTimings();\n this._usedResources = new WeakSet<PerformanceResourceTiming>();\n }\n }\n\n /**\n * Creates a new span\n * @param url\n * @param options\n */\n private _createSpan(\n url: string,\n options: Partial<Request | RequestInit> = {}\n ): Span | undefined {\n if (core.isUrlIgnored(url, this.getConfig().ignoreUrls)) {\n this._diag.debug('ignoring span as url matches ignored url');\n return;\n }\n\n const attributes = {} as Attributes;\n const origMethod = options.method;\n const normMethod = normalizeHttpRequestMethod(options.method || 'GET');\n const name = normMethod;\n\n attributes[ATTR_HTTP_REQUEST_METHOD] = normMethod;\n if (normMethod !== origMethod) {\n attributes[ATTR_HTTP_REQUEST_METHOD_ORIGINAL] = origMethod;\n }\n attributes[ATTR_URL_FULL] = url;\n\n return this.tracer.startSpan(name, {\n kind: SpanKind.CLIENT,\n attributes,\n });\n }\n\n /**\n * Finds appropriate resource and add network events to the span\n * @param span\n * @param resourcesObserver\n * @param endTime\n */\n private _findResourceAndAddNetworkEvents(\n span: Span,\n resourcesObserver: SpanData,\n endTime: HrTime\n ): void {\n let resources: PerformanceResourceTiming[] = resourcesObserver.entries;\n if (!resources.length) {\n if (!performance.getEntriesByType) {\n return;\n }\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 resources = performance.getEntriesByType(\n 'resource'\n ) as PerformanceResourceTiming[];\n }\n const resource = web.getResource(\n resourcesObserver.spanUrl,\n resourcesObserver.startTime,\n endTime,\n resources,\n this._usedResources,\n 'fetch'\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 web.addSpanNetworkEvents(\n span,\n mainRequest,\n this.getConfig().ignoreNetworkEvents,\n undefined,\n true\n );\n }\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 */\n private _markResourceAsUsed(resource: PerformanceResourceTiming): void {\n this._usedResources.add(resource);\n }\n\n /**\n * Finish span, add attributes, network events etc.\n * @param span\n * @param spanData\n * @param response\n */\n private _endSpan(span: Span, spanData: SpanData, response: FetchResponse) {\n const endTime = core.millisToHrTime(Date.now());\n const performanceEndTime = core.hrTime();\n this._addFinalSpanAttributes(span, response);\n\n // https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#status\n if (response.status >= 400) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n span.setAttribute(ATTR_ERROR_TYPE, String(response.status));\n }\n\n setTimeout(() => {\n spanData.observer?.disconnect();\n this._findResourceAndAddNetworkEvents(span, spanData, performanceEndTime);\n this._tasksCount--;\n this._clearResources();\n span.end(endTime);\n }, OBSERVER_WAIT_TIME_MS);\n }\n\n /**\n * Patches the constructor of fetch\n */\n private _patchConstructor(): (original: typeof fetch) => typeof fetch {\n return original => {\n const plugin = this;\n\n return function patchConstructor(\n this: typeof globalThis,\n ...args: Parameters<typeof fetch>\n ): Promise<Response> {\n if (!plugin._isEnabled) {\n return original.apply(this, args);\n }\n const self = this;\n const url = web.parseUrl(\n args[0] instanceof Request ? args[0].url : String(args[0])\n ).href;\n\n // Per the Fetch spec, when fetch() is called with a Request object\n // and a separate init object, the init properties override the\n // Request's properties. Merge them into a new Request so that\n // downstream consumers (hooks, header injection, the actual fetch\n // call) see the correct final values.\n // See: https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#parameters\n let options: Request | RequestInit;\n if (args[0] instanceof Request) {\n options = args[1] != null ? new Request(args[0], args[1]) : args[0];\n } else {\n options = args[1] || {};\n }\n const createdSpan = plugin._createSpan(url, options);\n if (!createdSpan) {\n return original.apply(this, args);\n }\n const spanData = plugin._prepareSpanData(url);\n\n if (plugin.getConfig().measureRequestSize) {\n getFetchBodyLength(...args)\n .then(bodyLength => {\n if (!bodyLength) return;\n createdSpan.setAttribute(ATTR_HTTP_REQUEST_BODY_SIZE, bodyLength);\n })\n .catch(error => {\n plugin._diag.warn('getFetchBodyLength', error);\n });\n }\n\n function endSpanOnError(span: Span, error: FetchError) {\n plugin._applyAttributesAfterFetch(span, options, error);\n plugin._endSpan(span, spanData, {\n status: error.status || 0,\n statusText: error.message,\n url,\n });\n }\n\n function endSpanOnSuccess(span: Span, response: Response) {\n plugin._applyAttributesAfterFetch(span, options, response);\n if (response.status >= 200 && response.status < 400) {\n plugin._endSpan(span, spanData, response);\n } else {\n plugin._endSpan(span, spanData, {\n status: response.status,\n statusText: response.statusText,\n url,\n });\n }\n }\n\n function onSuccess(span: Span, response: Response): Response {\n try {\n // Clone the response and eagerly consume the clone to detect\n // when the body transfer completes. The original response is\n // returned to the caller untouched so that it passes internal\n // brand-checks required by APIs such as\n // WebAssembly.compileStreaming.\n // TODO: Switch to a consumer-driven model and drop `resClone`.\n // Keeping eager consumption here to preserve current behavior and avoid breaking existing tests.\n // Context: discussion in PR #5894 → https://github.com/open-telemetry/opentelemetry-js/pull/5894\n const resClone = response.clone();\n const body = resClone.body;\n if (body) {\n const reader = body.getReader();\n\n const read = (): void => {\n reader.read().then(\n ({ done }) => {\n if (done) {\n endSpanOnSuccess(span, response);\n } else {\n read();\n }\n },\n error => {\n endSpanOnError(span, error);\n }\n );\n };\n read();\n } else {\n // some older browsers don't have .body implemented\n endSpanOnSuccess(span, response);\n }\n } catch (error) {\n // Setup failed (e.g. clone() or getReader() threw).\n // End the span and clean up so _tasksCount doesn't leak.\n plugin._diag.error('Failed to read fetch response body', error);\n plugin._endSpan(span, spanData, {\n status: 0,\n url,\n });\n }\n return response;\n }\n\n function onError(span: Span, error: FetchError): never {\n try {\n endSpanOnError(span, error);\n } catch (e: unknown) {\n // endSpanOnError failed — fall back to ending the span\n // directly so _tasksCount doesn't leak.\n plugin._diag.error('Failed to end span on fetch error', e);\n plugin._endSpan(span, spanData, {\n status: error.status || 0,\n url,\n });\n }\n\n throw error;\n }\n\n return context.with(\n trace.setSpan(context.active(), createdSpan),\n () => {\n // Call request hook before injection so hooks cannot tamper with propagation headers.\n // Also, this means the hook will see `options.headers` in the same type as passed in,\n // rather than as a `Headers` instance set by `_addHeaders()`.\n plugin._callRequestHook(createdSpan, options);\n plugin._addHeaders(options, url);\n plugin._tasksCount++;\n\n return original\n .apply(\n self,\n options instanceof Request ? [options] : [url, options]\n )\n .then(\n onSuccess.bind(self, createdSpan),\n onError.bind(self, createdSpan)\n );\n }\n );\n };\n };\n }\n\n private _applyAttributesAfterFetch(\n span: Span,\n request: Request | RequestInit,\n result: Response | FetchError\n ) {\n const applyCustomAttributesOnSpan =\n this.getConfig().applyCustomAttributesOnSpan;\n if (applyCustomAttributesOnSpan) {\n safeExecuteInTheMiddle(\n () => applyCustomAttributesOnSpan(span, request, result),\n error => {\n if (!error) {\n return;\n }\n\n this._diag.error('applyCustomAttributesOnSpan', error);\n },\n true\n );\n }\n }\n\n private _callRequestHook(span: Span, request: Request | RequestInit) {\n const requestHook = this.getConfig().requestHook;\n if (requestHook) {\n safeExecuteInTheMiddle(\n () => requestHook(span, request),\n error => {\n if (!error) {\n return;\n }\n\n this._diag.error('requestHook', error);\n },\n true\n );\n }\n }\n\n /**\n * Prepares a span data - needed later for matching appropriate network\n * resources\n * @param spanUrl\n */\n private _prepareSpanData(spanUrl: string): SpanData {\n const startTime = core.hrTime();\n const entries: PerformanceResourceTiming[] = [];\n if (typeof PerformanceObserver !== 'function') {\n return { entries, startTime, spanUrl };\n }\n\n const observer = new PerformanceObserver(list => {\n const perfObsEntries = list.getEntries() as PerformanceResourceTiming[];\n perfObsEntries.forEach(entry => {\n if (entry.initiatorType === 'fetch' && entry.name === spanUrl) {\n entries.push(entry);\n }\n });\n });\n observer.observe({\n entryTypes: ['resource'],\n });\n return { entries, observer, startTime, spanUrl };\n }\n\n /**\n * implements enable function\n */\n override enable(): void {\n if (!hasBrowserPerformanceAPI) {\n this._diag.warn(\n 'this instrumentation is intended for web usage only, it does not instrument server-side fetch()'\n );\n return;\n }\n\n if (this._isEnabled) {\n return;\n }\n\n if (this._isFetchPatched) {\n this._diag.debug('fetch constructor already patched');\n this._isEnabled = true;\n return;\n }\n\n try {\n // `_wrap` throws if a third-party script has locked globalThis.fetch via\n // Object.defineProperty(window, 'fetch', { writable: false, ... }).\n this._wrap(globalThis, 'fetch', this._patchConstructor());\n this._isFetchPatched = true;\n this._isEnabled = true;\n } catch (err) {\n this._diag.warn(\n 'Failed to patch globalThis.fetch; instrumentation will not be enabled. ' +\n 'Another script may have locked globalThis.fetch via Object.defineProperty.',\n err\n );\n }\n }\n\n /**\n * deactivates fetch instrumentation\n */\n override disable(): void {\n if (!hasBrowserPerformanceAPI) {\n return;\n }\n if (!this._isEnabled) {\n return;\n }\n this._isEnabled = false;\n this._usedResources = new WeakSet<PerformanceResourceTiming>();\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- export { FetchInstrumentation } from './fetch';
2
- export type { FetchCustomAttributeFunction, FetchRequestHookFunction, FetchInstrumentationConfig, } from './fetch';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.FetchInstrumentation = void 0;
8
- var fetch_1 = require("./fetch");
9
- Object.defineProperty(exports, "FetchInstrumentation", { enumerable: true, get: function () { return fetch_1.FetchInstrumentation; } });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { FetchInstrumentation } from './fetch';\nexport type {\n FetchCustomAttributeFunction,\n FetchRequestHookFunction,\n FetchInstrumentationConfig,\n} from './fetch';\n"]}
@@ -1,9 +0,0 @@
1
- /**
2
- * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
3
- *
4
- * @example 3495
5
- *
6
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
7
- */
8
- export declare const ATTR_HTTP_REQUEST_BODY_SIZE: "http.request.body.size";
9
- //# sourceMappingURL=semconv.d.ts.map
@@ -1,21 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ATTR_HTTP_REQUEST_BODY_SIZE = void 0;
8
- /*
9
- * This file contains a copy of unstable semantic convention definitions
10
- * used by this package.
11
- * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
12
- */
13
- /**
14
- * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
15
- *
16
- * @example 3495
17
- *
18
- * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
19
- */
20
- exports.ATTR_HTTP_REQUEST_BODY_SIZE = 'http.request.body.size';
21
- //# sourceMappingURL=semconv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AACU,QAAA,2BAA2B,GAAG,wBAAiC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.\n *\n * @example 3495\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_HTTP_REQUEST_BODY_SIZE = 'http.request.body.size' as const;\n"]}
@@ -1,27 +0,0 @@
1
- import type { HrTime } from '@opentelemetry/api';
2
- /**
3
- * Interface used to provide information to finish span on fetch response
4
- */
5
- export interface FetchResponse {
6
- status: number;
7
- statusText?: string;
8
- url: string;
9
- }
10
- /**
11
- * Interface used to provide information to finish span on fetch error
12
- */
13
- export interface FetchError {
14
- status?: number;
15
- message: string;
16
- }
17
- /**
18
- * Interface used to keep information about span between creating and
19
- * ending span
20
- */
21
- export interface SpanData {
22
- entries: PerformanceResourceTiming[];
23
- observer?: PerformanceObserver;
24
- spanUrl: string;
25
- startTime: HrTime;
26
- }
27
- //# sourceMappingURL=types.d.ts.map
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { HrTime } from '@opentelemetry/api';\n\n/**\n * Interface used to provide information to finish span on fetch response\n */\nexport interface FetchResponse {\n status: number;\n statusText?: string;\n url: string;\n}\n\n/**\n * Interface used to provide information to finish span on fetch error\n */\nexport interface FetchError {\n status?: number;\n message: string;\n}\n\n/**\n * Interface used to keep information about span between creating and\n * ending span\n */\nexport interface SpanData {\n entries: PerformanceResourceTiming[];\n observer?: PerformanceObserver;\n spanUrl: string;\n startTime: HrTime;\n}\n"]}
@@ -1,43 +0,0 @@
1
- import type { URLLike } from '@opentelemetry/sdk-trace-web';
2
- /**
3
- * Helper function to determine payload content length for fetch requests
4
- *
5
- * The fetch API is kinda messy: there are a couple of ways the body can be passed in.
6
- *
7
- * In all cases, the body param can be some variation of ReadableStream,
8
- * and ReadableStreams can only be read once! We want to avoid consuming the body here,
9
- * because that would mean that the body never gets sent with the actual fetch request.
10
- *
11
- * Either the first arg is a Request object, which can be cloned
12
- * so we can clone that object and read the body of the clone
13
- * without disturbing the original argument
14
- * However, reading the body here can only be done async; the body() method returns a promise
15
- * this means this entire function has to return a promise
16
- *
17
- * OR the first arg is a url/string
18
- * in which case the second arg has type RequestInit
19
- * RequestInit is NOT cloneable, but RequestInit.body is writable
20
- * so we can chain it into ReadableStream.pipeThrough()
21
- *
22
- * ReadableStream.pipeThrough() lets us process a stream and returns a new stream
23
- * So we can measure the body length as it passes through the pie, but need to attach
24
- * the new stream to the original request
25
- * so that the browser still has access to the body.
26
- *
27
- * @param body
28
- * @returns promise that resolves to the content length of the body
29
- */
30
- export declare function getFetchBodyLength(...args: Parameters<typeof fetch>): Promise<void> | Promise<number | undefined>;
31
- /**
32
- * Helper function to determine payload content length for XHR requests
33
- * @param body
34
- * @returns content length
35
- */
36
- export declare function getXHRBodyLength(body: Document | XMLHttpRequestBodyInit): number | undefined;
37
- /**
38
- * Normalize an HTTP request method string per `http.request.method` spec
39
- * https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-client-span
40
- */
41
- export declare function normalizeHttpRequestMethod(method: string): string;
42
- export declare function serverPortFromUrl(url: URLLike): number | undefined;
43
- //# sourceMappingURL=utils.d.ts.map