open telemetry instrumentation for the `sequelize` module
npm install opentelemetry-instrumentation-sequelizeThis module provides automatic instrumentation for Sequelize.
> _Tested and worked on versions v4, v5 and v6 of Sequelize._
```
npm install --save opentelemetry-instrumentation-sequelize
`js
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 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). |
---
This extension (and many others) was developed by Aspecto with ❤️