$ npm install @opentelemetry/instrumentation-mysql
This module provides automatic instrumentation for the mysql module.
If total installation size is not constrained, it is recommended to use the @opentelemetry/auto-instrumentations-node bundle with @opentelemetry/sdk-node for the most seamless instrumentation experience.
Compatible with OpenTelemetry JS API and SDK 1.0+.
npm install --save @opentelemetry/instrumentation-mysql
mysql versions >=2.0.0 <3OpenTelemetry MySQL Instrumentation allows the user to automatically collect trace data and export them to the backend of choice, to give observability to distributed systems when working with mysql.
To enable a specific instrumentation, pass it to registerInstrumentations().
This is commonly done via NodeSDK for fully setting up all OpenTelemetry SDK components:
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { MySQLInstrumentation } = require('@opentelemetry/instrumentation-mysql');
const sdk = new NodeSDK({
instrumentations: [
new MySQLInstrumentation(),
],
});
sdk.start();
process.once('beforeExit', async () => { await sdk.shutdown(); });
| Options | Type | Default | Description |
|---|---|---|---|
enhancedDatabaseReporting |
boolean |
false |
If true, a db.mysql.values attribute containing the query's parameters will be add to database spans. Note that this is not an attribute defined in Semantic Conventions. |
The instrumentation-mysql versions 0.66.0 and later emit the stable v1.33.0+ semantic conventions.
Attributes collected:
| Attribute | Description |
|---|---|
db.system.name |
The database system. Always 'mysql'. |
db.namespace |
The database associated with the connection, as provided at connection time. (This does not track changes made via SELECT DATABASE().) |
db.query.text |
The database query being executed. |
server.address |
Remote hostname or similar. |
server.port |
Remote port number. |
Metrics collected:
db.client.connection.count - The number of connections currently in a given state.Apache 2.0 - See LICENSE for more information.
© 2010 - cnpmjs.org x YWFE | Home | YWFE