Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@opentelemetry/instrumentation-xml-http-request
Advanced tools
OpenTelemetry XMLHttpRequest automatic instrumentation package.
Note: This is an experimental package under active development. New releases may include breaking changes.
This module provides auto instrumentation for web using XMLHttpRequest .
npm install --save @opentelemetry/instrumentation-xml-http-request
import {
ConsoleSpanExporter,
SimpleSpanProcessor,
WebTracerProvider,
} from '@opentelemetry/sdk-trace-web';
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
const providerWithZone = new WebTracerProvider();
providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
providerWithZone.register({
contextManager: new ZoneContextManager(),
});
registerInstrumentations({
instrumentations: [
new XMLHttpRequestInstrumentation({
propagateTraceHeaderCorsUrls: ['http://localhost:8090']
}),
],
});
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);
/////////////////////////////////////////
// and some test
const req = new XMLHttpRequest();
req.open('GET', 'http://localhost:8090/xml-http-request.js', true);
req.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) |
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 168,341 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
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.