{"name":"@opentelemetry/instrumentation-knex","version":"0.47.0","keywords":["instrumentation","knex","nodejs","opentelemetry","tracing"],"author":"OpenTelemetry Authors","license":"Apache-2.0","_id":"@opentelemetry/instrumentation-knex@0.47.0","maintainers":[{"name":"bogdandrutu","email":"bogdandrutu@gmail.com"},{"name":"dyladan","email":"dyladan@gmail.com"},{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-knex#readme","dist":{"shasum":"03d05446ce95a6182c8afec614c67ab9f0aad671","tarball":"http://registry-npm.ywwl.com/@opentelemetry/instrumentation-knex/download/@opentelemetry/instrumentation-knex-0.47.0.tgz","fileCount":24,"integrity":"sha512-OjqjnzXD5+FXVGkOznbRAz9yByb4UWzIUhXjuHvOQ50IUY8mv3rM2Gj6Ar7m5JsENiS5DtAy2Vfwk4e9zNC0ng==","signatures":[{"sig":"MEQCID/A88joKYvtTbU3+uGDHcnbGne/WBuNmnZM8W3+x6bzAiBEL36gmwKfH+J3uQoEE/3+CBiFfOuSL5bi0rLc5LlNDw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2finstrumentation-knex@0.47.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":63181,"size":15230,"noattachment":false,"key":"/@opentelemetry/instrumentation-knex/-/@opentelemetry/instrumentation-knex-0.47.0.tgz"},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"7481f71d615acf161b5c86dd4abce1434a860a3d","scripts":{"tdd":"yarn test -- --watch-extensions ts --watch","lint":"eslint . --ext .ts","test":"nyc mocha 'test/**/*.ts'","clean":"rimraf build/*","watch":"tsc -w","compile":"tsc -p .","lint:fix":"eslint . --ext .ts --fix","setup:dev":"nx run-many -t compile -p @opentelemetry/instrumentation-knex","lint:readme":"node ../../../scripts/lint-readme","prepublishOnly":"npm run compile","version:update":"node ../../../scripts/version-update.js"},"_npmUser":{"name":"dyladan","email":"dyladan@gmail.com"},"repository":"open-telemetry/opentelemetry-js-contrib","_npmVersion":"lerna/8.2.2/node@v18.20.8+x64 (linux)","description":"OpenTelemetry instrumentation for `knex` database SQL query builder","directories":{},"_nodeVersion":"18.20.8","dependencies":{"@opentelemetry/instrumentation":"^0.202.0","@opentelemetry/semantic-conventions":"^1.33.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"17.1.0","knex":"3.1.0","rimraf":"5.0.10","sqlite3":"5.1.7","typescript":"5.0.4","@types/node":"18.18.14","@types/mocha":"10.0.10","better-sqlite3":"11.0.0","@opentelemetry/api":"^1.3.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.0.0","@opentelemetry/context-async-hooks":"^2.0.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/instrumentation-knex_0.47.0_1748885947428_0.44931301209328245","host":"s3://npm-registry-packages-npm-production"},"readme":"# OpenTelemetry Knex 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 [`knex`](https://github.com/knex/knex) module. This module allows the user to automatically collect trace data and export them to their backend of choice.\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-knex\n```\n\n### Supported Versions\n\n- [`knex`](https://www.npmjs.com/package/knex) versions `>=0.10.0 <4`\n\n## Usage\n\n```js\nconst { NodeSDK } = require('@opentelemetry/sdk-node');\nconst { KnexInstrumentation } = require('@opentelemetry/instrumentation-knex');\n\nconst sdk = new NodeSDK({\n  instrumentations: [\n    new KnexInstrumentation({\n      // See below for configuration options.\n    }),\n  ],\n});\nsdk.start();\nprocess.once('beforeExit', async () => { await sdk.shutdown(); });\n```\n\n### Configuration Options\n\n| Options | Type | Example | Description |\n| ------- | ---- | ------- | ----------- |\n| `maxQueryLength` | `number` | `100` | Truncate `db.query.text` attribute to a maximum length. If the statement is truncated `'..'` is added to its end. Default `1022`. `-1` leaves `db.query.text` untouched. |\n| `requireParentSpan` | `boolean` | `false` | Don't create spans unless they are part of an existing trace. Default is `false`. |\n\n## Semantic Conventions\n\nThis instrumentation creates spans with database-related attributes.\n\nThe `instrumentation-knex` versions 0.64.0 and later emit the stable v1.33.0+ semantic conventions.\n\n| Attribute              | Short Description                                                           |\n| ---------------------- | --------------------------------------------------------------------------- |\n| `db.collection.name`   | The name of the primary table that the operation is acting upon.            |\n| `db.namespace`         | The name of the database being accessed.                                    |\n| `db.operation.name`    | The name of the operation being executed.                                   |\n| `db.query.text`        | The database statement being executed.                                      |\n| `db.system.name`       | An identifier for the database management system (DBMS) product being used. |\n| `server.address`       | Remote hostname or similar.                                                 |\n| `server.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-knex\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-knex.svg\n","publish_time":1748885947648,"_cnpm_publish_time":1748885947648,"dist-tags":{"latest":"0.69.0"}}