{"_id":"@brokerize/opentelemetry-instrumentation-mysql2","_rev":"6-6de924e73ce1c2b767c67bebcd6f090e","name":"@brokerize/opentelemetry-instrumentation-mysql2","dist-tags":{"latest":"0.45.4"},"versions":{"1.0.0":{"name":"@brokerize/opentelemetry-instrumentation-mysql2","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@brokerize/opentelemetry-instrumentation-mysql2@1.0.0","maintainers":[{"name":"thorbenziemek","email":"thorben@ziemek.de"}],"dist":{"shasum":"4cc1f859c520296b6c55dcae5c17b1d0219d649a","tarball":"https://registry.npmjs.org/@brokerize/opentelemetry-instrumentation-mysql2/-/opentelemetry-instrumentation-mysql2-1.0.0.tgz","fileCount":1,"integrity":"sha512-hexf22FVsZpGxSHhras7/k7/15cz8t5e0PSUvEqJuzwqbeeBv6Xy5zoW19ZF1EQkDFAZch+F8z7ddgACabv0jg==","signatures":[{"sig":"MEUCIQD45+kXbLZYIQI+yix+++n++8uVZo2JcdQuE2eicO6tmAIgDreuDrw60pH3XsKl3FcG2HHzeRPoDB55mNB2o+02bzs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":261},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"thorbenziemek","email":"thorben@ziemek.de"},"_npmVersion":"10.8.2","directories":{},"_nodeVersion":"20.18.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/opentelemetry-instrumentation-mysql2_1.0.0_1740486252607_0.8853623736289322","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.45.3":{"name":"@brokerize/opentelemetry-instrumentation-mysql2","version":"0.45.3","keywords":["instrumentation","mysql","mysql2","nodejs","opentelemetry","profiling","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@brokerize/opentelemetry-instrumentation-mysql2@0.45.3","maintainers":[{"name":"thorbenziemek","email":"thorben@ziemek.de"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mysql2#readme","bugs":{"url":"https://github.com/gflachs/opentelemetry-js-contrib/issues"},"dist":{"shasum":"18623634574f800a636d2763765a7d89b7f33424","tarball":"https://registry.npmjs.org/@brokerize/opentelemetry-instrumentation-mysql2/-/opentelemetry-instrumentation-mysql2-0.45.3.tgz","fileCount":18,"integrity":"sha512-PepakZcSwm5e0G7IACIKItnGe2T6VgxMZMXNZiE6mA5W4lScwXmbSU6i5OwCS//UZaz3nS2HYhMoWqV3OV+Acw==","signatures":[{"sig":"MEYCIQDIuz/+aJKsuKa6i1BQctZPsEuQoVAaC2tBhiUnrs4YUQIhAMVCileCwqO1vJ7FjBtFcoVjPvF8DRtf7oDC91/22auj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64506},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":">=14"},"gitHead":"aefe92b9170eba27dac9d9876be345e5b54cb42b","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","lint":"eslint . --ext .ts","test":"nyc mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","lint:fix":"eslint . --ext .ts --fix","prewatch":"npm run precompile","prepublishOnly":"npm run compile","version:update":"node ../../../scripts/version-update.js","test-all-versions":"tav"},"_npmUser":{"name":"thorbenziemek","email":"thorben@ziemek.de"},"repository":{"url":"git+https://github.com/gflachs/opentelemetry-js-contrib.git","type":"git"},"_npmVersion":"10.9.0","description":"OpenTelemetry instrumentation for `mysql2` database client for MySQL","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@opentelemetry/sql-common":"^0.40.1","@opentelemetry/instrumentation":"^0.57.2","@opentelemetry/semantic-conventions":"^1.27.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.1.0","mysql2":"3.11.5","rimraf":"5.0.10","semver":"7.7.1","typescript":"4.4.4","@types/node":"18.18.14","@types/mocha":"10.0.10","@types/semver":"7.5.8","test-all-versions":"6.1.0","@opentelemetry/api":"^1.3.0","@opentelemetry/sdk-trace-base":"^1.8.0","@opentelemetry/contrib-test-utils":"^0.45.1","@opentelemetry/context-async-hooks":"^1.8.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/opentelemetry-instrumentation-mysql2_0.45.3_1740490500569_0.7248132519273847","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.45.4":{"name":"@brokerize/opentelemetry-instrumentation-mysql2","version":"0.45.4","keywords":["instrumentation","mysql","mysql2","nodejs","opentelemetry","profiling","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@brokerize/opentelemetry-instrumentation-mysql2@0.45.4","maintainers":[{"name":"thorbenziemek","email":"thorben@ziemek.de"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mysql2#readme","bugs":{"url":"https://github.com/gflachs/opentelemetry-js-contrib/issues"},"dist":{"shasum":"07c594e970c26be1b53a987155d497d2a50c1163","tarball":"https://registry.npmjs.org/@brokerize/opentelemetry-instrumentation-mysql2/-/opentelemetry-instrumentation-mysql2-0.45.4.tgz","fileCount":18,"integrity":"sha512-eXFYDl4MnRfgdAuJc/9bkWHefEg9Qg6v2ny+hmsKlmML3Kv7M5KtmUMyfJZvCp7ja+rl0bzzhcygMe5CuhlHSw==","signatures":[{"sig":"MEYCIQD+v0LeuYLOIJ3EH88IaDmxkbYkxg2b2ugQkk92paWNRwIhAM84MuCinSUzLxin4exD3ft86Pt8ImZ+1CWsUmSTegIb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64637},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":">=14"},"gitHead":"f7c9c8e64365a4d5772e35c022d5a46c8cf49cdb","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","lint":"eslint . --ext .ts","test":"nyc mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","lint:fix":"eslint . --ext .ts --fix","prewatch":"npm run precompile","prepublishOnly":"npm run compile","version:update":"node ../../../scripts/version-update.js","test-all-versions":"tav"},"_npmUser":{"name":"thorbenziemek","email":"thorben@ziemek.de"},"repository":{"url":"git+https://github.com/gflachs/opentelemetry-js-contrib.git","type":"git"},"_npmVersion":"10.9.0","description":"OpenTelemetry instrumentation for `mysql2` database client for MySQL","directories":{},"_nodeVersion":"22.11.0","dependencies":{"@opentelemetry/sql-common":"^0.40.1","@opentelemetry/instrumentation":"^0.57.2","@opentelemetry/semantic-conventions":"^1.27.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.1.0","mysql2":"3.11.5","rimraf":"5.0.10","semver":"7.7.1","typescript":"4.4.4","@types/node":"18.18.14","@types/mocha":"10.0.10","@types/semver":"7.5.8","test-all-versions":"6.1.0","@opentelemetry/api":"^1.3.0","@opentelemetry/sdk-trace-base":"^1.8.0","@opentelemetry/contrib-test-utils":"^0.45.1","@opentelemetry/context-async-hooks":"^1.8.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/opentelemetry-instrumentation-mysql2_0.45.4_1740493374983_0.6706910138277336","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2025-02-25T12:24:12.506Z","modified":"2025-12-17T07:55:17.401Z","1.0.0":"2025-02-25T12:24:12.750Z","0.45.2":"2025-02-25T12:58:26.852Z","0.45.3":"2025-02-25T13:35:00.739Z","0.45.4":"2025-02-25T14:22:55.186Z"},"bugs":{"url":"https://github.com/gflachs/opentelemetry-js-contrib/issues"},"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-mysql2#readme","keywords":["instrumentation","mysql","mysql2","nodejs","opentelemetry","profiling","tracing"],"repository":{"url":"git+https://github.com/gflachs/opentelemetry-js-contrib.git","type":"git"},"description":"OpenTelemetry instrumentation for `mysql2` database client for MySQL","maintainers":[{"name":"thorbenziemek","email":"thorben@ziemek.de"}],"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, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle.\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 @brokerize/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 load a specific plugin (**MySQL2** in this case), specify it in the registerInstrumentations's configuration\n\n```js\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\nconst { MySQL2Instrumentation } = require('@opentelemetry/instrumentation-mysql2');\nconst { registerInstrumentations } = require('@opentelemetry/instrumentation');\n\nconst provider = new NodeTracerProvider();\nprovider.register();\n\nregisterInstrumentations({\n  instrumentations: [\n    new MySQL2Instrumentation(),\n  ],\n})\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 true) 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\nThis package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)\n\nAttributes collected:\n\n| Attribute               | Short Description                                                              |\n| ----------------------- | ------------------------------------------------------------------------------ |\n| `db.connection_string`  | The connection string used to connect to the database.                         |\n| `db.name`               | This attribute is used to report the name of the database being accessed.      |\n| `db.statement`          | The database statement being executed.                                         |\n| `db.system`             | An identifier for the database management system (DBMS) product being used.    |\n| `db.user`               | Username for accessing the database.                                           |\n| `net.peer.name`         | Remote hostname or similar.                                                    |\n| `net.peer.port`         | Remote port number.                                                            |\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","readmeFilename":"README.md"}