{"_id":"@last9/openapm","_rev":"99-57818546cc39742a50bcbf45c42208c8","name":"@last9/openapm","dist-tags":{"beta":"0.9.3-alpha.4","latest":"0.9.2"},"versions":{"0.1.0":{"name":"@last9/openapm","version":"0.1.0","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.0","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"79fbd5e99953e2a7d7d0b913a06a0fc41adf2712","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.0.tgz","fileCount":22,"integrity":"sha512-SE/lvAy7rnqw61XjvovVQJA1d/lxgND5U7P7YypFr0pKnPyGiemA8j2dmsLETzYlVoBQM3EK9chy7XXLYDvU+A==","signatures":[{"sig":"MEUCIQDGnq86z3daBaR/Kb/jAuwoPXb69cZrkGhoNWCdWDca1gIgPbvA922gTR3Hd7nfiRDTT4377PBxss8SZfxLxGn9OHk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2200928},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","gitHead":"abc1a1679e6a6a632cbbe9d9e6389ef861cd5a6f","private":false,"scripts":{"test":"vitest","build":"rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"cors":"^2.8.5","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.0_1689660823033_0.08641615804778846","host":"s3://npm-registry-packages"}},"0.1.1-beta.1":{"name":"@last9/openapm","version":"0.1.1-beta.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.1-beta.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"57d3e5d590c55fe06a56b8558f490634bf8b0c37","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.1-beta.1.tgz","fileCount":26,"integrity":"sha512-Kc3tEtIGrjDR02O9kAzmHzQcLGIqjZ8RCjzVMVq07UWAnu1oTcGy2BkEbTZEEsgQHGULNBLOhO43+IEzJ13IBQ==","signatures":[{"sig":"MEUCIDKW2esfWQV15aX45T/Z0rZ9fvdJVzuiqi5Fp2pdtlu8AiEAlMAd6dhuT+jwftGAANub5CJP6co04hJcIiALObdemIo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2206632},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For ex. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n","gitHead":"bffafa78b290e63c89dea5c5dd9c6a84dc00bf7e","private":false,"scripts":{"test":"vitest","build":"rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"cors":"^2.8.5","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.1-beta.1_1689668797497_0.9491918360401379","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@last9/openapm","version":"0.1.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"d085d65a8da040ef12732a6b1c6c90a41001fadb","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.1.tgz","fileCount":26,"integrity":"sha512-OWLOrZzcIckT0MJO0ECG2Wxgv2i6PDIYKX3C189e2HsUDbtCAGqSV/kCnwyuHt41wMvBb3f+M51vRnJqJ7aGcg==","signatures":[{"sig":"MEYCIQCQEPOinYm1Z0p3ohItXWGDYpgOzoojWAbqo3EQmFiqfQIhAJWor/cEoNALCMLlJQ4Yfe68on1/mj2V4ADWtQlpceoJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2206625},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","gitHead":"17cc3c4be50810b918567425603ae0c01839cf2e","private":false,"scripts":{"test":"vitest","build":"rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"cors":"^2.8.5","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.1_1689669021311_0.244819309640943","host":"s3://npm-registry-packages"}},"0.1.2-alpha-1":{"name":"@last9/openapm","version":"0.1.2-alpha-1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"8267435d6e68b42365ffb7d51b4e1f19e9aff9fd","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-1.tgz","fileCount":43,"integrity":"sha512-clfdH7/A2nqljbC8XhYN7HGFKWiVXc+5rmwaP7u0z0v6/xxdcEc7NObLTCzN+iyvSyphgaxt+POshc78LS1+rg==","signatures":[{"sig":"MEYCIQChhq98bYmHk3N20G9kXWCKizw+3pofJUAx7MIUatYkSwIhAMThQNiDy9cyGJ2LVHMwgDIMVsaBgRALHj6QoAkIAIhH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4933695},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"6e5528a559172c71e95524b1377b4a6653441ce9","private":false,"scripts":{"test":"vitest","build":"rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","node-sql-parser":"^4.9.0","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-1_1691566536999_0.7401482442870004","host":"s3://npm-registry-packages"}},"0.1.2-alpha-2":{"name":"@last9/openapm","version":"0.1.2-alpha-2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"74e70face17769614a2ad147bb6083d1e9e27ead","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-2.tgz","fileCount":43,"integrity":"sha512-eE1P1AitCjisb0+vdJwXm3F7oue2u0RbCzWWyF7MaN/TzMSUndMLpyT1yZ0LyMdIuTJ6FEvOVISkESnGZoDTbg==","signatures":[{"sig":"MEQCIEtoxjLAQIicQ3ITmqHqKKkkl1eUJxmyUvTqgIhfJC/TAiBkOc2ycN5pNdiKV3+TUpos39ovc80t37wkB6b+Lk/mfA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4937999},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"5e6700fbe2ada3c1bcd2cdf1f720eb174184f347","private":false,"scripts":{"test":"vitest","build":"rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","node-sql-parser":"^4.9.0","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-2_1691579220285_0.09275267593267933","host":"s3://npm-registry-packages"}},"0.1.2-alpha-3":{"name":"@last9/openapm","version":"0.1.2-alpha-3","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-3","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"07413cbb183f1a34641ce2feac93c6cacf4e616d","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-3.tgz","fileCount":43,"integrity":"sha512-hfJVXpvM/7xrPTCsZFDCQ2TqmXlBWuv36hW0rG4p6iaTG9BQii0HSU3q76MnmB9imy6uEi6PvVL7D9EwOVqE6Q==","signatures":[{"sig":"MEUCIGEz3LPrRUZOLOIoGfUMAaAM7lvR33wDR2IfbwhVzL6wAiEA5PWuzjrsMVKcbv7rz8FwGT/2mCl/f3HOQCsDR84pI0g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4937713},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"4d291ff64e22e51e0b8f6a9c4c9ab0536af16565","private":false,"scripts":{"test":"vitest","build":"rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","node-sql-parser":"^4.9.0","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-3_1691579827178_0.36195983356600236","host":"s3://npm-registry-packages"}},"0.1.2-alpha-4":{"name":"@last9/openapm","version":"0.1.2-alpha-4","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-4","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"d1bc6db8ea8b22546486ae7feaf9aa2726476c13","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-4.tgz","fileCount":43,"integrity":"sha512-d854im8NdB0J75YMvuJyN/M3xj1s2spyxnleggLVs8yexgELleO+s6r5XYPbDyqrr7gXBJbzr8BiM+SmHqHbXw==","signatures":[{"sig":"MEYCIQCeZ8XykmdmIxWO0ix5FjeoWzRryaFCttU0ObVoxHusZgIhAIBlVuO6lmHpVLU8HbKl4pQyHJ8gJdUOLE+tG55TVYPa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4937863},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"fd8d6fff85b6beaeed40e3b39e0acf2783656857","private":false,"scripts":{"test":"vitest","build":"rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","node-sql-parser":"^4.9.0","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-4_1691584688948_0.5367748178644918","host":"s3://npm-registry-packages"}},"0.1.2-alpha-5":{"name":"@last9/openapm","version":"0.1.2-alpha-5","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-5","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"95b7c6cfded99224082c69855bdef4e836edf58d","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-5.tgz","fileCount":60,"integrity":"sha512-wpyCHlf/OqDCe+FPqdTSKGTyCvk+ACXl5IdIc2mYgL3hjpb8xNbNytE1XVm7jM69muFyfL3brnUMHUmVfb0jfg==","signatures":[{"sig":"MEUCIQDJNo8RPyFUQ8EsmWQjU92CBFlLwbEDao25olX+5l8CuAIgETBy4et1+yvZLSHRtnFQtZiN8QPUxF+hGqWwlhqzFro=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5746554},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n# Grafana Dashboard View\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"8550f8d6273337a82057c9e13deaefd35b723826","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","node-sql-parser":"^4.9.0","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-5_1691585731608_0.4439737928959502","host":"s3://npm-registry-packages"}},"0.1.2-alpha-6":{"name":"@last9/openapm","version":"0.1.2-alpha-6","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-6","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"4dbbf9388aa09f0bc9c7f6bc4ec0ea41213cbefa","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-6.tgz","fileCount":60,"integrity":"sha512-ayu2bxXhHVHPLZW5a22TJCRHLDUAKAG7gvkEncC9apftyKP7pwOffXyfjIcCbpGjG3WgLOqrPV82TO9lP/sz6A==","signatures":[{"sig":"MEYCIQDkP00KuU0TKKQYQxtv8cIlGl3luilPCax4enGukBFp3QIhALOEc4+Rx0PyzQluyqL8rYdf6mkvcO5e88WiS0OCR9it","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3056205},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n# Grafana Dashboard View\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"a9f93246ff4720004482c5d08554e4e0a26d38c0","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-6_1691648968395_0.2551711601954971","host":"s3://npm-registry-packages"}},"0.1.2-alpha-7":{"name":"@last9/openapm","version":"0.1.2-alpha-7","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-7","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"634a29b6326df2e26fa5453ec2c91402a9f5f31e","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-7.tgz","fileCount":60,"integrity":"sha512-ekgbKXAyR8+pWYZOU7JJT9xVsq9Aic2AmFUnmuJgsAeCo/mYOnP+7VUsfEIyIiS7gPlK6953mW19jpTQNCFH3A==","signatures":[{"sig":"MEUCIQDkzFHl34TSOPCU5Dx6BRvaO+V03fLmX8i1xEjuaqNZJQIgdoFSHVZOLFJ/hoSTLuk7UtGah3vZTqhqIlpIkYMNA/Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3056319},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n# Grafana Dashboard View\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"9f8f2406708420326ba54194286781c3134f72f7","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-7_1691649246120_0.9672513875527273","host":"s3://npm-registry-packages"}},"0.1.2-alpha-8":{"name":"@last9/openapm","version":"0.1.2-alpha-8","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-8","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"f2b5e26b459217a482940c42799493aa52bcb326","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-8.tgz","fileCount":60,"integrity":"sha512-Ly7WK5dznu8+c8G3Jnt7igFCrIJrZRUzaPl05wB0WkEXEG/lm2eYmApACHMX2xYZp8nKZGx8D/YF2qNtXP5B7Q==","signatures":[{"sig":"MEUCIQDiXTLeXI1y7qP8d/JSCKPCr9W8L4Ay1fW68PFQBLTb4gIgQpNotNg92jhfi8VErGTJV9JBppiQQHmU9n0c1VLgfCM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3057164},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n# Grafana Dashboard View\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"ac5020985c16c0e46ffc9a7e6576e11ea947d291","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-8_1691649558368_0.35372774896771464","host":"s3://npm-registry-packages"}},"0.1.2-alpha-9":{"name":"@last9/openapm","version":"0.1.2-alpha-9","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-9","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"9766ffc4306f89ac46c86c78e29ae321db0b49e6","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-9.tgz","fileCount":60,"integrity":"sha512-z54a6pPoAPUKwIjFP8MLIjQ6qKJcj1AghOvxus1auWYT8LeICMvryn4RDyIDp3yG/G+mqta04nSeFTw/Y1zQKg==","signatures":[{"sig":"MEYCIQDHLKibSlw+zBAqJJ28dsyYiTZCBvI9+sUbAzTpF8rf+wIhAKs7mAy4UmnYeJsEUsTxvJJuVK13dUmLtUeCrhZY8xvf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3058323},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n# Grafana Dashboard View\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"95155537c98f9c7f503c93970924dac7bbb336ba","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-9_1691651267492_0.34114551968641615","host":"s3://npm-registry-packages"}},"0.1.2-alpha-10":{"name":"@last9/openapm","version":"0.1.2-alpha-10","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-10","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"4afad9ca2feed87ffdf6af2b40265583f10420f5","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-10.tgz","fileCount":60,"integrity":"sha512-8R95tVsVGI2Npwh5hVAs/M8Sh/Axg/vA6fMo/AYx1vCx1qr/TiRmr0Qj5+KeHDyuFNtbon/4kl+g/kV+AUddpQ==","signatures":[{"sig":"MEQCICSUuT2YoCCq9PjGMjemekb74STSEIUjawK1604dOMBVAiAJRj/om1CsWM4+glXslocfNSS0o2dPS3YvAZRASAdj0g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3049547},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nTo instrument the [mysql2](https://www.npmjs.com/package/mysql2) package, you just need to add one line of code. Make sure to add this line of code before you initialize db connection/pool/poolCluster.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"82f6c0d47697ee893981c3c680ef8d83d6bfd040","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-10_1691686631129_0.15379044813335097","host":"s3://npm-registry-packages"}},"0.1.2-alpha-11":{"name":"@last9/openapm","version":"0.1.2-alpha-11","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-11","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"70462ebc9aca3c3a0ae3a9f9e029b2e25e5dcfa2","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-11.tgz","fileCount":60,"integrity":"sha512-2wgYgxc4A4T0sET+pG3NyLYOFXvKormqMhVMCsflsA7bMBJP9bcmEZjMGQCr1fiIquhjOAfcdAQ43+RF2T9wZg==","signatures":[{"sig":"MEYCIQCCUUTovMjKsWxok/vE9KSk6qgKge33W564VZ4NtSuSvwIhAPeKA81G6uhzrrh2L8Edvx74yaW99cYIo/vHgTxveiNm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3051261},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nTo instrument the [mysql2](https://www.npmjs.com/package/mysql2) package, you just need to add one line of code. Make sure to add this line of code before you initialize db connection/pool/poolCluster.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"7efebe331c4e80d0c3f5cc9e7a2517407dc75f59","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-11_1692016600865_0.014799246712982272","host":"s3://npm-registry-packages"}},"0.1.2-alpha-12":{"name":"@last9/openapm","version":"0.1.2-alpha-12","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-12","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"85adfe9680387f8939d0ed5ac92c79ceff1a1a77","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-12.tgz","fileCount":60,"integrity":"sha512-M/eJkapHk0cmXvkn1GHWkw3yZ44vKEPVmDXKwSQcpE5Dhs18F9V3FZIKyoHCh1Mdj9EMasjlTkD3cCE2QIEOWw==","signatures":[{"sig":"MEUCIHuCQhVE5XXT84ATaW0Q69gekqjKer6oMkQ6+bQ8gcf2AiEA2hpFwxYH97x0VEhtpOWOs5+ytXHF0XTrlrUzPUVq4UY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3052626},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nTo instrument the [mysql2](https://www.npmjs.com/package/mysql2) package, you just need to add one line of code. Make sure to add this line of code before you initialize db connection/pool/poolCluster.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"4de9a6a2463a91ef8689c9855a9c44ad404052c6","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-12_1692021461841_0.15096962853829154","host":"s3://npm-registry-packages"}},"0.1.2-alpha-13":{"name":"@last9/openapm","version":"0.1.2-alpha-13","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-13","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"d411958195a55d08eec203f410122b316d8e124d","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-13.tgz","fileCount":45,"integrity":"sha512-XIiNTrtORfm3E0IDCrMFva+EZ0Vw3HPytIQHzw6SC4FRhAQAEAT3IPowdk0q0U18+zVZK3RJy5LfhX+PjTluoA==","signatures":[{"sig":"MEUCIGLV32V5QG10tJOkAvy55ueJ2HhV3jCAg2hhz7Z9mPtqAiEA6KzDyBrnlhTR3v7XLEansFUjcKYoOMPUeokBI5pOHdE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3047712},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nTo instrument the [mysql2](https://www.npmjs.com/package/mysql2) package, you just need to add one line of code. Make sure to add this line of code before you initialize db connection/pool/poolCluster.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"da47bb99cfd7a62564df16bbfb783219babd8857","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-13_1692076619343_0.922261001976882","host":"s3://npm-registry-packages"}},"0.1.2-alpha-14":{"name":"@last9/openapm","version":"0.1.2-alpha-14","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-14","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"2704f72c3cb35d506fcb7a14b8fe1f02897e80e6","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-14.tgz","fileCount":45,"integrity":"sha512-9pf01O9EuFcFDYs+r2+M3vQMa1bpqE58fiWYZu3VSMbltby5XD8t7C8/65b1nNsX6wk6m+QhfnzBEsdRBkeh3Q==","signatures":[{"sig":"MEQCIGwfbl9+iTVuTV5fHonNCdktT+FnY/nvB7MAQ/efbyelAiBWtpB/JFhTUoqeMF2JDO0tZUvFtn3vfhiByfOLkRhgmA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3052373},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nTo instrument the [mysql2](https://www.npmjs.com/package/mysql2) package, you just need to add one line of code. Make sure to add this line of code before you initialize db connection/pool/poolCluster.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"449244435978ad6e55db7371300426cab347aa57","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-14_1692276679505_0.9674115623042934","host":"s3://npm-registry-packages"}},"0.1.2-alpha-15":{"name":"@last9/openapm","version":"0.1.2-alpha-15","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-15","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"be5938b99a2de53665e626205cfd86725283a4c0","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-15.tgz","fileCount":45,"integrity":"sha512-Z56E6qth1TrAqCe7J4l1Rk1zP3OyEOJQnCfC1swLp4bAwBDot9/xLorr3ZryznYr6tAkjLDLBsp6jK9i6qUSsg==","signatures":[{"sig":"MEYCIQDSXgwOyjwYfdntIv2VZr27lSErg7cF9aSJD0MxLiGzcgIhAOW8ZjSu1G1vJr2Ph4MXpPZXDqhrA5vFsTVNugdZpNZt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3052075},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nTo instrument the [mysql2](https://www.npmjs.com/package/mysql2) package, you just need to add one line of code. Make sure to add this line of code before you initialize db connection/pool/poolCluster.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"3adcd1e8a522a9e84c099e3722276e3840cdb1d7","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-15_1692284188824_0.43409087373761523","host":"s3://npm-registry-packages"}},"0.1.2-alpha-16":{"name":"@last9/openapm","version":"0.1.2-alpha-16","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-16","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"747cb82dd0c78dfbd55f96fa2cb34e66b0e0b710","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-16.tgz","fileCount":45,"integrity":"sha512-d5fAHs6PxmffOk963Y6mstvxt8QeF0DkFNx4jBcasCCJ6BxMHeIIN14TWtE5FZblGGKFuouHccOssvdlDJ4r0w==","signatures":[{"sig":"MEUCIQC+iNVJF56sYusFJrDlvaMPghWOiSzt9tYhsAEOe9FcagIgNFqCmoL4xrmkKBtnLSTvvHSAWeVujhIDscu/vFFKQNE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3051113},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nTo instrument the [mysql2](https://www.npmjs.com/package/mysql2) package, you just need to add one line of code. Make sure to add this line of code before you initialize db connection/pool/poolCluster.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"f556f34bf982fa9ecef7ff2fc8de6d379ba581df","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-16_1692290515224_0.701205106065774","host":"s3://npm-registry-packages"}},"0.1.2-alpha-17":{"name":"@last9/openapm","version":"0.1.2-alpha-17","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.1.2-alpha-17","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"3f12721a88ef4d3d41287cffaf775551e43167b9","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.1.2-alpha-17.tgz","fileCount":45,"integrity":"sha512-FISaVXNUXQfcuExS8XWUG3g/mo7RXG/XnD+E0Lr9CUfIcujD21qv24LAe3GvkNmg57daPtpi/LOYbDFqO2zmCg==","signatures":[{"sig":"MEUCIAPyJ1sxZrUxwe3ZqrNvT7KgJg+0IBedr61tikSkKXuJAiEA9N3L5A3IbMQNAXlmuSeQaooQ/9giM2ai5iKAkrjW1Qk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3051179},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nTo instrument the [mysql2](https://www.npmjs.com/package/mysql2) package, you just need to add one line of code. Make sure to add this line of code before you initialize db connection/pool/poolCluster.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"867ccb847bc68387cf7ad25de5f11607a743fcd8","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.1.2-alpha-17_1692342466402_0.858214299325464","host":"s3://npm-registry-packages"}},"0.2.1-alpha-1":{"name":"@last9/openapm","version":"0.2.1-alpha-1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.2.1-alpha-1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"a82f4fdcf286c6494aa40270967e85459d7753ec","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.2.1-alpha-1.tgz","fileCount":48,"integrity":"sha512-IJqmI5n37Sw2DTTB5YRoOA1V/HkFfDenAXKOClN0sNpyr1YedUJrevB4Eg1ys1mxQ2+/0Tef3k8kKi/EO36lbw==","signatures":[{"sig":"MEUCIBl65U957uOCIbLfCDwgxn3TWVs1IIc1WVJfwEtUSyYGAiEA/qxkQFV+E5cAxwMN7AMcvxVV8YJRZo7KUqXXG866rYY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2440316},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql2');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"46b4da67a9949cc50c8daa9f5979873a54b4cd0e","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.2.1-alpha-1_1692796648269_0.24024015197350157","host":"s3://npm-registry-packages"}},"0.2.1":{"name":"@last9/openapm","version":"0.2.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.2.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"0b030a9e0090ee928a95520838099f440491cbdd","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.2.1.tgz","fileCount":48,"integrity":"sha512-E1xZpM0yJwPkW5h3Wfph8LKqUeAil1ZwhdwlnjCXI25nvUwF4xXb3X/dsfjRIEMdXmkthsW43by6O4wgffc8Xg==","signatures":[{"sig":"MEQCIGS4zuqFciM91ZZ5qrGF8SmNcm68e5mJ3586HPgGlQY5AiBujn3E0n/nlDF/+519oOH70quA0bYHSckZFzOSXJZ2hw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2440307},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","gitHead":"78d9cb4ef8a960f585e98752b98ee6bc3e4711f9","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.2.1_1692801699165_0.5860511097637704","host":"s3://npm-registry-packages"}},"0.2.2-alpha-1":{"name":"@last9/openapm","version":"0.2.2-alpha-1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.2.2-alpha-1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"96da3e9baca45b778ccc0bba6e0304d1a53cbe60","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.2.2-alpha-1.tgz","fileCount":48,"integrity":"sha512-52klbKn25elKO5NLFRzH1ucqBMRZKnMI99mVyN9P/qLjSsNmX0QdcUXt+ywGpEjn10GubqEb2QDc441ZCLl1rg==","signatures":[{"sig":"MEYCIQCu0l8Q9cAXnNYIGqEKPLuoe1dGaGH8NsLL5XaZaNBm2wIhAKq6EJvFxNBAGC4K9GzDRQuqUW29BOpQkyLFuDJrB+5l","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2440975},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"064d0247402ba8011f367fcd466d8f701a49d8cd","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.2.2-alpha-1_1692897480142_0.7242773866494356","host":"s3://npm-registry-packages"}},"0.2.2":{"name":"@last9/openapm","version":"0.2.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.2.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"b5e424cd2aa32c3b0ece11fbd0d76da8b9939b53","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.2.2.tgz","fileCount":48,"integrity":"sha512-tQ9KDHxZNnRUyS7tjeX816ntkRU2ja5mkTf2TaJEAAcS76SZtr43fy9ExznO3on0HGoyfDwXI3+0QlOfuPUO1w==","signatures":[{"sig":"MEUCIBR2aZzb8QU5zuJe8QXENIo4jUp1RqDvr/O8Y+rV1nz6AiEAnjoc6dGE3KYbUOlHg3FPMITL+Y5HHFDplxDXKsLT3PI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2821487},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","gitHead":"4409940b6f49e6376eb3a961774a9ffa6ee11106","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.2.2_1693805454828_0.7429250488586856","host":"s3://npm-registry-packages"}},"0.2.3-alpha-1":{"name":"@last9/openapm","version":"0.2.3-alpha-1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.2.3-alpha-1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"9f96f99b26511cc1393c9c37e152c07eadd65631","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.2.3-alpha-1.tgz","fileCount":48,"integrity":"sha512-jAD4ejda0Qo3D7nRHrb4/EdDV+gRvuE0gi9w8P9Ydx5qrANa2ofcznKwP6tJV0mtFjFOKYIlYvAOiMRwLe9PzA==","signatures":[{"sig":"MEQCIFBUtlPz5b1bB1LdPpjtZyNfe5xUkr01Fmral3J7120qAiBhb7fY/tP1Nz9F/oGu0ATAHtMtwqabFyxQs50DhXG7cQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2821495},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"ebc12e01d51acda86bf5d2c35263e80f8c520f6f","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.2.3-alpha-1_1695201680496_0.734180132250347","host":"s3://npm-registry-packages"}},"0.3.0-alpha-1":{"name":"@last9/openapm","version":"0.3.0-alpha-1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.3.0-alpha-1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"2a2d5cb12ff72af87a509e66fbd5f9f3f9318071","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.3.0-alpha-1.tgz","fileCount":48,"integrity":"sha512-CaWKhSTtiBC/E2Z4epPJlcPrQnpEGFfy282AHvGgubrD/Jgmc06/39Bj+RzVjJRuBvRRCN+EhLWG0dGus11S7w==","signatures":[{"sig":"MEYCIQCTfbFPVc24SDcLbx6SGN8+gjMAkpkQEoI+Rq9Rt2DWPwIhAKROStW+VFgNyBpqV5eN0aSlP4RF87dithCyXwS2ZLMy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2826044},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"1e2dba22a6a3522ccbd8d9043b99ab3b6bb57600","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.5.1","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.16.1","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.3.0-alpha-1_1696818540228_0.48914375074108873","host":"s3://npm-registry-packages"}},"0.3.0-alpha-2":{"name":"@last9/openapm","version":"0.3.0-alpha-2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.3.0-alpha-2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"cd90b9cc26c4fe01f3e3e12620125c5086e30d7a","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.3.0-alpha-2.tgz","fileCount":48,"integrity":"sha512-BAqfgASnQcyIjBqtRKqSvQh42s72J3aFIvF3puPzxGs/dnzgvMokfreDidcYtmNDOipMPResp3/YbBboHMf6VA==","signatures":[{"sig":"MEUCIQCgmCCQYTbFQaKEcQTfpBYWlMdrAByzxfVhSchshKJsrgIgeKQUeus/XMy3jCJ0UlT2jkwjk91Jr2U4jTXiIF76fyA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2828359},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"64fffaeac1818d18193ceb8d87a7a0d4b4dd3cff","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.5.1","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.16.1","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.3.0-alpha-2_1696825632842_0.5049119455990618","host":"s3://npm-registry-packages"}},"0.3.0-alpha-3":{"name":"@last9/openapm","version":"0.3.0-alpha-3","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.3.0-alpha-3","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"c93e1c8c03a35f157a6833f87952f90348296a47","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.3.0-alpha-3.tgz","fileCount":48,"integrity":"sha512-WwvLaq9A1REseh5814R7VdG5PwePHh+GfCcoMHkscaoww1e2Am3mcdNGMYAJt1ZRyO+Bx+2p8Shzi5rDR0e2eA==","signatures":[{"sig":"MEUCIDVr1UMzyl637cDJuA902jk9JPA3skmeGUKPkl+FSty4AiEA1Lv0vIB1l+V9djydl8m5Nmh4DnOxkSmauqRuUUtiC+w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2835371},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"7441fdebff02f0e92bec7a2f02e4fbaec23cb33e","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.3.0-alpha-3_1696846635407_0.5305865121941233","host":"s3://npm-registry-packages"}},"0.3.0-alpha-4":{"name":"@last9/openapm","version":"0.3.0-alpha-4","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.3.0-alpha-4","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"6f4cea4dddd41bfc40a1bf92046dac5b025772b5","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.3.0-alpha-4.tgz","fileCount":48,"integrity":"sha512-9tp6BChJef2uG44CT9kj1d+Df+GsXXY0F8pWqytTCajstux3Nud1j2jD74h7ZKMRR3FWjGhyUOX6j795+4AsxQ==","signatures":[{"sig":"MEUCIQDUm/zPgwfw2o6Rb4+CF1g3nxzQ+ZbWwH2hYHtmKr2QvQIgESXe9ScBmEoMTNqUxRcpcpIA0kwsg5Jt58PGKPpUa0Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2836302},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"b9339cc50485d1a1a5bbb89cf5068b1d4f5f9633","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.3.0-alpha-4_1696914189482_0.24100732192703633","host":"s3://npm-registry-packages"}},"0.3.0-alpha-5":{"name":"@last9/openapm","version":"0.3.0-alpha-5","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.3.0-alpha-5","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"a51eb59ed9dbbb2054048af1106098ea8cd9d757","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.3.0-alpha-5.tgz","fileCount":48,"integrity":"sha512-SmqlmUw6ERhO/npLBS2xzJaioN3/I/E5mfmbGuuZetdjdnkS4srgsc5j2Oit9p7VHNnZAIH23++6M84cGbcf9w==","signatures":[{"sig":"MEUCIQDklQbqWbQMzGHas70y2CGGZwQUhxYlBKW/sq+YvwnDtwIgD3WmWiFb4vUCOzySv2r4tNKudaE+PlG1J/ZkHdbnhJc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2837420},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"c42946188189c7f984e98e4d52f1c372c9eb432f","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.3.0-alpha-5_1697005266676_0.006571995871301972","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"@last9/openapm","version":"0.3.0","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.3.0","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"cb0b603cba33f8184f947a02e0bafa07b16de19f","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.3.0.tgz","fileCount":48,"integrity":"sha512-lcviQDnWWkpX/u9rTESl58X0p49+YM1ad5Kt6AxgijdhHteInik2nCgjZs0B6oGqY5qPlx26eU0s72GygFv6fg==","signatures":[{"sig":"MEQCIHDubF52pAgZ58J6VbFmdj61GHrrAblTKsSkZCFE87MHAiADX2Vwc1U8+jShD0R9/vVcqJZY6YZK1s4dy2auhGD4DA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2837730},"main":"dist/cjs/index.js","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","gitHead":"99b8db383369dcda4c07de08e4f5f1d348b26923","private":false,"scripts":{"test":"vitest","build":"tsc && rollup -c","test:ui":"vitest --ui"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.3.0_1697007328240_0.20179883459500836","host":"s3://npm-registry-packages"}},"0.4.0-alpha.1":{"name":"@last9/openapm","version":"0.4.0-alpha.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"2388edfbe0db6afefcb75853c5d3bded94f2f1af","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.1.tgz","fileCount":25,"integrity":"sha512-BzNpSv8/P/PEos8o82xX/HnSuy6rMfFkozqSWtcqcHVoRYv1jM3yLQNAoMaF0P5SfgGAZ5ZxAdjRzIxkP9Dm5A==","signatures":[{"sig":"MEYCIQCjmwAmgV5tvi9FiEusRM3BZRiQvPgsJmeEyfViEV7IyQIhAO0YcQxtNC8EtKVAmd1xkd4DEwNQiG5YICLHn9zJ1fs6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2597811},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"b38e1af908625f6b0c8f60d3dca213b6abf63f45","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.1_1698389184456_0.8713433244966569","host":"s3://npm-registry-packages"}},"0.4.0-alpha.2":{"name":"@last9/openapm","version":"0.4.0-alpha.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"2326c84e3f4adc8ee94a0069601ce2dd39c4ef1e","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.2.tgz","fileCount":25,"integrity":"sha512-f9C+MM2YTiXszsemXWKPpeNwDj6Jsl8q3iNONgnNdwh5+posTZGjK0uaJG3PeyThLZDpjfkNppkcxKbgP5zZyw==","signatures":[{"sig":"MEYCIQDW1UlS0eDwslp9Ra0TMOj9Pm5x9aBqs8jR0zyv5hJLMwIhAMxzyXMsDLrDedWl/VnzWaInTcbH7guSTdZfrsMhFLRy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2608816},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"00e813d8ae702ee6f6374210e7c59ffb374d4d10","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.2_1698389668898_0.3201412055602637","host":"s3://npm-registry-packages"}},"0.4.0-alpha.3":{"name":"@last9/openapm","version":"0.4.0-alpha.3","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.3","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"c18c5b1a93c9de00993b412963c36df735303c7f","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.3.tgz","fileCount":25,"integrity":"sha512-XVE7R27dNff1eeX3CM070rtDrSSAdfqtwlYrqj1o17TWUL1vZ6OvwRdYhjTZHCElDShJcvcbOv5lOkTT1kYP8g==","signatures":[{"sig":"MEQCIFUAxlJWJ7dVgf9WFJYsmJ3qy4ro2jUo1juRyk+WO7qdAiBYsqDbNnivE0byJNguLH/VG4ONaSd13g3J1XG4bvpnjw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2610705},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"1e4678b4e8ac81592bf0a36b4e6142b9770f3370","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"on-headers":"^1.0.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/on-headers":"^1.0.2","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.3_1698645768286_0.21074314758928359","host":"s3://npm-registry-packages"}},"0.4.0-alpha.4":{"name":"@last9/openapm","version":"0.4.0-alpha.4","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.4","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"e21adb8747db9236cb3aef8a52836e5a733b630f","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.4.tgz","fileCount":25,"integrity":"sha512-vYI4RR3E6UYrx0Q24T9INi0BRssCrzLZuKAyQvEANa7FFcaOAQZEkYfjImfkHysITbP085/PAVx4WzFyvOEsFQ==","signatures":[{"sig":"MEUCIQDD2/BYvFF4yiG2mdBYnoxozuCJ854WMHrZXzgIwtEhCgIgT9J7Cs8D5TMV6A0brKxQ2ejiBfUx53IzsLG2bf5XX2I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2610867},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"c4d2764c02642dc08e997c4ecb2e71269bc2db43","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"on-headers":"^1.0.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/on-headers":"^1.0.2","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.4_1698646091632_0.3205887255574822","host":"s3://npm-registry-packages"}},"0.4.0-alpha.5":{"name":"@last9/openapm","version":"0.4.0-alpha.5","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.5","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"ee2d2a25fca56771dceb486058db9301ae3aaadf","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.5.tgz","fileCount":25,"integrity":"sha512-1O2KF5dZSheYwYfv+W3hA384cv3ZGuVUD+UD5PLpSg1ClpjQ0JqHWxARd/DzvW51Z+h+vaGmB+rp7t2wF2tWqg==","signatures":[{"sig":"MEQCIASld//UypS+GIM+/NQwBTEyl2oZKlnnJjWx8DDYprNnAiBQIh/n9V2Lc2+SbMRoSgu8v0H1GYR/G2FRKI5H/i9l3g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2611005},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"b1cf694c80b5e5f2fd7468463f39823c4a311019","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"on-headers":"^1.0.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/on-headers":"^1.0.2","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.5_1698646292353_0.17351270172032662","host":"s3://npm-registry-packages"}},"0.4.0-alpha.6":{"name":"@last9/openapm","version":"0.4.0-alpha.6","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.6","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"463a89084b7dc9a6f9046c522009e68c3e305564","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.6.tgz","fileCount":25,"integrity":"sha512-drjAjA56JBwuFgS8j+3Mb4zTwmowKvNTRTt30zTvtRFLBIynL67xj/rl/9jfmh6ZnleDFRSPKpkhzjogU48b7w==","signatures":[{"sig":"MEQCICPnPYBh8y8RiTz1HeffIua/xrHVIuSBzxOTml4kGEuYAiAHw7m7Cz3xK1T08yPycMcCUHCgdymU6oaRLDEPs8enuA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2613541},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"7ebad532111b5dc2e0d50947077b2a44759547a8","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"on-headers":"^1.0.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","sinon":"^15.2.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","rollup":"^3.26.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","proxyquire":"^2.1.3","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/sinon":"^10.0.16","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/on-headers":"^1.0.2","@types/proxyquire":"^1.3.28","@rollup/plugin-json":"^6.0.0","@rollup/plugin-babel":"^6.0.3","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@rollup/plugin-commonjs":"^25.0.2","@rollup/plugin-typescript":"^11.1.2","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","@rollup/plugin-node-resolve":"^15.1.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.6_1698647691550_0.3883904426275939","host":"s3://npm-registry-packages"}},"0.4.0-alpha.7":{"name":"@last9/openapm","version":"0.4.0-alpha.7","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.7","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"ba8951e0cd0a9fcc783b3a7f5fc2cb06095ad5aa","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.7.tgz","fileCount":24,"integrity":"sha512-kjmkurnwyDYv6UOfy9F7fFjBICKmBNLSyt+ZUNeizbbmBtB67qE/XUzLTk0FT6xJPJFSu8w2+/UwjzVoFxBoZg==","signatures":[{"sig":"MEUCIQCykBmoSIhZ3aN4OcPnLEYf9wIX2b7eilkfK7R0dbd/CQIgc3aYBnPY1k39LLrs8zKdCd2AkPhryh4XdalrYOM+EdU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2611071},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"d65b1858f5ea2b3320b7671d77aa7a2ac1c0045d","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.7_1698650266921_0.5048332998678007","host":"s3://npm-registry-packages"}},"0.4.0-alpha.8":{"name":"@last9/openapm","version":"0.4.0-alpha.8","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.8","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"968fbcafa19c85e8e6faded3b57273031a5b9fbf","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.8.tgz","fileCount":24,"integrity":"sha512-3rwOy1NfurvnV2ASOngOdhabNgjdEXCkF9fHYI6YWt7Fq9dEwUoXTdLsnq7jSDg3MWcnB/r9bWKCWkbWueUNdg==","signatures":[{"sig":"MEUCIQDRjB+Zvz1FaHtRDDh2be9Zx36otN2PWM0CBZlQnD4wTAIgdokecz43t1ex3NZ7qojpmvAFHFGsCKXH4R21HxQNheM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2613309},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"c07a9c8e25fad0b6e3b93c0d29bcd6e8445348e6","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.8_1698759011836_0.6934518748961873","host":"s3://npm-registry-packages"}},"0.4.0-alpha.9":{"name":"@last9/openapm","version":"0.4.0-alpha.9","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0-alpha.9","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"3db82e57e81987aba5cae7a19bb7cfe2efac9d3b","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0-alpha.9.tgz","fileCount":24,"integrity":"sha512-18d99jG9LB4q6vh1pIP3Gzusx6OoBk9VVRjILthxzAiLtGfWJV23Y3xPpHumL4ymdcSULV2e/4PBa2iO4bkbpg==","signatures":[{"sig":"MEYCIQCJxtQx08z9f/IcSrYXCNgL2kLgRNoBzAVR66CMwYdpaAIhAJGhKSdQ2/lVY9CrcB1ika9mfStmhOGaJCQn1wzVSK1X","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2613960},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs')\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n9. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"544403f938b60b5159b2dcf8e78035fb9259816c","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0-alpha.9_1698918756892_0.6880276672139587","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"@last9/openapm","version":"0.4.0","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.4.0","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"46fb11955ef177776af617d579ec76994f50ba9b","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.4.0.tgz","fileCount":24,"integrity":"sha512-uKDFYAVBSUMJfAacuJfaU+pnguNcwoHO5F7cH5zEXnxLxiuz7uLogSzToEkOVlwnkM2k7oEQAcnCalDRLiMunw==","signatures":[{"sig":"MEQCIH0nBgtjviHeLl7Q7SB5yPER57TRehc5fp23pam4dH9oAiAnKFTO4v9nxZTqv0a1el79MN2ZmZJdf1OQ+pE32H3xTQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2614147},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","gitHead":"8df33b82aba230026270f715687c3daf0d7e52e0","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.4.0_1698932822402_0.2646692389421139","host":"s3://npm-registry-packages"}},"0.5.0-alpha.1":{"name":"@last9/openapm","version":"0.5.0-alpha.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.5.0-alpha.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"6a2e55cd1122bfb3092d87408792d9acdbd5a4e4","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.5.0-alpha.1.tgz","fileCount":25,"integrity":"sha512-9W9Sz/Qw+bNQr0CV8UlxdUTh2T9WcMPj27VL6w9DqcXda6WImQsOfSFdWTNxc6x7NfvBStdurQZ/+TV534aPAg==","signatures":[{"sig":"MEQCICpL0gcEGmbJpDuK2rOa1OuPvuCW/uBN+HcIJkNXiNglAiBkTyf6Dq1Z2kIIKu8f+c18h8N8Qls2167cItY1v5i0Bg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2645321},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n9. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n10. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"8554978800f6830d67ec3cb3002fa09883ffc83d","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.5.0-alpha.1_1700232105941_0.9162133474710807","host":"s3://npm-registry-packages"}},"0.5.0-alpha.2":{"name":"@last9/openapm","version":"0.5.0-alpha.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.5.0-alpha.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"492356099f76e54416f4d711e9c284418f2692a5","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.5.0-alpha.2.tgz","fileCount":25,"integrity":"sha512-eFLKN69gbNt4ktwU2OAKHGIUwo4qZiltaWzcAVKy5N206urbHU6pDz2mc9I/tVEXKGSgG3QOVgwZ/qLFUHLfiw==","signatures":[{"sig":"MEUCIQC5cABR6XLqS+zctRa1aekqfEYpGW15koqpmbxx5Lbb8gIgH/XEY/xMR0A7e8sb4aSMTlbpK6rTXqrWDrCk0GrCwKg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2642251},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n9. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n10. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"4683c2e7138d6d754373a099e4dd8629895ca2c1","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.5.0-alpha.2_1700838250946_0.4136628609006481","host":"s3://npm-registry-packages"}},"0.5.0":{"name":"@last9/openapm","version":"0.5.0","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.5.0","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"a6ac78a91b76665994da2f9cc9a9c6bebe8938c1","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.5.0.tgz","fileCount":25,"integrity":"sha512-orZYTTwVZmqaQeCkmpAv6KMPMe7OiBbCsTD/jgkvarTepOwlT6ixixz9yOzLgWh70XPRGrRlphXph/VlFtgVlw==","signatures":[{"sig":"MEQCIEkCCx+uSLUBORXtDG8RHCRGUhfNSgd6X7FRtkFq6udbAiA6PRb9STKyCDZgIZzC5gU0rVqY2Zd/wREeaT8JSM1ICg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2642357},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","gitHead":"814475efd4a6d899098129872558bd31736ef4ce","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.5.0_1701671449029_0.10914546783633483","host":"s3://npm-registry-packages"}},"0.5.1-alpha.1":{"name":"@last9/openapm","version":"0.5.1-alpha.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.5.1-alpha.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"327bbb7343ba70eb119042ec354fd49704d306ef","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.5.1-alpha.1.tgz","fileCount":25,"integrity":"sha512-MdNIA6ax1RbtY6XgZSEK4dqEBZsS8Miz5IJV4gVh/1evqXZwDCtK7ZqentOPZtMB/q56Adz/36P1jovEdVEfag==","signatures":[{"sig":"MEUCIQCzCTL1so9bemP90K27uHzQ+NRYRFcDDpcLU5XrexRVIgIgSPuByZWCfuIGA++hbSN39fslRpk07b/lSvV44NZEtzQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2639876},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n9. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n10. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"996df729263881e8348434843fb646a9859b7061","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"8.19.4","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"16.20.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.5.1-alpha.1_1702454675034_0.19141444221019532","host":"s3://npm-registry-packages"}},"0.5.2-alpha-1":{"name":"@last9/openapm","version":"0.5.2-alpha-1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.5.2-alpha-1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"f2b596d3ae91902f50730cbb8bfed6e5ddde97e8","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.5.2-alpha-1.tgz","fileCount":51,"integrity":"sha512-1MjT6jWj9fRgwu33OGd0ZI5aGeMFmcclG1AqDkbUpGyGPztKtWItJRHxZKhVrxDSpXbi4CQI6oHCCkMD2Q2ftw==","signatures":[{"sig":"MEUCIQDNJbYycvzpQYFMh4+TDgj68ym9isYHQ6WxRO+TOPbnEgIgUG5GioHsqYZHYD/tDT4vLEsu1BqtCgFgtJ08mfzJa8A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2825630},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n9. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n10. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"a74c0c248d1452117c4c09cfaf525bd3b799daf2","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.5.1","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.16.1","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.5.2-alpha-1_1703110424161_0.07070353257985573","host":"s3://npm-registry-packages"}},"0.5.1-alpha.2":{"name":"@last9/openapm","version":"0.5.1-alpha.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.5.1-alpha.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"432ac17cf1dbb02159fc04f3f304dfb962002356","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.5.1-alpha.2.tgz","fileCount":25,"integrity":"sha512-M8vw8YoS9FXf3D1rt2H1+RLZTP/GcznanDaOKi6VEHUjByTnyDuPcwnjNYWmIP+Ynznx8sPuckHDXJNdHt49Cg==","signatures":[{"sig":"MEYCIQDHpddB+raUx4dA/7gTMTU2R5WK4vGzyXzr8RV04P8CUQIhAJVAgHgaQHPXQrVD5bzxO+RgvaCrgD+2SwEalO5T4JEX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2641068},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n9. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n10. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"c9a5b1408bd24391ae46cefc89e5cfa10e7e6238","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.6.7","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.17.1","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.5.1-alpha.2_1703144388398_0.8537196019168642","host":"s3://npm-registry-packages"}},"0.6.0-alpha.1":{"name":"@last9/openapm","version":"0.6.0-alpha.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.6.0-alpha.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"fb041cf807eeacade3404cfab9826b65d3536c16","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.6.0-alpha.1.tgz","fileCount":25,"integrity":"sha512-zzUm0PvNs1FdFmZ5WygSDeHI1AiCQuZUPMiWK6wXm4PyEFDKOBQ+cqOhcF7Zr5VIyJXsIhHOXvKBY4+B9N0xOA==","signatures":[{"sig":"MEUCIAaKtr4bpW7xNotrW/ZQsDdAwjaHRAsgAZn/GoRrXQQhAiEA/09YJSC2SBN1vxdfv8u2/npgbBhDskimBmHuSaxKwPE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2647377},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `customPathsToMask`: (Optional) Provide extra masks to mask the URL pathnames. Checkout [url-value-parser's](https://www.npmjs.com/package/url-value-parser) extraMasks option to know more.\n   ```js\n      {\n         ...,\n         customPathsToMask: [/\\b\\d+(?:,\\d+)*\\b/gm] // Accepts an array of Regex\n      }\n   ```\n9. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n10. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"b37047de5bf0e32ce6bfa3602a24d66161822eda","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.6.7","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.17.1","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"pg":"^8.11.3","tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","@types/pg":"^8.10.9","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"pg":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.6.0-alpha.1_1703161211213_0.058376026648193635","host":"s3://npm-registry-packages"}},"0.6.0":{"name":"@last9/openapm","version":"0.6.0","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.6.0","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"64b7fb7978e2b9ae86745a9210da4ae52f34311e","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.6.0.tgz","fileCount":26,"integrity":"sha512-I53KXlA4YJ19KrfJDxV4/32LQ0EhseqTd0zZzAbCzKH8T7Eb+fdWHCnv18u1oJBHUaOGbujY1XUqlu1fq2B2NQ==","signatures":[{"sig":"MEUCIAsGcnNkh6hp2lfFj4sWym6/uoVfOfVQAU7GhPxTvVBlAiEAl14jGR5g5LTOgTSXMHWQNpiPNEcOIoSDz0rVkr+7urI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2641288},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","gitHead":"38039ebbecb55654ae45e674539f0216af6d3487","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.6.7","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.17.1","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.6.0_1703222832846_0.30953740754848624","host":"s3://npm-registry-packages"}},"0.7.0-alpha.1":{"name":"@last9/openapm","version":"0.7.0-alpha.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.7.0-alpha.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"77e0af79a9a7a65c4b57663f300e9b5dedf62398","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.7.0-alpha.1.tgz","fileCount":26,"integrity":"sha512-4Ot8UJcz0TDLaz4kY4leTdEQAXOFeFsqmz8aDWkJYndzF/ZfzauQFO8DeBQlf/f/BLMGPsjJUz3hiwRuOPmwGQ==","signatures":[{"sig":"MEYCIQC9KQtjzZnNEEpgCOG6tTacOoZifFX0mjVuJl2daaVkiQIhAOYqva3x9QZ+kG23cu1apVfWI5GheRyO/3sR2wreT6Yb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2646278},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Postgres](#postgres)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, that uses [mysql2](https://www.npmjs.com/package/mysql2).\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Postgres\n\nThis currently supports instrumentation for all Node.js ORMs, that uses [pg](https://www.npmjs.com/package/pg).\n\n```js\nopenapm.instrument('postgres');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"47670be6059ea3e84a261d059e863ec0ee9936e1","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.6.7","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.17.1","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"pg":"^8.11.3","tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","@types/pg":"^8.10.9","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"pg":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.7.0-alpha.1_1703229165980_0.7241973548877529","host":"s3://npm-registry-packages"}},"0.6.1-beta.1":{"name":"@last9/openapm","version":"0.6.1-beta.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.6.1-beta.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"85f87153b8c51240b3ef765ccca3502dceeef8a6","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.6.1-beta.1.tgz","fileCount":26,"integrity":"sha512-VTfcZjL7mh0Ntuf0bjER2Vt3Z3X+rgZl6HEcaPM/rKI6o1H1x9BrjkqsR8eo6J7esEmlRiBkYYANxapeMXt7bA==","signatures":[{"sig":"MEUCIQCoVzmMgbGrFaBSxVFlI2HJTkAYVAfQplOIyC5C9eCXOAIgGeJQ3uuY8wkA37Fip758g+aTwYBKK2MR5JFQQqoxNBg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2641647},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express)\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"fa14ac11a333117531d93daf431de40ca0dc5c23","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.6.7","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.17.1","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.6.1-beta.1_1703592408614_0.5964029172309664","host":"s3://npm-registry-packages"}},"0.6.1":{"name":"@last9/openapm","version":"0.6.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.6.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"b1af4b590bf030b9096590a968c55a33ed9d8253","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.6.1.tgz","fileCount":26,"integrity":"sha512-Lc7uYu5s4K/KRlEwz7RwY2rnWaC5zW4lbTbjt7hpbhCDthM1EBoiBK3B6YbgygOuLU254/g0iy6iwdJXfn5qSQ==","signatures":[{"sig":"MEUCIQCUQN3ZJNWhXshHZH8G9/EerdDoZRq/hAuJxiO7bdlPdAIgEVQ01tMOznNQdHPS+M/p25LbeIrMOYTBEZ0pt4AhBSU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2642339},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","gitHead":"7d3e203b7ca9c4912bc230f92d376a15eb9008f0","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.6.7","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.17.1","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.6.1_1703602660666_0.9273814396620006","host":"s3://npm-registry-packages"}},"0.7.0-alpha.2":{"name":"@last9/openapm","version":"0.7.0-alpha.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.7.0-alpha.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"05f0325f29fa2f2412dcdafd4569bb6650258790","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.7.0-alpha.2.tgz","fileCount":26,"integrity":"sha512-NePTjlt9T65OkUZSRkjYwEzNwlM1U0F7wxHO8hCSuRfmM9JrK+AVif1dP1zSvxxnfDDW9JYkJErsdcasaguQCg==","signatures":[{"sig":"MEQCIE4c1DU53VaJUWy8Sp1Qq+RGVGd/B6ouLobmKTPmh4PbAiAwpch7byzRCSmuETbX7FU6CfdDCcJ6531e74h4pzHNyg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2642543},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"3912d62e448fe5195c10aa2ffbb038e96d3fcc23","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.7.0-alpha.2_1709890294199_0.29939461224293384","host":"s3://npm-registry-packages"}},"0.8.0-alpha.1":{"name":"@last9/openapm","version":"0.8.0-alpha.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-alpha.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"be662e6822f8e78725e79f63d4b60734c115749b","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-alpha.1.tgz","fileCount":26,"integrity":"sha512-zRIZfn3nR7aOCgXs6tMWxJfMsBjsnNtadhpmwhomtcpvLyhjwwDuzX2rM3uCHRQSNNofGVZ2jpnYCw2kF42Vjg==","signatures":[{"sig":"MEYCIQCnJaOj1LZnjGW1wYg6RECHTftRBg+860g1bYwJ6zOLaQIhAM4h+8E6Qw40L0WnyB1AU0SnigfD+ZTTYBs5wpQ73r41","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2805939},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express')\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"73c62d0f5c3429d46250e70713c5f34df7f06708","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"uuid":"^9.0.1","chalk":"^4.1.2","undici":"^5.27.2","protobufjs":"^7.2.6","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@opentelemetry/api":"^1.8.0","@opentelemetry/core":"^1.22.0","@opentelemetry/resources":"^1.22.0","@opentelemetry/sdk-metrics":"^1.22.0","@opentelemetry/semantic-conventions":"^1.22.0","@opentelemetry/exporter-metrics-otlp-proto":"^0.49.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-alpha.1_1711441392960_0.22042564360082517","host":"s3://npm-registry-packages"}},"0.8.0-alpha.2":{"name":"@last9/openapm","version":"0.8.0-alpha.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-alpha.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"9240d3fd8c1004e79626885c75fcb9abd73535e1","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-alpha.2.tgz","fileCount":54,"integrity":"sha512-nS4T8v7OBZp+oJ0NereeXGX+8y8Sf+69eypo75P52tk95SEtkyElTQnfRIjBYAfqN/QTpovSoixUZxHDrqUfWw==","signatures":[{"sig":"MEYCIQDTwBqqIE3XmYESbRkwElSWU5giEKGEsT7mIp8Ob96YcgIhAKPR5WAjbSvdefJyrAemjTKNQtzAMUKc9ieeNxbUtzpi","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2839718},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express')\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"d3317079764b56a6b2d61f3975cf043fcb60863a","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.5.1","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.16.1","dependencies":{"uuid":"^9.0.1","chalk":"^4.1.2","undici":"^5.27.2","protobufjs":"^7.2.6","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@opentelemetry/api":"^1.8.0","@opentelemetry/core":"^1.22.0","@opentelemetry/resources":"^1.22.0","@opentelemetry/sdk-metrics":"^1.22.0","@opentelemetry/semantic-conventions":"^1.22.0","@opentelemetry/exporter-metrics-otlp-proto":"^0.49.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-alpha.2_1711707153836_0.887308285549939","host":"s3://npm-registry-packages"}},"0.7.0":{"name":"@last9/openapm","version":"0.7.0","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.7.0","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"9f6749945587e47bd18f5ffe2f0c3e7b203e764a","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.7.0.tgz","fileCount":54,"integrity":"sha512-qQfQiFn0G6WT9aHwMjOk6xrlY1d6zRTzYiad6WhHNM5zEzYUu9tR2RbZcFCPpYO2S6XiPHcxE9Ej3MldXZRGEA==","signatures":[{"sig":"MEYCIQC0bUWNHXh3YxOBE4cupK3wfSj7PrelJ9ZM3fMqORQ4vwIhALAM3b+hT5ZXEh/men3VoU/xexq3oVWy1mnn0Eile+mp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2828737},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","gitHead":"6f001568e4bde0e0712ee262f689cfcc41ad15be","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.5.1","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.16.1","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.7.0_1711960546679_0.7957281761107124","host":"s3://npm-registry-packages"}},"0.8.0-alpha.3":{"name":"@last9/openapm","version":"0.8.0-alpha.3","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-alpha.3","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"f323623c99a2a55d08e00700354d1fdc3b7f56b2","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-alpha.3.tgz","fileCount":26,"integrity":"sha512-7VsiRg1P44S1xMvx0cwwNi+C1SR9/C7v7+JQkTaUOrUs7TuYX1n8IHsZYC8QetjmICmj/ZwiuzDg2760TIIJmg==","signatures":[{"sig":"MEUCIQDVQaTIbrdaCucMKFUYsBT6rKXZM5IBnQREcwCx5RHbcAIgdx1FmCfS5v1C6IuNjeKvDAzpRJiUvqY2OtdQkRKxOig=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2655583},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express')\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"12b39b34ce4582383cb2ed2ab558d51778d430c5","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"uuid":"^9.0.1","chalk":"^4.1.2","undici":"^5.27.2","protobufjs":"^7.2.6","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@opentelemetry/api":"^1.8.0","@opentelemetry/core":"^1.22.0","@opentelemetry/resources":"^1.22.0","@opentelemetry/sdk-metrics":"^1.22.0","@opentelemetry/semantic-conventions":"^1.22.0","@opentelemetry/exporter-metrics-otlp-proto":"^0.49.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-alpha.3_1711962950411_0.7301444727159638","host":"s3://npm-registry-packages"}},"0.8.0-alpha.4":{"name":"@last9/openapm","version":"0.8.0-alpha.4","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-alpha.4","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"a310f77503591a318deedf7804d846b86cca9b11","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-alpha.4.tgz","fileCount":26,"integrity":"sha512-QFvRNTz7ltp27r9t/uPwR0/lXD2oFb2Y+Mt7npe52SF0pZTodeOkX48N+fOG6reazmkbGSQDlZJ8gNwAIvZq1w==","signatures":[{"sig":"MEUCIF/1xcoNPmT0WTZtXD32l8US8F9L4n7bOH91QGn1PvVUAiEAlaEBIBgE1JdDP1cci+ZdCFCgiC2JMVworB0dF3jm8zw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2655731},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst express = require('express')\nconst { OpenAPM } = require('@last9/openapm')\n\nconst app = express();\nconst openapm = new OpenAPM();\n\napp.use(openapm.REDMiddleware);\n\n// ...\n\napp.listen(3000)\n\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"c827ece418dbfb3caf6d993295210df9f2a8394a","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"uuid":"^9.0.1","chalk":"^4.1.2","undici":"^5.27.2","protobufjs":"^7.2.6","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@opentelemetry/api":"^1.8.0","@opentelemetry/core":"^1.22.0","@opentelemetry/resources":"^1.22.0","@opentelemetry/sdk-metrics":"^1.22.0","@opentelemetry/semantic-conventions":"^1.22.0","@opentelemetry/exporter-metrics-otlp-proto":"^0.49.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-alpha.4_1711965259294_0.25526440527423677","host":"s3://npm-registry-packages"}},"0.8.0-alpha.5":{"name":"@last9/openapm","version":"0.8.0-alpha.5","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-alpha.5","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"61c765090d5000a70911bc37f97ec72340bfbe7f","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-alpha.5.tgz","fileCount":26,"integrity":"sha512-Vc2e7/nU8i4tx8yZDXk4XhnPdTJtI2GPaY9ZsZiMUnT6KUnfDG63ZNvARqRdvCfnYQLadCWXVPwWAZirzHurJw==","signatures":[{"sig":"MEYCIQDxr2ECocYQRxjlM3XLe3xSnT4ONQS04YlyTvLNWgXNSgIhAOZIViB+gLaVFwy2X929GkoYeIz489Sm55sf5uh43rMn","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2655832},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"66327e70f6d06518b33383588b5c6c1426dce2d1","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"uuid":"^9.0.1","chalk":"^4.1.2","undici":"^5.27.2","protobufjs":"^7.2.6","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@opentelemetry/api":"^1.8.0","@opentelemetry/core":"^1.22.0","@opentelemetry/resources":"^1.22.0","@opentelemetry/sdk-metrics":"^1.22.0","@opentelemetry/semantic-conventions":"^1.22.0","@opentelemetry/exporter-metrics-otlp-proto":"^0.49.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-alpha.5_1711966812707_0.79316045345281","host":"s3://npm-registry-packages"}},"0.8.0-alpha.6":{"name":"@last9/openapm","version":"0.8.0-alpha.6","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-alpha.6","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"137a96e994508338ffe002d023cef2f4d7a6a1ee","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-alpha.6.tgz","fileCount":26,"integrity":"sha512-0xnHJ9nz0ydnqTuCx5AOpnMM4EFxO4oZFwt0cYUHgtnviaHeSaZkcMhJlJM3ZBKubfxve9hG+h9SlyTQ8vJ32Q==","signatures":[{"sig":"MEUCIQDr8OojImufof2C4Z8ZyoYmXp3J0prtN+UcTVAQRzYLgwIgLGBtG1yNSu+pJh/gj3upcWqdq0Iw6fm4rF8Qn5cryZo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2656928},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"323c54703736dc8b000ad7df24093a1d45ac09bc","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"uuid":"^9.0.1","chalk":"^4.1.2","undici":"^5.27.2","protobufjs":"^7.2.6","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@opentelemetry/api":"^1.8.0","@opentelemetry/core":"^1.22.0","@opentelemetry/resources":"^1.22.0","@opentelemetry/sdk-metrics":"^1.22.0","@opentelemetry/semantic-conventions":"^1.22.0","@opentelemetry/exporter-metrics-otlp-proto":"^0.49.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-alpha.6_1711968210598_0.5726548183887161","host":"s3://npm-registry-packages"}},"0.8.0-alpha.7":{"name":"@last9/openapm","version":"0.8.0-alpha.7","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-alpha.7","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"1f1409df89b35141eb16f9a758c76e8fa88df93e","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-alpha.7.tgz","fileCount":26,"integrity":"sha512-oaEIOreiNqNjladgh6xQ0MWw48VqSVa5Zu8txeDjfDbKy64c44VICMoTGlnoJVPEx3B7BvTmambAToUhLJzv0Q==","signatures":[{"sig":"MEYCIQDz6YxojiMweKWfRdveeS/WuFXoveEPjlDkTXuhD0jRYAIhAMMoJatAZ5OEIQJrpNCveZAmCIudUTypWQbV0+oHll2o","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2658020},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"a3cdf391e065d3f6b0d4feda9358c1454911e9bd","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"uuid":"^9.0.1","chalk":"^4.1.2","undici":"^5.27.2","protobufjs":"^7.2.6","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@opentelemetry/api":"^1.8.0","@opentelemetry/core":"^1.22.0","@opentelemetry/resources":"^1.22.0","@opentelemetry/sdk-metrics":"^1.22.0","@opentelemetry/semantic-conventions":"^1.22.0","@opentelemetry/exporter-metrics-otlp-proto":"^0.49.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-alpha.7_1712735531143_0.27487538974428793","host":"s3://npm-registry-packages"}},"0.8.0-beta.1":{"name":"@last9/openapm","version":"0.8.0-beta.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"ce27a884f9dbbf26e2d00d3098c6800a3ecd0572","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.1.tgz","fileCount":26,"integrity":"sha512-wLSiR4yuGrblhGVS44VDwPV58PKbo6putuhQxlgcgmm2bwpszOGZxj8KFR0ib+Wq9UqIDX3fefQ8SOZ8iqWA/g==","signatures":[{"sig":"MEUCIA4V1t/Le3M8Q07KWJL8zboKF4xJ/XXsH2ISrjT1K0izAiEAnnybtpvdHAagWFSFBYxIHOUE8xyR0rXN4Nv7l4KmjlQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2644537},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"6d15c0de7d0c815e661ad7de26a2b1464af1da4d","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.1_1712947287012_0.16407021948735112","host":"s3://npm-registry-packages"}},"0.8.0-beta.2":{"name":"@last9/openapm","version":"0.8.0-beta.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"63cfe73856765fa4314cb1d268db4683ff62a43a","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.2.tgz","fileCount":26,"integrity":"sha512-ZA2U3P6vBErlea5VgVCfBiIN3BPaT/iAuRuVjNlrlGanPT8Fe7hfjr06tEoAh/NNDRpnZ3a3yp1iu/iTtKDW4A==","signatures":[{"sig":"MEUCIQD6aH2j1EUpylsNZ+CDwVEQ3yX/Gcyn3hxchMgP8pFurAIgcsnZTxXOlhNIM3Lmw9WtFr2xA1SXtv0pN9rn06NBT8o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2645197},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"063dfd4470ff8f23714eb0b213d4841f35ca933a","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.2_1712953373653_0.9647591115408687","host":"s3://npm-registry-packages"}},"0.8.0-beta.3":{"name":"@last9/openapm","version":"0.8.0-beta.3","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.3","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"662087430bf8f38ad60ecea3b6bc6513fb66a87a","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.3.tgz","fileCount":26,"integrity":"sha512-xgVTTqjU89bNzNOqdE/x2lJw/olmoLKAxfjA/DQiim/XFJXC09b8DH120dRjPyP1WISjmesjF1U0s8kSDIv9Aw==","signatures":[{"sig":"MEUCIQCxktkizOJJKjLvE05K83EXpDd5VSkbCmo4zpSXGoKeFAIgeBBTS0OyS7qybc+CRvpBmiq9BCuHAiPV7Xt14fy8YjE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2645497},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"97c7a6a0bd6f6ec892a98ae85ce25288cdaba991","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.3_1712953680509_0.619966891520056","host":"s3://npm-registry-packages"}},"0.8.0-beta.4":{"name":"@last9/openapm","version":"0.8.0-beta.4","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.4","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"ed197e06790c7d3f8dcf2e460ab59113398e9d76","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.4.tgz","fileCount":26,"integrity":"sha512-J0J3nd8mI/+SOrdBm+RWDG2aGW6NBFFHlgXxhRkwVf0dNfndXFM0GAYv++v6FupYxR9jr1qduXqv134W8ti1EA==","signatures":[{"sig":"MEUCIQD7jHqokbuo0IIsNErN/B6enOpotLMi0e/q6WMUw24gRgIgMSSFeNqEqGEGGALydpzBsnB3v6mHjXrbqtZbu3VXN2s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2645580},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"bc1fc61098b1bbb2af64df0289997c5e541b566e","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.4_1712954019930_0.7826563928016681","host":"s3://npm-registry-packages"}},"0.8.0-beta.5":{"name":"@last9/openapm","version":"0.8.0-beta.5","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.5","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"caa9816629c2733b8af5973c5a7d8f1b33adb51d","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.5.tgz","fileCount":26,"integrity":"sha512-0X095zHxH1p4zeTUaj55vowAtvrLubAy/CySf2ZwaSe0diVoIvhmZmv1GEKmZdm/kBNZp75Ytd4QChb37mk+Kw==","signatures":[{"sig":"MEQCIBg4clg3KdpkDxb6tfb2eB3IjFAGdQaF0qQlKwjpt/vIAiADfvV15EKJp1lS7UNzFG7ZjhrdJdZCdnQBc1lOpuzVTQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2645688},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"7679fa223531d6df22c0408b395a0e02cf01c9e4","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.5_1712954403333_0.5220115572664152","host":"s3://npm-registry-packages"}},"0.8.0-beta.6":{"name":"@last9/openapm","version":"0.8.0-beta.6","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.6","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"3e1e0d4e1f76a89f51f7234cd8f2c502f3d76da6","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.6.tgz","fileCount":26,"integrity":"sha512-jXH+PQNG+vfQ1whQATYcgS4Hz4fh2mWZ7uHzLK1zeLNIOXIZU96MBmwa9GqeMcyZeHbXC/gjDyRk6emIlVhfFg==","signatures":[{"sig":"MEUCIQCEEwdStdsipl1AEaVT6VHdg/VuiQBn6Gz3hBB5NhytdAIgWIGAVO6VvvGyQf4jKedb506xNXU9f+C6I+UfXG0fppM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2646368},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"e3097a8f8f7c888c2a7acafb35b0ddced4c2ed4d","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsup":"^7.2.0","axios":"^1.4.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.6_1712955449592_0.9759813073058772","host":"s3://npm-registry-packages"}},"0.8.0-beta.7":{"name":"@last9/openapm","version":"0.8.0-beta.7","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.7","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"0f84fffbca41544c257ffbb2f847c501a245a9fa","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.7.tgz","fileCount":26,"integrity":"sha512-mng46XdzL175grNrSZh5CkCqi7WRZ7BE0sD++izJwjvJFAtl/bkWgjxr2ahvNvTsbkIS/VYkcN3j/L1qQCr0sw==","signatures":[{"sig":"MEQCICHSjCVOA3cIHQfmHu/LAk2jpvN4OHDr9ww1Cs1GsCsZAiAhhF+8l15fCCwbjTuiwN3IGb4nhelVyH5ACvp3NWdWug==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2738615},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","exports":{"nextjs":{"import":"./dist/esm/clients/nextjs/index.js","require":"./dist/clients/nextjs/index.js"}},"gitHead":"860e8c1dde096c86e35052d56fe7724cd06d2dd3","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.7_1713427060666_0.7073909100543114","host":"s3://npm-registry-packages"}},"0.8.0-beta.8":{"name":"@last9/openapm","version":"0.8.0-beta.8","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.8","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"2cf5d7943a1e432970b58ee6cc9b496f97430491","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.8.tgz","fileCount":26,"integrity":"sha512-2sIShXe+TxF6/UNuBDdo051B2I4QbVMMhWemuI2GDergb/xL1SOvXWdvTwZkFJQFAfeL1l1O/d4Gh3ox+VkSRA==","signatures":[{"sig":"MEUCIQDdH0cqU5P9tYs8RjqiSLHZFUPSMYkozsDRwjf7Pg8SdQIgNNuAj/07teEN7L3tD815l+KqFZsu7il2IblcoB6MlIE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2670050},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","exports":{"nextjs":{"import":"./dist/esm/clients/nextjs/index.js","require":"./dist/clients/nextjs/index.js"}},"gitHead":"a6612d469bdd5faf672c4e212ec6a9fcc71d96e6","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.8_1713427314855_0.825758257158695","host":"s3://npm-registry-packages"}},"0.8.0-beta.9":{"name":"@last9/openapm","version":"0.8.0-beta.9","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.9","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"30133da97d4886b86323c063ade44397d76aebf1","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.9.tgz","fileCount":26,"integrity":"sha512-omzI5CznSH0KzkPpqVjIQX8Mzp6Gt8RDBKuIBRDxpm+ySd1ByepqGqnUgzfK4Wl5O1G1ikfL9jYkgd3d8cOgbQ==","signatures":[{"sig":"MEUCIGRK9fZCGcl6Ht/7uE4F5EXVR9iybYwtEgyh6LxVPxS6AiEA4RoZnbJJpYjd0mkQV5tZwBwxUARl4zO7n/SSXQbMis4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2669904},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"2c1782f8f7c4306874d9f19f958b47fd72e3d46a","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.9_1713427492614_0.14859309627400918","host":"s3://npm-registry-packages"}},"0.8.0-beta.10":{"name":"@last9/openapm","version":"0.8.0-beta.10","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.10","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"f03fd53a58c08a78b25fd66b89955f877f6de1a4","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.10.tgz","fileCount":26,"integrity":"sha512-+GiryJdmBA/TbPloz/eYMxVYKESfl2KJ6PvLL4YvtyuhAYCUQy71rxzmxsVoSRS5zvxmJZox8jz6nlMckfek8g==","signatures":[{"sig":"MEYCIQD8G7nS+vqGgjL+ofkxIbk6CM9RjgoyqXr6RpLemKhlogIhAI6O8T6yMAn7ajTggggmEAJwiNgu5OmIc3KtmWrNC98y","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2669905},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"80b5abb9d4094b1077d37ea16fded97cbe56c238","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.10_1713427773337_0.8866217419759761","host":"s3://npm-registry-packages"}},"0.8.0-beta.11":{"name":"@last9/openapm","version":"0.8.0-beta.11","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.11","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"cd5e6176942936686835a480d91332d7162be9b9","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.11.tgz","fileCount":26,"integrity":"sha512-LdSq3Sn9H7OeWTWgRnVoXuDcVWRC+Wit/32FaEZSHckrxzgD6vnWy8NQt5ha6z9k6M4nAuk/s8XYP9ZZE06MwQ==","signatures":[{"sig":"MEYCIQCYk651DfsaWYgcwpWUZ11WN2B6akX4RbIHunIdAfFWLgIhAPv6MQWdp1DbT9D8f0UoXx24T4Hm6YyDCsnC+fC4Od/l","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2672175},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"3baf7f75157665b8dc93c7c87fbd696cc306197d","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.11_1713634511987_0.019667961950959212","host":"s3://npm-registry-packages"}},"0.8.0-beta.12":{"name":"@last9/openapm","version":"0.8.0-beta.12","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.12","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"8452be5d3353b09ff7f30fd5358e9d601e4fcec7","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.12.tgz","fileCount":26,"integrity":"sha512-nU5Hu4FDU1Fuc6F9wbvgFCdgoJJYIgMmmyAym+UjpLiCp3KUp5d4sOYbBd/NxWDEZYZwTUTntnMEic6zTtjnZw==","signatures":[{"sig":"MEUCIGO09M1/lqEWePd0omohG+l6hVhR9EspBHJXbVJ/Bv1SAiEAj4ZmOQwezAzuE3D95067ID8AA2n2JVKly9xF84ZBaCo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2671567},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"07e929142db98557063c749935a0159bfe1781c4","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.12_1713759967044_0.20430024178613526","host":"s3://npm-registry-packages"}},"0.8.0-beta.13":{"name":"@last9/openapm","version":"0.8.0-beta.13","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.13","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"05d9bba46443c47f2568df63701b6a0440f108cf","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.13.tgz","fileCount":26,"integrity":"sha512-TA3+CJJ5L5dFhErJgqBhHYOPbhLVdbsQ3DcTCzMmv3pQ7sRpAJiQ6WDHSuEopHRl9eCCTh49QES6odHaoTVOVQ==","signatures":[{"sig":"MEQCIA7aUd+HP+pOg6HL2mdOkVvHQhFaA8H7NarAQx7cSp3UAiBLvwF7VP+0hl+3EtIbXIBbcuCkqkYmwXA4Fho6Hd8WxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2673349},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"88dfafe91507eb0e71a6ab81349b9ce356352b48","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.13_1713770597998_0.612390513566583","host":"s3://npm-registry-packages"}},"0.8.0-beta.14":{"name":"@last9/openapm","version":"0.8.0-beta.14","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.14","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"e87381c049020c54a923e53b63b2848ae68d2cc8","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.14.tgz","fileCount":26,"integrity":"sha512-hi8tcFU9ZFWrHiSKx8eooW+kCVN3vcvGDzkIc3EiDWWGmwk1v+R1Q1v3Nnjthn7AxxblsBMUTl8syf4+TLaF5g==","signatures":[{"sig":"MEUCIQCek517EwUuTyseHCF32ekIK7Se3CqEpoZ6/DwY6TIp+wIgVXE7RK9ruSI2GWbTWkn9arHaqwXKVxomQGinDLGLE3k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2670759},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"61a99420b9cbb233d2d8e834e9ef2bdf64898871","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.14_1713772698037_0.06445406569136325","host":"s3://npm-registry-packages"}},"0.8.0-beta.15":{"name":"@last9/openapm","version":"0.8.0-beta.15","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0-beta.15","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"565a71f1e31b91dd733509bccbf979ce4d8c9c2b","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0-beta.15.tgz","fileCount":26,"integrity":"sha512-j3Q2P7Yxc74EeTF8mjxBzGDUbs3vlXly6axhwDmXgG9/YTWRlW4MeGpMlHiLE57wsjNCHkrpZ1KfSWFyUqBbeA==","signatures":[{"sig":"MEQCICSAZZExgRVMX6B4r/HLUPNiFnM9mhBZlhN9O4Mdj8iLAiBS7G0gNdakwK1IMSuQoBMwEI/0d6ZPMi7GVvj1rmw0BQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2671291},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [Setup Locally](#setup-locally)\n5. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"81a13daa7d39f896aa9f6047ab541b51e0ffce5f","private":false,"scripts":{"test":"vitest","build":"tsup","test:ui":"vitest --ui","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0-beta.15_1713778431752_0.4757401658235154","host":"s3://npm-registry-packages"}},"0.8.0":{"name":"@last9/openapm","version":"0.8.0","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.8.0","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"55dc09dbfd2e3bf4fcba36b3c243ca12b6a4bbd0","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.8.0.tgz","fileCount":27,"integrity":"sha512-yU3AbPu82u2UF3DDuHzYlgQKDgXBNKSRi6ekmTj7w3ed9/0gcZVAxZXgla8CDdZ6D/0u24QRqC7/xSB/+h1MZw==","signatures":[{"sig":"MEYCIQDCCtQn+jjdg4qMvUwJEn+48lLcYOlHnplLTNAm5aYisQIhALV70YiQIcyLMGNaHfc86p2kv4E0SXU9pbmRgF6W5kzb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2677896},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","gitHead":"f603e0621b59926c746a3cac9673cd2a756ed1d4","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.8.0_1714128038120_0.5833809736665587","host":"s3://npm-registry-packages"}},"0.9.0-alpha.1":{"name":"@last9/openapm","version":"0.9.0-alpha.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.0-alpha.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"93403ae3ee681727ba296066bcaccc29903bd019","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.0-alpha.1.tgz","fileCount":28,"integrity":"sha512-RSU8qMe0kWarbKdjccUmjSvgDwMeOUdWOAeRS0AaNnxsWkfmAhElrJQvuToRWlj/2rZIurubVuwQ6i8/70GqxA==","signatures":[{"sig":"MEYCIQDC9+0KR82GjRHC/6feW8Q6UaAfvnXMpc7ptv8DcpTX2wIhAK29H0fJ2Bm2to57oVM0/pEAG8xuPIUfByUTlR5n2MWj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2794833},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"ccfd2cdc97bfca074d6f827523e2ca5702a8651e","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.0-alpha.1_1714973873733_0.8295350939195423","host":"s3://npm-registry-packages"}},"0.9.0-alpha.2":{"name":"@last9/openapm","version":"0.9.0-alpha.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.0-alpha.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"12a0bfffcbc144f558cdeb36d2d347b8ffca3f5a","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.0-alpha.2.tgz","fileCount":28,"integrity":"sha512-A5ea5LhlDZvAB+opc3MnudBCYmm6Wul4d0TvSgB7dOHUlbrrC/4UOuXL9rwZvxLVa6SP7I09XViVcdSSkDUGpg==","signatures":[{"sig":"MEUCIQD734w/RsO7Dea4m4qo0l80CGOwtYOkt2rFiTYHae7kkQIgPHMV/7xPfPQJf3ELETc0UAjTFm+E/ffFIfszlgANrZk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2789259},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"3b44ee52b20426f68cb2106a1e81e0e089db8e2f","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.0-alpha.2_1715250210376_0.6739786278170954","host":"s3://npm-registry-packages"}},"0.9.0-alpha.3":{"name":"@last9/openapm","version":"0.9.0-alpha.3","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.0-alpha.3","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"cede25778b7127caf70c773cc3ecf9c5f5a4b65c","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.0-alpha.3.tgz","fileCount":28,"integrity":"sha512-40ICiA02iYPsyGipwLyFp+Qex7FcOAQXp/zr7eTH3agXO5KnkAZqfSnxzpDA2nXNUG1hWY5ieJ842kLS+TcSsw==","signatures":[{"sig":"MEYCIQDWbynVM5PDKsU9dtet9g0BszUaEt90aEN5bZYBS8yKhAIhAKpdGLE4AZl2E6chW7xAzg/k72WoRRgJ2+jlJhe7sT8m","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2790605},"main":"dist/index.js","types":"./dist/index.d.ts","module":"dist/esm/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"8401f709304a8e863eb73a4fa7d33e1a86677c25","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.0-alpha.3_1715406399143_0.45187670821452475","host":"s3://npm-registry-packages"}},"0.9.0-alpha.4":{"name":"@last9/openapm","version":"0.9.0-alpha.4","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.0-alpha.4","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"db929f449b26ca0130e563aec51b8428f439c4ab","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.0-alpha.4.tgz","fileCount":59,"integrity":"sha512-UgwWXx4eU8qFCRwJxKO6Tr9xHRPRQRiFsvd/BukI4maEKNQt7KPmhneEl0mfjIiVuCjBRA8KLNMeC/IKkCFKMg==","signatures":[{"sig":"MEQCIGti2HzNl3awspOYMN4U5FNDp/GmP0IFktsPmf1IOwYBAiAwDRgY9EoO4sP2qd+1KhsOXESVXf+0sn+WvtWNoyJ0fg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2746699},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"f459f85326f94d0a29e63557f6818b4e9e8fa369","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.0-alpha.4_1715409073534_0.5461889483987197","host":"s3://npm-registry-packages"}},"0.9.0-alpha.5":{"name":"@last9/openapm","version":"0.9.0-alpha.5","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.0-alpha.5","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"0c369784ea3836d2c8a902ee1a7d843805e94db4","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.0-alpha.5.tgz","fileCount":60,"integrity":"sha512-7RQWdpuq+/V0B1XvJuHk9cVtX1R1Xcv2CY98JLqAL32ELhY7hkvq2y+MOlrVFgSpBbTH9fs5X2Br+nPIgwHLjw==","signatures":[{"sig":"MEQCIC0XsUABepVGvQ/Aqg9S7mcRGQ0g9zbndZ96vKOKQrTmAiB86aL6OLC/ao7OZ90/l+qZyQZQs7vMlLk9TcKQKZcgyA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2642207},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"5a40cad6319f2f6c9fd07ce73083db0c5a6ad703","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.0-alpha.5_1715410874961_0.5529767751308148","host":"s3://npm-registry-packages"}},"0.9.0-alpha.6":{"name":"@last9/openapm","version":"0.9.0-alpha.6","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.0-alpha.6","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"cc33cb4ce7dc55983c12ec3e7d6beffad7100181","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.0-alpha.6.tgz","fileCount":58,"integrity":"sha512-DDadtd3TRhAmbkN2MgaKC4Tm84QHN404jU0pdCxA1vOudnKQ1OVk8ABC/9tMGrA1F5HWAVOoOzOQ1RxZUQjUSg==","signatures":[{"sig":"MEUCIAzH3iCfXZ63yqU7H0DN6Y76sq1tffDiI1rZG80SIOtFAiEAuuWYJV6pmpnrDkoQNtNKqDWMgtuGvR8ELYxjva5lwF8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2620559},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"abe96f94c31f182569e362366ad74a46609d7fcb","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.0-alpha.6_1715413517287_0.8585369331461092","host":"s3://npm-registry-packages"}},"0.9.0":{"name":"@last9/openapm","version":"0.9.0","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.0","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"8c3aad7f920f2fb628a1778d0a8e1906694ebc36","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.0.tgz","fileCount":58,"integrity":"sha512-0mPqJor3HeKqfe8dVXvCYblZXuLyDxKZkT1w1pkAGox0vjEz78uZ8pdQks233Fi8jGL8jbHOg7UdlMCfdZIZbw==","signatures":[{"sig":"MEUCIQCteWluX058f0CEr540FzD1m5zJQCntCR3EVG645EsEDgIgXciFvJuI54FHP/h8NzCDoGQdbXhvuhf9wsn/bXYngOc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2620564},"main":"dist/src/index.js","module":"dist/esm/src/index.js","gitHead":"9d2e28e4829c98cd475f0e3a1ef717e4b7004685","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.0_1715666913542_0.9239575202072483","host":"s3://npm-registry-packages"}},"0.9.1-alpha.1":{"name":"@last9/openapm","version":"0.9.1-alpha.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.1-alpha.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"5f5c0b906b137f29499312433176adbe0746fa4d","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.1-alpha.1.tgz","fileCount":58,"integrity":"sha512-LBoXViy6aeIJSdQe8AzQpBZ2gLKwT2FakPuKe7LH79dnkUln7Ph2s8/bwPXUmejTdndjIWEb6hW4Mz406Up8zQ==","signatures":[{"sig":"MEYCIQD0UVSf5YAlDb7r0x7nB9iKcXLiQ9EmTHod1JfzlVYWtwIhALaQZvXoBKYN/z2o3m3EcqlzMHEAgFrn5pW6l35tQTUb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2622063},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"5b8a58bc0cec63131886b8dd6c3abb7c371f9cc7","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.1-alpha.1_1715764340929_0.7225375027356897","host":"s3://npm-registry-packages"}},"0.9.1-alpha.2":{"name":"@last9/openapm","version":"0.9.1-alpha.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.1-alpha.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"5629fe87dc6ca75897efab157d34ab11a6afc0ad","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.1-alpha.2.tgz","fileCount":58,"integrity":"sha512-yGVchnoRMH+ZLHzsjNYyYKym99H+6k3GeYEIeQDtPzG4mq3cVeh9/9Hj99v2EP0M5+Y8seN9ZIhQrlvnBWKRTw==","signatures":[{"sig":"MEQCIHbmVEbJ54AoRqQ2ZzFDWWX/ubafZWM4lTvdoYEbDu+5AiASQfF9BOE5Y2mikZaiZE5A1Qv4a5oB7K0az2ErMRr4qw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2622110},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"3ae0ff08d58b675b668c6bbb9f9c5d67d7012cca","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.1-alpha.2_1715765777156_0.46841499686096655","host":"s3://npm-registry-packages"}},"0.9.1-alpha.3":{"name":"@last9/openapm","version":"0.9.1-alpha.3","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.1-alpha.3","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"bbea5d3e7d771d23aa80de352abfbf936c139cf0","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.1-alpha.3.tgz","fileCount":58,"integrity":"sha512-DDiAC+vWJOcd5kS/LYVTYxjjs/YVxqxGfUWbZ4H/ZtdkBgAIzJaKb4uYS3PfZ4XU6VTFRFknnEF/nxEXI6wrxA==","signatures":[{"sig":"MEUCIQDODg+rYvthmnX34yEDn9DjnTjhd5ruGAwcQdF6SV/SXwIgNGOzM8gFKsIXeyfP4kUr2zRAvHPczxSa7McqrqjqAwQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2615389},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"47c238d92ecee7d0eb5b241b1563174808161168","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.1-alpha.3_1715855131037_0.8162431103154943","host":"s3://npm-registry-packages"}},"0.9.1-beta.4":{"name":"@last9/openapm","version":"0.9.1-beta.4","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.1-beta.4","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"23caea13b54846c3af9f113f21c4c397801db027","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.1-beta.4.tgz","fileCount":58,"integrity":"sha512-4qSsRy23cCjsSrKMYO3VAvDhEu/eYeaWjIB+/K1Pd1aGvkwRObmicYgv7K6qwSuvIeN7zxxd+AXAPGyB3p7rHg==","signatures":[{"sig":"MEUCIQDD7k0TcBsTArXmGhsU6G4onCmqWUU20Yuw9hNHv7byiAIgFUv+0gIUQwljQUq2J9ohDJOKVjaLtXAdVqUNz8efazc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2615793},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"019bccc3557a6de1bcd69f65a3d2be879df431f4","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","playwright":"^1.44.0","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.1-beta.4_1715866154828_0.584647860566619","host":"s3://npm-registry-packages"}},"0.9.1":{"name":"@last9/openapm","version":"0.9.1","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.1","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"c98d92bbf2da07c71e2a439f66736c6c806b7c13","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.1.tgz","fileCount":58,"integrity":"sha512-3s9QceP2xHx5/43hpnIdP1HshikpFrDcu5O2uqP6cBLTAQ1ET1aCGD+yD+OeyecFqO6UC4KS0aUXqtJ5ZXWQxw==","signatures":[{"sig":"MEUCIQDtDSg8ySMM1nFWBIAK3ufNGA3LgfOCtgmj0qoy9GZYYQIgbleVgoHpGg/jKCkYYifb5btvt6p1DrbKuWMq/L5UD7g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2615786},"main":"dist/src/index.js","module":"dist/esm/src/index.js","gitHead":"57073c951082b426868eb03ee75afe53a0990591","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","playwright":"^1.44.0","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.1_1715943853971_0.5377722974945875","host":"s3://npm-registry-packages"}},"0.9.2-alpha":{"name":"@last9/openapm","version":"0.9.2-alpha","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.2-alpha","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"26a628c81d032103a06e25d76c09154296e18f85","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.2-alpha.tgz","fileCount":98,"integrity":"sha512-+nW6ERoGZWynwC5ttBMOqawaLadovUralBByMkxAyM1v8qRpp8zmr+Y+CFIVDhrczjdew0z02J4lIpkWi0ehGg==","signatures":[{"sig":"MEYCIQDkq5VmGW1rBrdMnMFSd62PiJXKW7WSyDLqin6EDf3jZAIhAJB0vSYDyIHb4hdWwOLduvlrHXiu0bJA12BFDlSn7tn4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":35346662},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"ace0ada0ac8cd8eef09e63abc5ad1edd7a535c4a","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.5.1","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.16.1","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^15.1.2","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","playwright":"^1.44.0","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.2-alpha_1716103045129_0.035743317929470386","host":"s3://npm-registry-packages"}},"0.9.3-alpha":{"name":"@last9/openapm","version":"0.9.3-alpha","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.3-alpha","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"5d908d7d4ac8600f4ccfbc73af0b0e3cfc2f80f7","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.3-alpha.tgz","fileCount":98,"integrity":"sha512-nCCky1KPrK/1jb1I/L0gve8NYsSFToe39xzQhJOrNxwi3RP0imG8Vr0WmAabXkOSWWgOHh1FNy7KvBOXv3vcnw==","signatures":[{"sig":"MEUCIALYvMDeSuT1Eb0HMsPhaf6lNIEqz+Mu8KrTmsZdcH3tAiEAg2SrMh0UZdEXrdqYU6l15n4nRVkboy7lK+eXgLppSN0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":35346662},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"c7cc97176507b8e209951df4fdcc219a19b62d3b","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"9.5.1","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.16.1","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","playwright":"^1.44.0","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.3-alpha_1716105763302_0.7339377402833323","host":"s3://npm-registry-packages"}},"0.9.3-alpha.2":{"name":"@last9/openapm","version":"0.9.3-alpha.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.3-alpha.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"cbd3fd391efac400a93199d763a169c73bcd8276","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.3-alpha.2.tgz","fileCount":58,"integrity":"sha512-z5Zzzn4tTr/3n9W5xp9vgPa1wKkeioy8SqcPUCZIkE8EVAitRi2kbcWksjybRwm44G+8kXd7cCLEMwGpSt6K0Q==","signatures":[{"sig":"MEUCIQDSFe3abHEBbo3KI/eMbioXEqWnS+0rbtvoaa2Lh7LaOwIgXPD3ZLsCsSM8/mI3KbXy14Cj7i+qHyGWOahGLM1TJ7E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2616843},"main":"dist/src/index.js","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n5. Defining custom metrics\n\nOpenAPM exposes underlying `prom-client` via `metricClient` function.\n\n``` js\nconst {\n  metricClient\n} = require('@last9/openapm');\n\n// initialize custom metric\nconst client = metricClient();\nconst counter = new client.Counter({\n  name: 'cancelation_calls',\n  help: 'no. of times cancel operation is called'\n});\n\n// handler\napp.get('/cancel/:ids', (req, res) => {\n  counter.inc();\n  res.status(200).json({});\n});\n```\n\nFollow the [documentation of prom-client](https://github.com/siimon/prom-client?tab=readme-ov-file#custom-metrics)\nto get familiar with the DSL for defining custom metrics.\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"26f9997172df2418ee8fa3835b02b8ec0ded0c5b","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","playwright":"^1.44.0","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.3-alpha.2_1716146453869_0.6483857984559058","host":"s3://npm-registry-packages"}},"0.9.3-alpha.3":{"name":"@last9/openapm","version":"0.9.3-alpha.3","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.3-alpha.3","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"cd23650ce8c43ee84e66f636ce8ff8758d8df1be","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.3-alpha.3.tgz","fileCount":58,"integrity":"sha512-k8P1EXlhxhEo6YcgTljVT075L+07IQNrvS3asJLxIeckd9rZBKjL8P37ijAgvG6vCz+Hm/1y1Q2yse3u0j+7ng==","signatures":[{"sig":"MEQCIHZjMGHvYaA94N/uHZlO/oS+NVAvq2IcSP6NTte9iYXkAiAC4xAReQdCS1XNpicDGJ0/x25DTnbxYa704MEByWLAjA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2617047},"main":"dist/src/index.js","types":"dist/index.d.ts","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n5. Defining custom metrics\n\nOpenAPM exposes underlying `prom-client` via `getMetricClient` function.\n\n```js\nconst { getMetricClient } = require('@last9/openapm');\n\n// initialize custom metric\nconst client = getMetricClient();\nconst counter = new client.Counter({\n  name: 'cancelation_calls',\n  help: 'no. of times cancel operation is called'\n});\n\n// handler\napp.get('/cancel/:ids', (req, res) => {\n  counter.inc();\n  res.status(200).json({});\n});\n```\n\nFollow the [documentation of prom-client](https://github.com/siimon/prom-client?tab=readme-ov-file#custom-metrics)\nto get familiar with the DSL for defining custom metrics.\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"aa8546560db4f79b2fad4eea42b47496eef4e38f","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^14.2.0","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","playwright":"^1.44.0","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.3-alpha.3_1716187865993_0.7749337633396003","host":"s3://npm-registry-packages"}},"0.9.3-alpha.4":{"name":"@last9/openapm","version":"0.9.3-alpha.4","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.3-alpha.4","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"c731a9c14f16ac89468829e109bebf4a90ae860b","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.3-alpha.4.tgz","fileCount":58,"integrity":"sha512-uwh+RXTIGEAVxeqUOu5z++H8n/nZYFpAfnBv5O7yNptSN++qKRJy+/xDUqTnhYYKrx7oICYmfJNs0ZyzfWc5lA==","signatures":[{"sig":"MEUCIQCo0xWzbMFrBQJ9ogyMorePM4r5rLXrTz/vwgbVcK9wBgIgD6wbCdjT9b4uJELPofMq5hNl2xz01sdVx0k3Lc6N+MM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2617121},"main":"dist/src/index.js","types":"dist/index.d.ts","module":"dist/esm/src/index.js","readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n5. Defining custom metrics\n\nOpenAPM exposes underlying `prom-client` via `getMetricClient` function.\n\n```js\nconst { getMetricClient } = require('@last9/openapm');\n\n// initialize custom metric\nconst client = getMetricClient();\nconst counter = new client.Counter({\n  name: 'cancelation_calls',\n  help: 'no. of times cancel operation is called'\n});\n\n// handler\napp.get('/cancel/:ids', (req, res) => {\n  counter.inc();\n  res.status(200).json({});\n});\n```\n\nFollow the [documentation of prom-client](https://github.com/siimon/prom-client?tab=readme-ov-file#custom-metrics)\nto get familiar with the DSL for defining custom metrics.\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","gitHead":"412a232c8f0dae546908ca00a7e61a583967a868","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^15.1.2","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","playwright":"^1.44.0","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.3-alpha.4_1716200503177_0.7350170271575984","host":"s3://npm-registry-packages"}},"0.9.2":{"name":"@last9/openapm","version":"0.9.2","keywords":["last9","metrics","apm","prometheus"],"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","_id":"@last9/openapm@0.9.2","maintainers":[{"name":"tushar_last9","email":"tushar@last9.io"},{"name":"last9-dev","email":"hi@last9.io"},{"name":"prathamesh-sonpatki","email":"prathamesh@last9.io"}],"contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"homepage":"https://github.com/last9/nodejs-openapm#readme","bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"dist":{"shasum":"51963e15635d975f118d6e6e25685b5bfe7f12db","tarball":"https://registry.npmjs.org/@last9/openapm/-/openapm-0.9.2.tgz","fileCount":58,"integrity":"sha512-VaLeDoue4a4+6PGSAb7zlKw8reFjJqiDTFraxOnnU0gSoDvLiTgkzOA0BdnJzrh5tkGwIa6tfvOlSvfOjYqZtQ==","signatures":[{"sig":"MEUCIQDukhTHQFRfzAKyL9Bxgab+JLo8PuLQhtU48zs6wt5FnwIgQpqlYEypAJQt/YlirFNhrjFlDL/Qno7C9+IKCGvxnnA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2617151},"main":"dist/src/index.js","types":"dist/index.d.ts","module":"dist/esm/src/index.js","gitHead":"e4cc4c3834144119fa017538a69fb73bfc147571","private":false,"scripts":{"test":"chmod +x ./run-tests.sh && ./run-tests.sh","build":"tsup","vitest":"vitest","build:watch":"tsup --watch"},"_npmUser":{"name":"tushar_last9","email":"tushar@last9.io"},"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"_npmVersion":"10.2.3","description":"OpenAPM for Node.js","directories":{"test":"tests"},"_nodeVersion":"18.19.0","dependencies":{"chalk":"^4.1.2","rollup":"^4.14.3","undici":"^5.27.2","chokidar":"^3.6.0","prom-client":"^15.1.2","response-time":"^2.3.2","@prisma/client":"^5.13.0","@types/supertest":"^6.0.2","url-value-parser":"^2.2.0","@rollup/plugin-commonjs":"^25.0.7"},"_hasShrinkwrap":false,"devDependencies":{"next":"^14.2.2","tsup":"^7.2.0","axios":"^1.4.0","react":"^18.2.0","tslib":"^2.6.0","dotenv":"^16.3.1","eslint":"^8.44.0","mysql2":"^3.6.0","prisma":"^5.13.0","vitest":"^0.32.4","express":"^4.18.2","ts-node":"^10.9.1","prettier":"2.8.8","@swc/core":"^1.3.95","supertest":"^6.3.3","tiny-glob":"^0.2.9","@vitest/ui":"^0.34.1","node-fetch":"^3.3.1","playwright":"^1.44.0","typescript":"^5.1.6","@babel/core":"^7.22.5","@types/node":"^20.4.4","@nestjs/core":"^10.2.7","@types/react":"^18.2.79","@types/mysql2":"github:types/mysql2","@types/express":"^4.17.17","@nestjs/testing":"^10.3.8","eslint-plugin-n":"^15.7.0","@babel/preset-env":"^7.22.5","@types/response-time":"^2.3.5","eslint-plugin-import":"^2.27.5","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","@nestjs/platform-express":"^10.3.8","@typescript-eslint/parser":"^5.61.0","eslint-config-semistandard":"^17.0.0","parse-prometheus-text-format":"^1.1.1","@typescript-eslint/eslint-plugin":"^5.61.0"},"peerDependencies":{"express":"4.x"},"peerDependenciesMeta":{"next":{"optional":true},"mysql2":{"optional":true},"express":{"optional":true},"@nestjs/core":{"optional":true},"@prisma/client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/openapm_0.9.2_1716204531633_0.9873102137123739","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-07-18T06:13:42.953Z","modified":"2026-07-07T01:19:56.673Z","0.1.0":"2023-07-18T06:13:43.338Z","0.1.1-beta.1":"2023-07-18T08:26:37.723Z","0.1.1":"2023-07-18T08:30:21.573Z","0.1.2-alpha-1":"2023-08-09T07:35:37.275Z","0.1.2-alpha-2":"2023-08-09T11:07:00.543Z","0.1.2-alpha-3":"2023-08-09T11:17:07.417Z","0.1.2-alpha-4":"2023-08-09T12:38:09.116Z","0.1.2-alpha-5":"2023-08-09T12:55:31.857Z","0.1.2-alpha-6":"2023-08-10T06:29:28.756Z","0.1.2-alpha-7":"2023-08-10T06:34:06.384Z","0.1.2-alpha-8":"2023-08-10T06:39:18.735Z","0.1.2-alpha-9":"2023-08-10T07:07:47.866Z","0.1.2-alpha-10":"2023-08-10T16:57:11.406Z","0.1.2-alpha-11":"2023-08-14T12:36:41.192Z","0.1.2-alpha-12":"2023-08-14T13:57:42.140Z","0.1.2-alpha-13":"2023-08-15T05:16:59.577Z","0.1.2-alpha-14":"2023-08-17T12:51:19.758Z","0.1.2-alpha-15":"2023-08-17T14:56:29.092Z","0.1.2-alpha-16":"2023-08-17T16:41:55.497Z","0.1.2-alpha-17":"2023-08-18T07:07:46.645Z","0.2.1-alpha-1":"2023-08-23T13:17:28.745Z","0.2.1":"2023-08-23T14:41:39.454Z","0.2.2-alpha-1":"2023-08-24T17:18:00.414Z","0.2.2":"2023-09-04T05:30:55.142Z","0.2.3-alpha-1":"2023-09-20T09:21:20.857Z","0.3.0-alpha-1":"2023-10-09T02:29:00.552Z","0.3.0-alpha-2":"2023-10-09T04:27:13.076Z","0.3.0-alpha-3":"2023-10-09T10:17:15.709Z","0.3.0-alpha-4":"2023-10-10T05:03:09.801Z","0.3.0-alpha-5":"2023-10-11T06:21:07.060Z","0.3.0":"2023-10-11T06:55:28.580Z","0.4.0-alpha.1":"2023-10-27T06:46:24.764Z","0.4.0-alpha.2":"2023-10-27T06:54:29.223Z","0.4.0-alpha.3":"2023-10-30T06:02:48.665Z","0.4.0-alpha.4":"2023-10-30T06:08:11.987Z","0.4.0-alpha.5":"2023-10-30T06:11:32.689Z","0.4.0-alpha.6":"2023-10-30T06:34:51.911Z","0.4.0-alpha.7":"2023-10-30T07:17:47.277Z","0.4.0-alpha.8":"2023-10-31T13:30:12.189Z","0.4.0-alpha.9":"2023-11-02T09:52:37.201Z","0.4.0":"2023-11-02T13:47:02.715Z","0.5.0-alpha.1":"2023-11-17T14:41:46.237Z","0.5.0-alpha.2":"2023-11-24T15:04:11.250Z","0.5.0":"2023-12-04T06:30:49.261Z","0.5.1-alpha.1":"2023-12-13T08:04:35.366Z","0.5.2-alpha-1":"2023-12-20T22:13:44.438Z","0.5.1-alpha.2":"2023-12-21T07:39:48.690Z","0.6.0-alpha.1":"2023-12-21T12:20:11.533Z","0.6.0":"2023-12-22T05:27:13.091Z","0.7.0-alpha.1":"2023-12-22T07:12:46.306Z","0.6.1-beta.1":"2023-12-26T12:06:48.838Z","0.6.1":"2023-12-26T14:57:40.904Z","0.7.0-alpha.2":"2024-03-08T09:31:34.429Z","0.8.0-alpha.1":"2024-03-26T08:23:13.251Z","0.8.0-alpha.2":"2024-03-29T10:12:34.068Z","0.7.0":"2024-04-01T08:35:46.950Z","0.8.0-alpha.3":"2024-04-01T09:15:50.618Z","0.8.0-alpha.4":"2024-04-01T09:54:19.526Z","0.8.0-alpha.5":"2024-04-01T10:20:12.965Z","0.8.0-alpha.6":"2024-04-01T10:43:30.888Z","0.8.0-alpha.7":"2024-04-10T07:52:11.407Z","0.8.0-beta.1":"2024-04-12T18:41:27.214Z","0.8.0-beta.2":"2024-04-12T20:22:53.900Z","0.8.0-beta.3":"2024-04-12T20:28:00.800Z","0.8.0-beta.4":"2024-04-12T20:33:40.139Z","0.8.0-beta.5":"2024-04-12T20:40:03.558Z","0.8.0-beta.6":"2024-04-12T20:57:29.844Z","0.8.0-beta.7":"2024-04-18T07:57:40.860Z","0.8.0-beta.8":"2024-04-18T08:01:55.085Z","0.8.0-beta.9":"2024-04-18T08:04:52.852Z","0.8.0-beta.10":"2024-04-18T08:09:33.568Z","0.8.0-beta.11":"2024-04-20T17:35:12.191Z","0.8.0-beta.12":"2024-04-22T04:26:07.216Z","0.8.0-beta.13":"2024-04-22T07:23:18.440Z","0.8.0-beta.14":"2024-04-22T07:58:18.255Z","0.8.0-beta.15":"2024-04-22T09:33:52.033Z","0.8.0":"2024-04-26T10:40:38.309Z","0.9.0-alpha.1":"2024-05-06T05:37:53.982Z","0.9.0-alpha.2":"2024-05-09T10:23:30.579Z","0.9.0-alpha.3":"2024-05-11T05:46:39.396Z","0.9.0-alpha.4":"2024-05-11T06:31:13.792Z","0.9.0-alpha.5":"2024-05-11T07:01:15.195Z","0.9.0-alpha.6":"2024-05-11T07:45:17.495Z","0.9.0":"2024-05-14T06:08:33.729Z","0.9.1-alpha.1":"2024-05-15T09:12:21.170Z","0.9.1-alpha.2":"2024-05-15T09:36:17.342Z","0.9.1-alpha.3":"2024-05-16T10:25:31.261Z","0.9.1-beta.4":"2024-05-16T13:29:15.067Z","0.9.1":"2024-05-17T11:04:14.216Z","0.9.2-alpha":"2024-05-19T07:17:25.724Z","0.9.3-alpha":"2024-05-19T08:02:43.732Z","0.9.3-alpha.2":"2024-05-19T19:20:54.104Z","0.9.3-alpha.3":"2024-05-20T06:51:06.234Z","0.9.3-alpha.4":"2024-05-20T10:21:43.443Z","0.9.2":"2024-05-20T11:28:51.837Z"},"bugs":{"url":"https://github.com/last9/nodejs-openapm/issues"},"author":{"name":"Last9 team","email":"hi@last9.io"},"license":"Apache-2.0","homepage":"https://github.com/last9/nodejs-openapm#readme","keywords":["last9","metrics","apm","prometheus"],"repository":{"url":"git+https://github.com/last9/nodejs-openapm.git","type":"git"},"description":"OpenAPM for Node.js","contributors":[{"url":"https://github.com/chtushar","name":"Tushar Choudhari","email":"tushar@last9.io"},{"url":"https://github.com/anik3tra0","name":"Aniket Rao","email":"aniket@last9.io"}],"maintainers":[{"email":"prathamesh@last9.io","name":"prathamesh-sonpatki"}],"readme":"<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/last9-github-badge.svg\" align=\"right\" /></a>\n\n# @last9/openapm\n\nAn APM solution based on metrics and open-source tools such as Prometheus and Grafana for NodeJs-based applications.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [Options](#options)\n4. [API Reference](#api-reference)\n5. [Setup Locally](#setup-locally)\n6. [Grafana Dashboard View](#grafana-dashboard-view)\n\n## Installation\n\n```\nnpm install --save @last9/openapm@latest\n```\n\n## Usage\n\n```js\nconst express = require('express');\nconst { OpenAPM } = require('@last9/openapm');\n\nconst app = express();\nconst openapm = new OpenAPM();\n\n// Instrument services\n\napp.listen(3000);\n\nconst gracefullyShutdown = () => {\n  app.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n1. [Express](#express)\n2. [MySQL](#mysql)\n3. [NestJS](#nestjs)\n4. [Next.js](#nextjs)\n\n### Express\n\nIn the example below, the metrics will be served on `localhost:9097/metrics`. To\nchange the port, you can update it through the options\n([See the options documentation](#options)).\n\n```js\nconst { OpenAPM } = require('@last9/openapm');\nconst openapm = new OpenAPM();\n\nopenapm.instrument('express');\n```\n\n### MySQL\n\nThis currently supports instrumentation for all Node.js ORMs, which are [mysql2](https://www.npmjs.com/package/mysql2) compatible.\n\nEnsure to add this line of code before you initialize db `connection/pool/poolCluster`.\n\n```js\nopenapm.instrument('mysql');\n```\n\n### NestJS\n\nOpenAPM currently supports RED Metrics for NestJS v4 and above.\n\n```js\nopenapm.instrument('nestjs');\n```\n\n### Next.js\n\nOpenAPM supports RED metrics for both pages and app router in a Next.js application.\n\n```js\nopenapm.instrument('nextjs');\n```\n\n> Note: You can only use the library if Next.js runs in a Node.js environment. Since OpenAPM relies on prom-client for capturing metrics data, a serverless environment might not be able persist them.\n\n## Options\n\n### Usage\n\n```js\nconst openapm = new OpenAPM({\n  // Options go here\n});\n```\n\n1. `path`: The path at which the metrics will be served. For eg. `/metrics`\n2. `metricsServerPort`: (Optional) The port at which the metricsServer will run.\n3. `environment`: (Optional) The application environment. Defaults to\n   `production`.\n4. `defaultLabels`: (Optional) Any default labels to be included.\n5. `requestsCounterConfig`: (Optional) Requests counter configuration, same as\n   [Counter](https://github.com/siimon/prom-client#counter) in `prom-client`.\n   Defaults to\n\n   ```js\n   {\n      name: 'http_requests_total',\n      help: 'Total number of requests',\n      labelNames: ['path', 'method', 'status'],\n    }\n   ```\n\n6. `requestDurationHistogramConfig`: (Optional) Requests Duration histogram\n   configuration, the same as\n   [Histogram](https://github.com/siimon/prom-client#histogram) in\n   `prom-client`. Defaults to\n   ```js\n    {\n        name: 'http_requests_duration_milliseconds',\n        help: 'Duration of HTTP requests in milliseconds',\n        labelNames: ['path', 'method', 'status'],\n        buckets: promClient.exponentialBuckets(0.25, 1.5, 31),\n      }\n   ```\n7. `extractLabels`: (Optional) Extract labels from URL params (WIP: Headers, Subdomain)\n   ```js\n   // To extract from the URL params\n   {\n      ...\n      extractLabels: {\n         tenant: { // Here 'tenant' is the label name\n            from : 'params',\n            key: 'org' // Which key to extract from the params\n            mask: ':org' // Replacement string\n         }\n      }\n   }\n   ```\n8. `excludeDefaultLabels`: (Optional) Provide labels to exclude from the default labels\n\n```js\n{\n  ...\n  excludeDefaultLabels: ['environment', 'version']\n}\n```\n\n9. `levitateConfig`: (Optional) Configuration for Levitate TSDB. Adding this configuration will enable the [Change Events](https://docs.last9.io/docs/change-events).\n\n10. `enableMetricsServer`: (Optional) Defaults to `true`. When set to `false` the OpenAPM won't start a metrics server. To get the metrics users can rely on the `.getMetrics()` function.\n\n```js\n{\n   ...\n   levitateConfig: {\n      host: 'https://app.last9.io',\n      orgSlug: 'last9', /** The slug can be obtained from the Last9 dashboard.*/\n      dataSourceName: 'data-source', /** The data source can be obtained from the data source pages in the Last9 dashboard*/\n      refreshTokens: {\n         write: '0d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f1342790d2a1a9a45XXXXXXXXXXXXXX3f134279' /** You can get this from the API access page on Last9 dashboard*/\n      }\n   }\n}\n```\n\n11. `enabled`: (Optional) Defaults to `true`. When set to `false` OpenAPM will be disabled and no metrics will be collected or emitted.\n\n```\nconst openapm = new OpenAPM({\n  enabled: process.env.NODE_ENV === 'production'\n})\n```\n\n12. `additionalLabels`: (Optional) Accepts an array of label keys that will be emitted with the metrics. This option is used in tandem with the `setOpenAPMLabels` API. Checkout [API Reference](#api-reference)\n\n```\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n})\n```\n\n## API Reference\n\n1. `instrument`: Used to instrument supported technologies. Refer the [usage](#usage) section.\n\n2. `getMetrics`: Returns a Promise of string which contains metrics in Prometheus exposition format. You can use this function to expose a metrics endpoint if `enableMetricsServer` is set to false. For example,\n\n```js\nconst openapm = new OpenAPM({\n  enableMetricsServer: false\n});\n\nopenapm.instrument('express');\n\nconst app = express();\n\napp.get('/metrics', async (_, res) => {\n  const metrics = await openapm.getMetrics();\n  res.setHeader('Content-Type', 'text/plain; version=0.0.4; charset=utf-8');\n  res.end(metrics);\n});\n```\n\n3. `shutdown`: Returns a promise which is resolved after the cleanup in OpenAPM. The cleanup includes closing the metrics server if it has started and cleared the prom-client register.\n\n```js\nconst gracefullyShutdown = () => {\n  server.close(() => {\n    openapm\n      .shutdown()\n      .then(() => {\n        console.log('OpenAPM shutdown successful.');\n      })\n      .catch((err) => {\n        console.log('Error shutting down OpenAPM', err);\n      });\n  });\n};\n\nprocess.on('SIGINT', gracefullyShutdown);\nprocess.on('SIGTERM', gracefullyShutdown);\n```\n\n4. `setOpenAPMLabels`: Unlike other APIs. You can directly import `setOpenAPMLabels` in any file to set custom labels to the request. Make sure to mention the label key in `additionalLabels` option. This function can set multiple labels in the metrics emitted by the ongoing HTTP request.\n\nNote: `setOpenAPMLabels` currently works with **express** and **Nest.js** only.\n\n```js\nimport { OpenAPM, setOpenAPMLabels } from '@last9/openapm';\n\nconst openapm = new OpenAPM({\n  additionalLabels: ['slug']\n});\n\nconst handler = () => {\n  setOpenAPMLabels({ slug: 'org-slug' });\n};\n```\n\n5. Defining custom metrics\n\nOpenAPM exposes underlying `prom-client` via `getMetricClient` function.\n\n```js\nconst { getMetricClient } = require('@last9/openapm');\n\n// initialize custom metric\nconst client = getMetricClient();\nconst counter = new client.Counter({\n  name: 'cancelation_calls',\n  help: 'no. of times cancel operation is called'\n});\n\n// handler\napp.get('/cancel/:ids', (req, res) => {\n  counter.inc();\n  res.status(200).json({});\n});\n```\n\nFollow the [documentation of prom-client](https://github.com/siimon/prom-client?tab=readme-ov-file#custom-metrics)\nto get familiar with the DSL for defining custom metrics.\n\n## Setup locally\n\nMake sure you are in the express directory.\n\n- Install packages\n\n```\nnpm install\n```\n\n- Build package\n\n  - This will build the package and store the JS and type declaration files in\n    the `dist` folder.\n\n```\nnpm run build\n```\n\n# Grafana Dashboard View\n\n1. Import [this](./APM-Grafana-Dashboard.json) dashboard into your Grafana\n2. Select your data source\n3. Save the dashboard\n\n![APM Dashboard](images/apm-dashboard-1.png)\n![APM Dashboard](images/apm-dashboard-2.png)\n![APM Dashboard](images/apm-dashboard-3.png)\n\n# About Last9\n\n[Last9](https://last9.io) builds reliability tools for SRE and DevOps.\n\n<a href=\"https://last9.io\"><img src=\"https://last9.github.io/assets/email-logo-green.png\" alt=\"\" loading=\"lazy\" height=\"40px\" /></a>\n","readmeFilename":"README.md"}