opentelemetry-js/packages/opentelemetry-plugin-mongodb
Daniel Dyla 9a3fd7b560
Rename scope to context (#853)
2020-03-13 15:01:07 -04:00
..
src feat: use context-based tracing (#816) 2020-03-02 13:47:35 -05:00
test Rename scope to context (#853) 2020-03-13 15:01:07 -04:00
.npmignore feat: port mongodb-core plugin to mongodb #622 (#652) 2020-01-03 10:30:04 -08:00
LICENSE feat: port mongodb-core plugin to mongodb #622 (#652) 2020-01-03 10:30:04 -08:00
README.md chore: rename registry to provider (#749) 2020-02-03 10:36:12 -08:00
package.json Rename scope to context (#853) 2020-03-13 15:01:07 -04:00
tsconfig.json Named Tracers / Tracer Registry (#582) 2020-01-09 08:29:38 -08:00
tslint.json feat: port mongodb-core plugin to mongodb #622 (#652) 2020-01-03 10:30:04 -08:00

README.md

OpenTelemetry mongodb Instrumentation for Node.js

Gitter chat dependencies devDependencies Apache License

This module provides automatic instrumentation for mongodb.

For automatic instrumentation see the @opentelemetry/node package.

Installation

npm install --save @opentelemetry/plugin-mongodb

Supported Versions

  • '>=2.0.0 <4

Usage

OpenTelemetry Mongodb Instrumentation allows the user to automatically collect trace data and export them to their backend of choice, to give observability to distributed systems.

To load a specific plugin (mongodb in this case), specify it in the Node Tracer's configuration.

const { NodeTracerProvider } = require('@opentelemetry/node');

const provider = new NodeTracerProvider({
  plugins: {
    mongodb: {
      enabled: true,
      // You may use a package name or absolute path to the file.
      path: '@opentelemetry/plugin-mongodb',
    }
  }
});

To load all of the supported plugins, use below approach. Each plugin is only loaded when the module that it patches is loaded; in other words, there is no computational overhead for listing plugins for unused modules.

const { NodeTracerProvider } = require('@opentelemetry/node');

const provider = new NodeTracerProvider();

See examples/mongodb for a short example.

License

Apache 2.0 - See LICENSE for more information.