OpenTelemetry XMLHttpRequest Instrumentation for web
This module provides auto instrumentation for web using XMLHttpRequest .
Installation
npm install --save @opentelemetry/plugin-xml-http-request
Usage
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracer } from '@opentelemetry/web';
import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request';
import { ZoneContextManager } from '@opentelemetry/context-zone';
const webTracerWithZone = new WebTracer({
contextManager: new ZoneContextManager(),
plugins: [
new XMLHttpRequestPlugin({
propagateTraceHeaderCorsUrls: ['http://localhost:8090']
})
]
});
webTracerWithZone.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();
Example Screenshots
See examples/tracer-web for a short example.
Useful links
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js
- For help or feedback on this project, join us on gitter
License
Apache 2.0 - See LICENSE for more information.