Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@opentelemetry/instrumentation-xml-http-request
Advanced tools
OpenTelemetry XMLHttpRequest automatic instrumentation package.
This module provides auto instrumentation for web using XMLHttpRequest .
npm install --save @opentelemetry/instrumentation-xml-http-request
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
import { ZoneContextManager } from '@opentelemetry/context-zone';
// this is still possible
const providerWithZone = new WebTracerProvider({
plugins: [
new XMLHttpRequestInstrumentation({
propagateTraceHeaderCorsUrls: ['http://localhost:8090']
})
]
});
providerWithZone.register({
contextManager: new ZoneContextManager(),
});
const webTracerWithZone = providerWithZone.getTracer('default');
/////////////////////////////////////////
// or plugin can be also initialised separately and then set the tracer provider or meter provider
const xmlHttpRequestInstrumentation = new XMLHttpRequestInstrumentation({
propagateTraceHeaderCorsUrls: ['http://localhost:8090']
});
const providerWithZone = new WebTracerProvider();
providerWithZone.register({
contextManager: new ZoneContextManager(),
});
xmlHttpRequestInstrumentation.setTracerProvider(providerWithZone);
/////////////////////////////////////////
providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
// and some test
const req = new XMLHttpRequest();
req.open('GET', 'http://localhost:8090/xml-http-request.js', true);
req.send();
See examples/tracer-web for a short example.
Apache 2.0 - See LICENSE for more information.
FAQs
OpenTelemetry instrumentation for XMLHttpRequest http client in web browsers
The npm package @opentelemetry/instrumentation-xml-http-request receives a total of 269,454 weekly downloads. As such, @opentelemetry/instrumentation-xml-http-request popularity was classified as popular.
We found that @opentelemetry/instrumentation-xml-http-request demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.