Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@opentelemetry/plugin-xml-http-request

0.9.0 • Public • Published

OpenTelemetry XMLHttpRequest Instrumentation for web

Gitter chat NPM Published Version dependencies devDependencies Apache License

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

Screenshot of the running example Screenshot of the running example Screenshot of the running example

See examples/tracer-web for a short example.

Useful links

License

Apache 2.0 - See LICENSE for more information.

Install

npm i @opentelemetry/plugin-xml-http-request

DownloadsWeekly Downloads

159

Version

0.9.0

License

Apache-2.0

Unpacked Size

41.9 kB

Total Files

15

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar