@opentelemetry/auto-instrumentations-web
TypeScript icon, indicating that this package has built-in type declarations

0.37.0 • Public • Published

OpenTelemetry Meta Packages for Web

NPM Published Version Apache License

Compatible with OpenTelemetry JS API and SDK 1.0+.

Installation

npm install --save @opentelemetry/auto-instrumentations-web

Usage

const { WebTracerProvider } = require('@opentelemetry/sdk-trace-web');
const { getWebAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-web');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector');
const { SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { ZoneContextManager } = require('@opentelemetry/context-zone');
const { B3Propagator } = require('@opentelemetry/propagator-b3');

const exporter = new CollectorTraceExporter({
  serviceName: 'auto-instrumentations-web',
});

const provider = new WebTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.register({
  contextManager: new ZoneContextManager(),
  propagator: new B3Propagator(),
});

registerInstrumentations({
  instrumentations: [
    getWebAutoInstrumentations({
      // load custom configuration for xml-http-request instrumentation
      '@opentelemetry/instrumentation-xml-http-request': {
        clearTimingResources: true,
      },
    }),
  ],
});

Supported instrumentations

Useful links

License

APACHE 2.0 - See LICENSE for more information.

Dependencies (5)

Dev Dependencies (24)

Package Sidebar

Install

npm i @opentelemetry/auto-instrumentations-web

Weekly Downloads

43,504

Version

0.37.0

License

Apache-2.0

Unpacked Size

46.2 kB

Total Files

21

Last publish

Collaborators

  • pichlermarc
  • bogdandrutu
  • dyladan