JSPM

  • Created
  • Published
  • Downloads 1889429
  • Score
    100M100P100Q223456F
  • License Apache-2.0

Metapackage which bundles opentelemetry node core and contrib instrumentations

Package Exports

  • @opentelemetry/auto-instrumentations-node

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@opentelemetry/auto-instrumentations-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OpenTelemetry Meta Packages for Node

NPM Published Version dependencies devDependencies Apache License

Installation

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

Usage

const { NodeTracerProvider } = require('@opentelemetry/node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector');
const { SimpleSpanProcessor } = require('@opentelemetry/tracing');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');

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

const provider = new NodeTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.register();

registerInstrumentations({
  instrumentations: [
    getNodeAutoInstrumentations({
      // load custom configuration for http instrumentation
      "@opentelemetry/instrumentation-http": {
        applyCustomAttributesOnSpan: (span)=> {
          span.setAttribute('foo2', 'bar2');
        },
      },
    }),
  ],
});

License

APACHE 2.0 - See LICENSE for more information.