opentelemetry-instrumentation-sequelize
TypeScript icon, indicating that this package has built-in type declarations

0.40.0 • Public • Published

OpenTelemetry Sequelize Instrumentation for Node.js

NPM version

This module provides automatic instrumentation for Sequelize.

Tested and worked on versions v4, v5 and v6 of Sequelize.

Installation

npm install --save opentelemetry-instrumentation-sequelize

Usage

For further automatic instrumentation instruction see the @opentelemetry/instrumentation package.

const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { SequelizeInstrumentation } = require('opentelemetry-instrumentation-sequelize');

const tracerProvider = new NodeTracerProvider({
  // be sure to disable old plugin
  plugins: {
    sequelize: { enabled: false, path: 'opentelemetry-plugin-sequelize' }
  }
});

registerInstrumentations({
  tracerProvider,
  instrumentations: [
    new SequelizeInstrumentation({
      // see under for available configuration
    })
  ]
});

Sequelize Instrumentation Options

Sequelize instrumentation has few options available to choose from. You can set the following:

Options Type Description
queryHook SequelizeQueryHook Hook called before query is run, which allows to add custom attributes to span.
responseHook SequelizeResponseCustomAttributesFunction Hook called before response is returned, which allows to add custom attributes to span.
ignoreOrphanedSpans boolean Set to true if you only want to trace operation which has parent spans
moduleVersionAttributeName string If passed, a span attribute will be added to all spans with key of the provided moduleVersionAttributeName and value of the patched module version
suppressInternalInstrumentation boolean Sequelize operation use db libs under the hood. Setting this to true will hide the underlying spans (if instrumented).

Semantic Behavior

Internal implementation queries generated on startup from connection-manager are not instrumented.


This extension (and many others) was developed by Aspecto with ❤️

Package Sidebar

Install

npm i opentelemetry-instrumentation-sequelize

Weekly Downloads

26,253

Version

0.40.0

License

Apache-2.0

Unpacked Size

124 kB

Total Files

22

Last publish

Collaborators

  • aspecto-release-bot