# opentelemetry-instrumentation-sequelize

> open telemetry instrumentation for the `sequelize` module

Latest version **0.41.0** (published 2024-05-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install opentelemetry-instrumentation-sequelize
pnpm add opentelemetry-instrumentation-sequelize
yarn add opentelemetry-instrumentation-sequelize
bun add opentelemetry-instrumentation-sequelize
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.41.0 |
| Published | 2024-05-21 |
| First published | 2021-02-14 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 108.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 168 |
| Author | Aspecto |
| Maintainers | aspecto-release-bot |
| Keywords | sequelize, opentelemetry |

## Links

- npm: https://www.npmjs.com/package/opentelemetry-instrumentation-sequelize
- Repository: https://github.com/aspecto-io/opentelemetry-ext-js
- Issues: https://github.com/aspecto-io/opentelemetry-ext-js/issues
- npm.io page: https://npm.io/package/opentelemetry-instrumentation-sequelize

## Dependencies (3)

- [@opentelemetry/core](https://npm.io/package/@opentelemetry/core.md) ^1.24.1
- [@opentelemetry/instrumentation](https://npm.io/package/@opentelemetry/instrumentation.md) ^0.51.1
- [@opentelemetry/semantic-conventions](https://npm.io/package/@opentelemetry/semantic-conventions.md) ^1.24.1

## Recent versions

- 0.41.0 (latest) — 2024-05-21
- 0.0.0-2024-05-16--12-47 (alpha) — 2024-05-16
- 0.4.1-aws-import-one-serivce.0 (canary) — 2021-04-28
- 0.40.0 — 2023-10-17
- 0.0.0-2023-10-17--13-06 — 2023-10-17
- 0.39.1 — 2023-07-27
- 0.35.1 — 2023-07-27
- 0.0.0-2023-07-26--14-48 — 2023-07-26
- 0.35.0 — 2023-03-01
- 0.34.0 — 2022-11-21
- 0.32.0 — 2022-10-18
- 0.0.0-2022-07-11--08-09 — 2022-07-11
- 0.29.0 — 2022-06-28
- 0.28.0 — 2022-06-02
- 0.27.1 — 2022-04-13
- … 53 more at https://npm.io/package/opentelemetry-instrumentation-sequelize/versions

## README

# OpenTelemetry Sequelize Instrumentation for Node.js
[![NPM version](https://img.shields.io/npm/v/opentelemetry-instrumentation-sequelize.svg)](https://www.npmjs.com/package/opentelemetry-instrumentation-sequelize)

This module provides automatic instrumentation for [`Sequelize`](https://sequelize.org/).
> _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](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation) package.

```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 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](https://www.aspecto.io/) with ❤️

---
_Source: https://npm.io/package/opentelemetry-instrumentation-sequelize · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
