OpenTelemetry instrumentation for JavaScript modules
Installations
npm install @opentelemetry/instrumentation-mysql2
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=14
Node Version
18.20.5
NPM Version
lerna/6.6.2/node@v18.20.5+x64 (linux)
Score
86.2
Supply Chain
92.4
Quality
91
Maintenance
100
Vulnerability
99.6
License
Releases
instrumentation-pg: v0.51.0
Published on 28 Jan 2025
instrumentation-mysql2: v0.45.1
Published on 28 Jan 2025
instrumentation-cucumber: v0.14.0
Published on 28 Jan 2025
auto-instrumentations-node: v0.56.0
Published on 28 Jan 2025
instrumentation-fastify: v0.44.1
Published on 20 Jan 2025
instrumentation-aws-lambda: v0.50.2
Published on 20 Jan 2025
Contributors
Languages
TypeScript (97.91%)
JavaScript (2.08%)
Shell (0.01%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
100,640,299
Last Day
589,083
Last Week
2,637,459
Last Month
11,072,537
Last Year
78,612,121
GitHub Statistics
744 Stars
2,214 Commits
549 Forks
17 Watching
16 Branches
458 Contributors
Bundle Size
92.96 kB
Minified
23.96 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.45.1
Package Id
@opentelemetry/instrumentation-mysql2@0.45.1
Unpacked Size
59.43 kB
Size
14.46 kB
File Count
18
NPM Version
lerna/6.6.2/node@v18.20.5+x64 (linux)
Node Version
18.20.5
Publised On
28 Jan 2025
Total Downloads
Cumulative downloads
Total Downloads
100,640,299
Last day
-2%
589,083
Compared to previous day
Last week
-12%
2,637,459
Compared to previous week
Last month
15.1%
11,072,537
Compared to previous month
Last year
331.5%
78,612,121
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
3
Peer Dependencies
1
OpenTelemetry mysql Instrumentation for Node.js
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+
.
Installation
1npm install --save @opentelemetry/instrumentation-mysql2
Supported Versions
mysql2
versions>=1.4.2 <4
Usage
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})
MySQL2 Instrumentation Options
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 |
Semantic Conventions
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. |
Useful links
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js
- For help or feedback on this project, join us in GitHub Discussions
License
Apache 2.0 - See LICENSE for more information.
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 14 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0
Reason
no binaries found in the repo
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/open-telemetry/.github/SECURITY.md:1
- Info: Found linked content: github.com/open-telemetry/.github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/open-telemetry/.github/SECURITY.md:1
- Info: Found text in security policy: github.com/open-telemetry/.github/SECURITY.md:1
Reason
SAST tool is run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Info: all commits (30) are checked with a SAST tool
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/close-stale.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/close-stale.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/close-stale.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/close-stale.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/close-stale.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/close-stale.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/codeql-analysis.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/codeql-analysis.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/codeql-analysis.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/codeql-analysis.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/component-owners.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/component-owners.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/label-prs.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/label-prs.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/label-prs.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/label-prs.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/lint.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/lint.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/peer-api.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/peer-api.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/pr-title.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/pr-title.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-please-validate.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/release-please-validate.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-please.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/release-please.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-please.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/release-please.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-please.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/release-please.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-please.yml:64: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/release-please.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-all-versions.pr.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/test-all-versions.pr.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-all-versions.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/test-all-versions.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-all-versions.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/test-all-versions.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-all-versions.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/test-all-versions.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-all-versions.yml:138: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/test-all-versions.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-all-versions.yml:141: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/test-all-versions.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-all-versions.yml:152: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/test-all-versions.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:146: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:149: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:160: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/unit-test.yml:174: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:192: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:195: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:201: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/unit-test.yml:210: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/unit-test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-otel-deps.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/update-otel-deps.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-otel-deps.yaml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/open-telemetry/opentelemetry-js-contrib/update-otel-deps.yaml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/release-please-validate.yaml:20
- Warn: npmCommand not pinned by hash: .github/workflows/release-please.yml:53
- Warn: npmCommand not pinned by hash: .github/workflows/test-all-versions.yml:149
- Warn: npmCommand not pinned by hash: .github/workflows/unit-test.yml:157
- Warn: npmCommand not pinned by hash: .github/workflows/update-otel-deps.yaml:35
- Info: 0 out of 35 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 5 third-party GitHubAction dependencies pinned
- Info: 10 out of 15 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/label-prs.yml:9
- Warn: no topLevel permission defined: .github/workflows/close-stale.yml:1
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: no topLevel permission defined: .github/workflows/component-owners.yml:1
- Warn: no topLevel permission defined: .github/workflows/label-prs.yml:1
- Warn: no topLevel permission defined: .github/workflows/lint.yml:1
- Warn: no topLevel permission defined: .github/workflows/peer-api.yaml:1
- Warn: no topLevel permission defined: .github/workflows/pr-title.yml:1
- Warn: no topLevel permission defined: .github/workflows/release-please-validate.yaml:1
- Warn: no topLevel permission defined: .github/workflows/release-please.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-all-versions.pr.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-all-versions.push.yml:1
- Warn: no topLevel permission defined: .github/workflows/test-all-versions.yml:1
- Warn: no topLevel permission defined: .github/workflows/unit-test.yml:1
- Warn: no topLevel permission defined: .github/workflows/update-otel-deps.yaml:1
- Info: no jobLevel write permissions found
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
22 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-7v5v-9h63-cj86
- Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-rrr8-f88r-h8q6
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-m5vv-6r4h-3vj9
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-x3cc-x39p-42qx
- Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm
- Warn: Project is vulnerable to: GHSA-4jv9-3563-23j3
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc
Score
6.5
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More