Gathering detailed insights and metrics for @brokerize/opentelemetry-instrumentation-mysql2
Gathering detailed insights and metrics for @brokerize/opentelemetry-instrumentation-mysql2
Gathering detailed insights and metrics for @brokerize/opentelemetry-instrumentation-mysql2
Gathering detailed insights and metrics for @brokerize/opentelemetry-instrumentation-mysql2
OpenTelemetry instrumentation for JavaScript modules
npm install @brokerize/opentelemetry-instrumentation-mysql2
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (97.8%)
JavaScript (2.19%)
Shell (0.01%)
Total Downloads
1,774
Last Day
26
Last Week
66
Last Month
441
Last Year
1,774
Apache-2.0 License
2,234 Commits
3 Branches
1 Contributors
Updated on Feb 19, 2025
Latest Version
0.45.4
Package Id
@brokerize/opentelemetry-instrumentation-mysql2@0.45.4
Unpacked Size
63.12 kB
Size
15.69 kB
File Count
18
NPM Version
10.9.0
Node Version
22.11.0
Published on
Feb 25, 2025
Cumulative downloads
Total Downloads
Last Day
73.3%
26
Compared to previous day
Last Week
-48.8%
66
Compared to previous week
Last Month
30.9%
441
Compared to previous month
Last Year
0%
1,774
Compared to previous year
3
1
This module provides automatic instrumentation for the mysql2
module, which may be loaded using the @opentelemetry/sdk-trace-node
package and is included in the @opentelemetry/auto-instrumentations-node
bundle.
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+
.
1npm install --save @brokerize/opentelemetry-instrumentation-mysql2
mysql2
versions >=1.4.2 <4
OpenTelemetry MySQL2 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 mysql2.
To load a specific plugin (MySQL2 in this case), specify it in the registerInstrumentations's configuration
1const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node'); 2const { MySQL2Instrumentation } = require('@opentelemetry/instrumentation-mysql2'); 3const { registerInstrumentations } = require('@opentelemetry/instrumentation'); 4 5const provider = new NodeTracerProvider(); 6provider.register(); 7 8registerInstrumentations({ 9 instrumentations: [ 10 new MySQL2Instrumentation(), 11 ], 12})
You can set the following instrumentation options:
Options | Type | Description |
---|---|---|
responseHook | MySQL2InstrumentationExecutionResponseHook (function) | Function for adding custom attributes from db response |
addSqlCommenterCommentToQueries | boolean | If true, adds sqlcommenter specification compliant comment to queries with tracing context (default false). NOTE: A comment will not be added to queries that already contain -- or /* ... */ in them, even if these are not actually part of comments |
maskStatement | boolean | If true, masks the db.statement attribute in spans (default true) with the maskStatementHook |
maskStatementHook | MySQL2InstrumentationMaskStatementHook (function) | Function for masking the db.statement attribute in spans Default: return query.replace(/\b\d+\b/g, '?').replac(/(["'])(?:(?=(\\?))\2.)*?\1/g, '?'); |
This package uses @opentelemetry/semantic-conventions
version 1.22+
, which implements Semantic Convention Version 1.7.0
Attributes collected:
Attribute | Short Description |
---|---|
db.connection_string | The connection string used to connect to the database. |
db.name | This attribute is used to report the name of the database being accessed. |
db.statement | The database statement being executed. |
db.system | An identifier for the database management system (DBMS) product being used. |
db.user | Username for accessing the database. |
net.peer.name | Remote hostname or similar. |
net.peer.port | Remote port number. |
Apache 2.0 - See LICENSE for more information.
No vulnerabilities found.