{"_id":"@opentelemetry/instrumentation-mysql2@0.69.0","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"aa7af7c6a256cbcfd9fa7c4dd560a67ab063b2dd","tarball":"http://registry-npm.ywwl.com/@opentelemetry/instrumentation-mysql2/download/@opentelemetry/instrumentation-mysql2-0.69.0.tgz","fileCount":18,"integrity":"sha512-k4Qm4OCzYcYUsIujsMV/PqssrYlCiWwNsCRR1WQOcsXQJEGRJXzDCvDDc/2fmXuSnwY2NuLkHEHaZB1sQSH2vw==","signatures":[{"sig":"MEUCIEFDMDBMetZpozCAijHd0SYHiJvohGZUR1pRJ6zZIRbuAiEAgC3Mgy6aOPcR10t0mJydh4rPv4gabo/ya4qsJcqBaBY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE+yqU7na3U7UYclv5SFpsfwV/qO5ViZC5U21IEIMF4PAiBP8ecoKgmL51XxbNU5EM0Y45qfDRWbJvl15jNi6PqbZA=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2finstrumentation-mysql2@0.69.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":58495,"size":15106,"noattachment":false,"key":"/@opentelemetry/instrumentation-mysql2/-/@opentelemetry/instrumentation-mysql2-0.69.0.tgz"},"main":"build/src/index.js","name":"@opentelemetry/instrumentation-mysql2","types":"build/src/index.d.ts","author":{"name":"OpenTelemetry Authors"},"engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"cc263ac4e94320402ac3afe50d50eb00905e1bb8","license":"Apache-2.0","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc --no-clean mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","prepublishOnly":"npm run compile","version:update":"node ../../scripts/version-update.js","test-services:ls":"echo mysql","test-all-versions":"tav","test-services:stop":"cd ../.. && npm run test-services:stop mysql","test-services:start":"cd ../.. && npm run test-services:start mysql","test:with-services-env":"cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/instrumentation-mysql2","test-all-versions:with-services-env":"cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions"},"version":"0.69.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"e28a8ae3-6a2f-408e-b640-59d4a62bee27"}},"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-mysql2#readme","keywords":["instrumentation","mysql","mysql2","nodejs","opentelemetry","profiling","tracing"],"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git","directory":"packages/instrumentation-mysql2"},"_npmVersion":"lerna/9.0.7/node@v24.21.0+x64 (linux)","description":"OpenTelemetry instrumentation for `mysql2` database client for MySQL","directories":{},"maintainers":[{"name":"dyladan","email":"dyladan@gmail.com"},{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"},{"name":"overbalance","email":"overbalancedev@proton.me"},{"name":"npmjs-account","email":"npmjs-account@opentelemetry.io"},{"name":"trentm","email":"trentm@gmail.com"},{"name":"martinkuba","email":"martin@martinkuba.com"}],"_nodeVersion":"24.21.0","dependencies":{"@opentelemetry/sql-common":"^0.42.0","@opentelemetry/instrumentation":"^0.223.0","@opentelemetry/semantic-conventions":"^1.33.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"mysql2":"3.22.0","@opentelemetry/api":"^1.3.0","@opentelemetry/sdk-trace":"^2.9.0","@opentelemetry/contrib-test-utils":"^0.70.0","@opentelemetry/context-async-hooks":"^2.9.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/instrumentation-mysql2_0.69.0_1791300174248_0.8734567200075536"},"readme":"# OpenTelemetry mysql Instrumentation for Node.js\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\nThis module provides automatic instrumentation for the [`mysql2`](https://github.com/sidorares/node-mysql2) module.\n\nIf total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle with [@opentelemetry/sdk-node](https://www.npmjs.com/package/@opentelemetry/sdk-node) for the most seamless instrumentation experience.\n\nCompatible with OpenTelemetry JS API and SDK `1.0+`.\n\n## Installation\n\n```bash\nnpm install --save @opentelemetry/instrumentation-mysql2\n```\n\n## Supported Versions\n\n- [`mysql2`](https://www.npmjs.com/package/mysql2) versions `>=1.4.2 <4`\n\n## Usage\n\nOpenTelemetry 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](https://github.com/sidorares/node-mysql2).\n\nTo enable a specific instrumentation, pass it to `registerInstrumentations()`.\nThis is commonly done via `NodeSDK` for fully setting up all OpenTelemetry SDK components:\n\n```js\nconst { NodeSDK } = require('@opentelemetry/sdk-node');\nconst { MySQL2Instrumentation } = require('@opentelemetry/instrumentation-mysql2');\n\nconst sdk = new NodeSDK({\n  instrumentations: [\n    new MySQL2Instrumentation(),\n  ],\n});\nsdk.start();\nprocess.once('beforeExit', async () => { await sdk.shutdown(); });\n```\n\n### MySQL2 Instrumentation Options\n\nYou can set the following instrumentation options:\n\n| Options                           | Type                                                    | Description                                                                                                                                                                                                                                                                                                                  |\n|-----------------------------------|---------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `responseHook`                    | `MySQL2InstrumentationExecutionResponseHook` (function) | Function for adding custom attributes from db response                                                                                                                                                                                                                                                                       |\n| `addSqlCommenterCommentToQueries` | `boolean`                                               | If true, adds [sqlcommenter](https://github.com/open-telemetry/opentelemetry-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_ |\n| `maskStatement`                   | `boolean`                                               | If true, masks the `db.statement` attribute in spans (default false) with the `maskStatementHook`                                                                                                                                                                                                                            |\n| `maskStatementHook`               | `MySQL2InstrumentationMaskStatementHook` (function)     | Function for masking the `db.statement` attribute in spans  Default: `return query.replace(/\\b\\d+\\b/g, '?').replac(/([\"'])(?:(?=(\\\\?))\\2.)*?\\1/g, '?');`                                                                                                                                                                     |\n\n\n## Semantic Conventions\n\nThe `@opentelemetry/instrumentation-mysql2` versions 0.66.0 and later emit the stable v1.33.0+ semantic conventions.\n\n| Attribute         | Description                                                                   |\n|-------------------|-------------------------------------------------------------------------------|\n| `db.system.name`  | The database system. Always `'mysql'`.                                        |\n| `db.query.text`   | The database query being executed.                                            |\n| `db.namespace`    | The name of the database, fully qualified within the server address and port. |\n| `server.address`  | Remote hostname or similar.                                                   |\n| `server.port`     | Remote port number.                                                           |\n\n\n## Useful links\n\n- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>\n- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>\n- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]\n\n## License\n\nApache 2.0 - See [LICENSE][license-url] for more information.\n\n[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions\n[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE\n[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat\n[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-mysql2\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-mysql2.svg\n","publish_time":1791300174352,"_cnpm_publish_time":1791300174352,"dist-tags":{"latest":"0.70.0"}}