Collecting metrics and statistics for Sequelize with OpenTelemetry
OpenTelemetry is a standardized specification for collecting, aggregating, and instrumenting various statistics, metrics, traces, and logs. OpenTelemetry can help us identify where bottlenecks may occur, categorize and apply topological filters on logs, and plug into third-party applications (for example, for alert monitoring).
To integrate OpenTelemetry with Sequelize, we would need to install the following packages within our Avalon Airlines project:
npm i @opentelemetry/api @opentelemetry/sdk-trace-node @opentelemetry/instrumentation @opentelemetry/sdk-node @opentelemetry/auto-instrumentations-node opentelemetry-instrumentation-sequelize
Within models/index.js
, under the 'use strict';
line, we can now add our new packages:
const { NodeTracerProvider } = require(‹@opentelemetry/sdk-trace-node'); const { registerInstrumentations } = ...