Gathering detailed insights and metrics for @opentelemetry/instrumentation-xml-http-request
Gathering detailed insights and metrics for @opentelemetry/instrumentation-xml-http-request
Gathering detailed insights and metrics for @opentelemetry/instrumentation-xml-http-request
Gathering detailed insights and metrics for @opentelemetry/instrumentation-xml-http-request
@opentelemetry/plugin-xml-http-request
OpenTelemetry XMLHttpRequest automatic instrumentation package.
kelvin-instrumentation-xml-http-request
OpenTelemetry XMLHttpRequest automatic instrumentation package.
@yotamloe/instrumentation-xml-http-request
OpenTelemetry XMLHttpRequest automatic instrumentation package.
middleware.io-instrumentation-xml-http-request
XMLHttpRequest automatic instrumentation package.
OpenTelemetry JavaScript Client
npm install @opentelemetry/instrumentation-xml-http-request
Typescript
Module System
Min. Node Version
Node Version
NPM Version
92.7
Supply Chain
98.8
Quality
92.5
Maintenance
100
Vulnerability
99.3
License
experimental/v0.202.0
Updated on Jun 02, 2025
semconv/v1.34.0
Updated on May 21, 2025
semconv/v1.33.1
Updated on May 20, 2025
experimental/v0.201.1
Updated on May 19, 2025
experimental/v0.201.0
Updated on May 15, 2025
v2.0.1
Updated on May 15, 2025
TypeScript (96.66%)
JavaScript (3.06%)
Jinja (0.19%)
Shell (0.08%)
Total Downloads
22,580,716
Last Day
12,251
Last Week
471,512
Last Month
2,064,321
Last Year
15,399,925
Apache-2.0 License
3,020 Stars
2,703 Commits
899 Forks
53 Watchers
15 Branches
337 Contributors
Updated on Jul 02, 2025
Minified
Minified + Gzipped
Latest Version
0.202.0
Package Id
@opentelemetry/instrumentation-xml-http-request@0.202.0
Unpacked Size
303.22 kB
Size
47.23 kB
File Count
75
NPM Version
lerna/6.6.2/node@v18.20.8+x64 (linux)
Node Version
18.20.8
Published on
Jun 02, 2025
Cumulative downloads
Total Downloads
Last Day
-14.8%
12,251
Compared to previous day
Last Week
-13.6%
471,512
Compared to previous week
Last Month
8.5%
2,064,321
Compared to previous month
Last Year
202.4%
15,399,925
Compared to previous year
4
1
27
Note: This is an experimental package. New releases may include breaking changes.
This module provides auto instrumentation for web using XMLHttpRequest.
1npm install --save @opentelemetry/instrumentation-xml-http-request
1import { 2 ConsoleSpanExporter, 3 SimpleSpanProcessor, 4 WebTracerProvider, 5} from '@opentelemetry/sdk-trace-web'; 6import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request'; 7import { ZoneContextManager } from '@opentelemetry/context-zone'; 8import { registerInstrumentations } from '@opentelemetry/instrumentation'; 9 10const providerWithZone = new WebTracerProvider({ 11 spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())] 12}); 13 14providerWithZone.register({ 15 contextManager: new ZoneContextManager(), 16}); 17 18registerInstrumentations({ 19 instrumentations: [ 20 new XMLHttpRequestInstrumentation({ 21 propagateTraceHeaderCorsUrls: ['http://localhost:8090'] 22 }), 23 ], 24}); 25 26 27const webTracerWithZone = providerWithZone.getTracer('default'); 28 29///////////////////////////////////////// 30 31// or plugin can be also initialised separately and then set the tracer provider or meter provider 32const xmlHttpRequestInstrumentation = new XMLHttpRequestInstrumentation({ 33 propagateTraceHeaderCorsUrls: ['http://localhost:8090'] 34}); 35const providerWithZone = new WebTracerProvider(); 36providerWithZone.register({ 37 contextManager: new ZoneContextManager(), 38}); 39xmlHttpRequestInstrumentation.setTracerProvider(providerWithZone); 40///////////////////////////////////////// 41 42 43// and some test 44const req = new XMLHttpRequest(); 45req.open('GET', 'http://localhost:8090/xml-http-request.js', true); 46req.send();
XHR instrumentation plugin has few options available to choose from. You can set the following:
Options | Type | Description |
---|---|---|
applyCustomAttributesOnSpan | XHRCustomAttributeFunction | Function for adding custom attributes |
ignoreNetworkEvents | boolean | Disable network events being added as span events (network events are added by default) |
measureRequestSize | boolean | Measure outgoing request length (outgoing request length is not measured by default) |
semconvStabilityOptIn | string | A comma-separated string of tokens as described for OTEL_SEMCONV_STABILITY_OPT_IN in the HTTP semantic convention stability migration guide. See the "Semantic Conventions" section below. |
Up to and including v0.200.0, instrumentation-xml-http-request
generates telemetry using Semantic Conventions v1.7.0.
HTTP semantic conventions (semconv) were stabilized in semconv v1.23.0, and a migration process was defined. instrumentation-xml-http-request
versions 0.201.0 and later include support for migrating to stable HTTP semantic conventions, as described below. The intent is to provide an approximate 6 month time window for users of this instrumentation to migrate to the new HTTP semconv, after which a new minor version will change to use the new semconv by default and drop support for the old semconv. See the HTTP semconv migration plan for OpenTelemetry JS instrumentations.
To select which semconv version(s) is emitted from this instrumentation, use the semconvStabilityOptIn
configuration option. This option works as described for OTEL_SEMCONV_STABILITY_OPT_IN
:
http
: emit the new (stable) v1.23.0 semanticshttp/dup
: emit both the old v1.7.0 and the new (stable) v1.23.0 semanticssemconvStabilityOptIn
includes neither of the above tokens, the old v1.7.0 semconv is used.Span status: When the stable semconv is selected, the span status is set to ERROR when the response status code is >=400
or when the response fails with an 'error' or 'timeout' XHR event. When just the old semconv is select, the span status is not set.
Span attributes:
v1.7.0 semconv | v1.23.0 semconv | Notes |
---|---|---|
http.method | http.request.method | HTTP request method. With v1.23.0 semconv http.request.method_original may also be included. |
http.url | url.full | Full HTTP request URL |
http.host | server.address and server.port | The hostname and port of the request URL |
http.status_code | http.response.status_code | HTTP response status code |
http.request_content_length_uncompressed | http.request.body.size | This is only added if measureRequestSize is true . |
http.response_content_length_uncompressed | (not included) | Stable HTTP semconv would use http.response.body.size , but this is an Opt-In attribute, so would require adding a configuration option to this instrumentation to enable. |
http.response_content_length | (not included) | Stable HTTP semconv would use http.response.header.<key> , but this is an Opt-In attribute, so would require adding a configuration option to this instrumentation to enable. |
(no equivalent) | error.type | The response status (as a string), if the response status was >=400 , or one of these possible request errors: 'timeout' and 'error'. |
http.user_agent | (not included) | Stable HTTP semconv would use user_agent.original , but this is an Opt-In attribute, so would require adding a configuration option to this instrumentation to enable. |
http.scheme | (not included) | Stable HTTP semconv would use url.scheme , but this is an Opt-In attribute, so would require adding a configuration option to this instrumentation to enable. |
http.status_text | (not included) | This is no longer a documented semantic conventions attribute. |
See examples/tracer-web for a short example.
Apache 2.0 - See LICENSE for more information.
No vulnerabilities found.
Reason
update tool detected
Details
Reason
30 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 10
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
SAST tool is run on all commits
Details
Reason
30 out of 30 merged PRs checked by a CI test -- score normalized to 10
Reason
project has 43 contributing companies or organizations
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Project has not signed or included provenance with any releases.
Details
Reason
project is not fuzzed
Details
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-02T07:36:17Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More