{"name":"@opentelemetry/instrumentation-pg","version":"0.45.0","keywords":["instrumentation","nodejs","opentelemetry","pg","plugin","postgres","postgresql","profiling","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@opentelemetry/instrumentation-pg@0.45.0","homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-pg#readme","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"d062bbefcd95af4bcaa0e89b2d14f69ec5148b4b","tarball":"http://registry-npm.ywwl.com/@opentelemetry/instrumentation-pg/download/@opentelemetry/instrumentation-pg-0.45.0.tgz","fileCount":27,"integrity":"sha512-IuIZa9u4lnJhSs2WaSGv/lWcTtWUdv2xYtWRHEDr9njn9PBKzCzz709+9IvxNibbSjCASdLS1Stuq1LVRCYbXg==","signatures":[{"sig":"MEUCIECnrSFBo+KP92JR33Rwll4KVGiLNjtXLVi42koUZVGjAiEAmvKyO2qOUqakwtibrq68P0QhhD6LKFVrPZ8iOS8wFP8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2finstrumentation-pg@0.45.0","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":120190,"size":28543,"noattachment":false,"key":"/@opentelemetry/instrumentation-pg/-/@opentelemetry/instrumentation-pg-0.45.0.tgz"},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":">=14"},"gitHead":"2512c78761ac985f189bf82c2608c4099affa660","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","lint":"eslint . --ext .ts","test":"nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'","clean":"rimraf build/*","watch":"tsc -w","compile":"tsc -p .","lint:fix":"eslint . --ext .ts --fix","prewatch":"npm run precompile","precompile":"tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-pg --include-dependencies","test:debug":"ts-mocha --inspect-brk --no-timeouts -p tsconfig.json 'test/**/*.test.ts'","test:local":"cross-env RUN_POSTGRES_TESTS_LOCAL=true npm run test","lint:readme":"node ../../../scripts/lint-readme.js","prepublishOnly":"npm run compile","version:update":"node ../../../scripts/version-update.js","test-all-versions":"cross-env IN_TAV=true tav","test-all-versions:local":"cross-env IN_TAV=true RUN_POSTGRES_TESTS_LOCAL=true npm run test-all-versions"},"_npmUser":{"name":"dyladan","email":"dyladan@gmail.com"},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git"},"_npmVersion":"lerna/6.6.2/node@v18.20.4+x64 (linux)","description":"OpenTelemetry instrumentation for `pg` and `pg-pool` database client for PostgreSQL","directories":{},"_nodeVersion":"18.20.4","dependencies":{"@types/pg":"8.6.1","@types/pg-pool":"2.0.6","@opentelemetry/sql-common":"^0.40.1","@opentelemetry/instrumentation":"^0.53.0","@opentelemetry/semantic-conventions":"^1.27.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"8.7.1","nyc":"15.1.0","mocha":"7.2.0","sinon":"15.2.0","rimraf":"5.0.10","pg-pool":"3.4.1","ts-mocha":"10.0.0","cross-env":"7.0.3","typescript":"4.4.4","@types/node":"18.18.14","@types/mocha":"7.0.2","@types/sinon":"10.0.20","test-all-versions":"6.1.0","@opentelemetry/api":"^1.3.0","safe-stable-stringify":"^2.4.1","@opentelemetry/sdk-trace-base":"^1.8.0","@opentelemetry/sdk-trace-node":"^1.8.0","@opentelemetry/contrib-test-utils":"^0.41.0","@opentelemetry/context-async-hooks":"^1.8.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/instrumentation-pg_0.45.0_1728411051264_0.015183901520321452","host":"s3://npm-registry-packages"},"readme":"# OpenTelemetry Postgres 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 [`pg`](https://github.com/brianc/node-postgres)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 @opentelemetry/instrumentation-pg\n```\n\n### Supported Versions\n\n- [`pg`](https://www.npmjs.com/package/pg) versions `>=8.0.3 <9`\n- [`pg-pool`](https://www.npmjs.com/package/pg-pool) versions `>=2.0.0 <4`\n\n## Usage\n\n```js\nconst { PgInstrumentation } = require('@opentelemetry/instrumentation-pg');\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\nconst { registerInstrumentations } = require('@opentelemetry/instrumentation');\n\nconst provider = new NodeTracerProvider();\nprovider.register();\n\nregisterInstrumentations({\n  instrumentations: [\n    new PgInstrumentation(),\n  ],\n});\n```\n\nPgInstrumentation contains both pg and [`pg.Pool`](https://node-postgres.com/api/pool) so it will be instrumented automatically.\n\n### PostgreSQL Instrumentation Options\n\nPostgreSQL instrumentation has few options available to choose from. You can set the following:\n\n| Options | Type | Description |\n| ------- | ---- | ----------- |\n| [`enhancedDatabaseReporting`](./src/types.ts#L30) | `boolean` | If true, additional information about query parameters and results will be attached (as `attributes`) to spans representing database operations |\n| `requestHook` | `PgInstrumentationExecutionRequestHook` (function) | Function for adding custom span attributes using information about the query being issued and the db to which it's directed |\n| `responseHook` | `PgInstrumentationExecutionResponseHook` (function) | Function for adding custom span attributes from db response |\n| `requireParentSpan` | `boolean` | If true, requires a parent span to create new spans (default false) |\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\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-pg\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-pg.svg\n","publish_time":1728411051416,"maintainers":[{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"},{"name":"bogdandrutu","email":"bogdandrutu@gmail.com"},{"name":"dyladan","email":"dyladan@gmail.com"}],"_cnpm_publish_time":1728411051416,"dist-tags":{"latest":"0.78.0"}}