{"_id":"@balena/socket-prometheus-metrics","_rev":"36-29b0a0235fba4bbdd4ab24cffdfc1cf6","name":"@balena/socket-prometheus-metrics","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.3-add-configs-600a8ae37b43ad9174c0bdb7076ac369d4444db5":{"name":"@balena/socket-prometheus-metrics","version":"0.0.3-add-configs-600a8ae37b43ad9174c0bdb7076ac369d4444db5","keywords":["prometheus","socket.io","metrics"],"author":{"name":"Josh Bowling","email":"josh@balena.io"},"license":"Apache-2.0","_id":"@balena/socket-prometheus-metrics@0.0.3-add-configs-600a8ae37b43ad9174c0bdb7076ac369d4444db5","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"page","email":"page@balena.io"}],"homepage":"https://github.com/product-os/socket-prometheus-metrics#readme","bugs":{"url":"https://github.com/product-os/socket-prometheus-metrics/issues"},"dist":{"shasum":"7655e51eb93be0a64bb49c7be6ca4bda2582fe84","tarball":"https://registry.npmjs.org/@balena/socket-prometheus-metrics/-/socket-prometheus-metrics-0.0.3-add-configs-600a8ae37b43ad9174c0bdb7076ac369d4444db5.tgz","fileCount":6,"integrity":"sha512-sf0QBYzZamAJtkj0DD70voY0PMD7YiN80SU2MosmnOihdk6RZ4rUew8W7WhBgppT1EX49qNEGqsTyJXzJGGPjw==","signatures":[{"sig":"MEUCIQCR2przLXDjgwKCYP++hD/Y3bNSehIEUGvCs1VW2AI9JQIgReU3ShnNo6qMu4cuFsqJr0OmKQ26a90bt3Pw56b0nOw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25562,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhA4UVCRA9TVsSAnZWagAAqR8QAIp9jvm8N/ETdE1CBgnn\n4lb+44naZDPceAslu7erO2Y7yHz5h2x8ge27UWSQBEYI0JwjpKVZhWVWAGcO\n6iNZu2oWm8JCJKFWP9KL7Z8lDdydZK7A7HvTX0gzIMGAur5z4jVjJkF23HsD\nU2tTqcyxXiOMPN3FeCo7Vno6lPnm+eYZncVTNhyT5YlifjpE47ubh/Z5l+CW\nawhK60kA8HuG9YFQkRCozKjloo0PPlws/9Pyo+8AFgYL99kqRHaK6svmbkra\ngst+IRHK+LXLa4D2fjT+WSxmgvtkWZbB5dGfd5UcaQ0txbT5PSQ3lkMc6X/P\nTdUk8uat/uXf/+UuLKB5GRu9OuIGubUu8Htq9tZf/VN3Mi0DOHd+oiYi/12c\nt6lh2Iur30xcSCmF2GcASjOREETRf4WxWvGcL93duokbkhkxWGDThyuuB1ca\n0bk3K61fE9RSRsAVaDXZx2yUznsNitB3pLRhJlsOi7rguqATIEr81+ceJJqT\ndEY8bBmoQsIMpWstciLwszjPHOAHpMG8pVrnKBuW8VfKemT5uE/l7mwpCNVn\nKGmjzgd0srwjWrG0q+xHHydidI7Jg3D4oavuhp4Z9uxLmRA413gWpSa2HMMo\n47BZqPtqx+uGUFkOnPLqj4KMmrlit5I8Y5BHXAMa6pwnMt3kfbPzLylD6N7X\n1XYs\r\n=dCV8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","gitHead":"600a8ae37b43ad9174c0bdb7076ac369d4444db5","scripts":{"lint":"balena-lint index.ts","test":"npm run lint","build":"npm run clean && tsc","clean":"rimraf *.log dist","prepack":"npm run build","lint-fix":"balena-lint --fix index.ts"},"typings":"./dist/index.d.ts","_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+https://github.com/product-os/socket-prometheus-metrics.git","type":"git"},"versionist":{"publishedAt":"2021-07-30T04:46:57.196Z"},"_npmVersion":"6.14.14","description":"Prometheus metrics for socket.io","directories":{},"lint-staged":{"*.{ts,tsx}":["balena-lint --fix"]},"_nodeVersion":"14.17.1","dependencies":{"express":"^4.17.1","socket.io":"^4.1.2","prom-client":"^13.1.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^3.0.2","typescript":"^4.3.5","@types/node":"^16.0.0","lint-staged":"^11.1.1","@balena/lint":"^6.1.1","@types/express":"^4.17.12","simple-git-hooks":"^2.5.1"},"simple-git-hooks":{"pre-commit":"npx lint-staged"},"_npmOperationalInternal":{"tmp":"tmp/socket-prometheus-metrics_0.0.3-add-configs-600a8ae37b43ad9174c0bdb7076ac369d4444db5_1627620629033_0.40643396704264245","host":"s3://npm-registry-packages"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"0.0.3":{"name":"@balena/socket-prometheus-metrics","version":"0.0.3","keywords":["prometheus","socket.io","metrics"],"author":{"name":"Josh Bowling","email":"josh@balena.io"},"license":"Apache-2.0","_id":"@balena/socket-prometheus-metrics@0.0.3","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"nazrhom","email":"nazrhom@gmail.com"},{"name":"page","email":"page@balena.io"}],"homepage":"https://github.com/product-os/socket-prometheus-metrics#readme","bugs":{"url":"https://github.com/product-os/socket-prometheus-metrics/issues"},"dist":{"shasum":"bc5bb72cf6a3035bee72c62da68df4a0749d48f6","tarball":"https://registry.npmjs.org/@balena/socket-prometheus-metrics/-/socket-prometheus-metrics-0.0.3.tgz","fileCount":6,"integrity":"sha512-QEdQGMD20lqkLEo2OPrjKMS7/kHhUMnANa+neDm7EBhB1CGGgT/vNtzZIgBmhi4UxQuadhjm3jHd2wv0MmwHlg==","signatures":[{"sig":"MEUCIQCKCdZINHGWRnbBiyjMwSo00mWhjIr6UicrPjFtnRA3HQIgZQ7rBjaJiDFYum1KKiCiNZ1P6/kuJjmvEkGybEY9Vak=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25509,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh12RBCRA9TVsSAnZWagAAQTkP/RETr+i6IlIC0MPzwAlW\nzR4vvRBQ+rLDLfbIG3hIx/5bE1zcucxY9Lex4P7wFzySFCJfnQ0EQAWntw7a\n7N+yxtTAohNJjzvVf3k6TFsOK2d1MaO0Ik5Vx25U2M6yFjvar/5MpwawMxJk\n7cF5DaXvb3hMVM/9WX8qalF6Tb11294EwOfRc0G1aFq+u/zJirp7+H619VOR\nZZPvx62oy/vhvkLl1a1kek135dPC3vyJKOSB2C1NANAhWuZ9YIuQnSeORT4G\nxesQIjwKZvDgRJmqG93Z0y1485+9xiFfgfdHPhQ2ao89f0m0m6Zkyjb2AK47\ntuRVzSBzj3AnRpr5DEeVpuxEtEJ5sZGblYurv8IeV9O8DEr3sLF0s8WDmgND\n+WrskvuVLzolyD+W8AbAloypCZu1EovyETUk+t0sBeZaEnylndh/k2B6qh/q\nKDykSJ1+67KNBa3CKs3xjMXhUZJn6RZSrLsnw3zPL56ixR7pTugIZ6oJ/9xE\nioNga3DcmaBjmqHfRU45895kC6LSqWtnhCakXPhBpsJdEI37IDOTqtsZgOyd\nF5jCP50w68HULTRQd9QOmU/ydwXTCaB0f/5wM1i9B46D1O7JCr8FnrkBchQD\nmjTXZPHJggA/pCcabhBTAlFMDZzzA1AvF5V9uWE6LPtzkVd3GHpP5VQjBU7z\nJZV5\r\n=nmBv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.js","gitHead":"42f202abab4bf452a93c4ac23e299bc547762117","scripts":{"lint":"balena-lint index.ts","test":"npm run lint","build":"npm run clean && tsc","clean":"rimraf *.log dist","prepack":"npm run build","lint-fix":"balena-lint --fix index.ts"},"typings":"./dist/index.d.ts","_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+https://github.com/product-os/socket-prometheus-metrics.git","type":"git"},"versionist":{"publishedAt":"2021-07-30T04:52:34.900Z"},"_npmVersion":"6.14.14","description":"Prometheus metrics for socket.io","directories":{},"lint-staged":{"*.{ts,tsx}":["balena-lint --fix"]},"_nodeVersion":"14.17.1","dependencies":{"express":"^4.17.1","socket.io":"^4.1.2","prom-client":"^13.1.0"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^3.0.2","typescript":"^4.3.5","@types/node":"^16.0.0","lint-staged":"^11.1.1","@balena/lint":"^6.1.1","@types/express":"^4.17.12","simple-git-hooks":"^2.5.1"},"simple-git-hooks":{"pre-commit":"npx lint-staged"},"_npmOperationalInternal":{"tmp":"tmp/socket-prometheus-metrics_0.0.3_1627620864226_0.005020045136214568","host":"s3://npm-registry-packages"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."}},"time":{"created":"2021-07-30T04:50:28.987Z","modified":"2026-01-29T08:31:34.015Z","0.0.3-add-configs-600a8ae37b43ad9174c0bdb7076ac369d4444db5":"2021-07-30T04:50:29.173Z","0.0.3":"2021-07-30T04:54:24.411Z"},"bugs":{"url":"https://github.com/product-os/socket-prometheus-metrics/issues"},"author":{"name":"Josh Bowling","email":"josh@balena.io"},"license":"Apache-2.0","homepage":"https://github.com/product-os/socket-prometheus-metrics#readme","keywords":["prometheus","socket.io","metrics"],"repository":{"url":"git+https://github.com/product-os/socket-prometheus-metrics.git","type":"git"},"description":"Prometheus metrics for socket.io","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"page","email":"page@balena.io"}],"readme":"# socket.io-prometheus-metrics\n\nExposes a metrics endpoint for prometheus to collect data about [`socket.io`](https://github.com/socketio/socket.io).\n\n## Installation\n\n```bash\nnpm install socket.io-prometheus-metrics\n# or\nyarn add socket.io-prometheus-metrics\n```\n\n## Usage\n\nBasic usage\n\n```ts\nimport * as http from 'http';\nimport * as io from 'socket.io';\nimport * as prometheus from 'socket.io-prometheus-metrics';\n\nconst server = http.createServer();\nconst io = io(server);\n\nprometheus.metrics(io);\n\nserver.listen(3000);\n```\nMetrics is then available at `localhost:9090/metrics`.\n\nPrometheus default metrics can also be enabled by setting the `collectDefaultMetrics` option to `true`\n\n```ts\nprometheus.metrics(io, {\n    collectDefaultMetrics: true\n});\n```\n\nIf you wish to serve the metrics yourself the `createServer` options can be set to `false` and metrics can be collected from the register\n```ts\nconst ioMetrics = prometheus.metrics(io, {\n    createServer: false\n});\n\nconst metrics = ioMetrics.register.metrics();\n```\n\n## Options\n\n| Option                    | Default       | Description                                                  |\n| ------------------------- | --------------| ------------------------------------------------------------ |\n| `path`                    | \"/metrics\"    | Metrics path                                                 |\n| `port`                    | 9090          | Metrics port                                                 |\n| `createServer`            | true          | Auto create http server                                      |\n| `collectDefaultMetrics`   | false         | Collect prometheus default metrics                           |\n| `checkForNewNamespaces`   | true          | Collect metrics for namespaces that will be added at runtime |\n\n## Socket.io metrics\n\n> all metrics have `socket_io_` prefix in their names.\n\n| Name                              | Help                                         | Labels               |\n| --------------------------------- | ---------------------------------------------| -------------------  |\n| `socket_io_connected`             | Number of currently connected sockets        |                      |\n| `socket_io_connect_total`         | Total count of socket.io connection requests | `namespace`          |\n| `socket_io_disconnect_total`      | Total count of socket.io disconnections      | `namespace`          |\n| `socket_io_errors_total`          | Total count of socket.io errors              | `namespace`          |\n| `socket_io_events_received_total` | Total count of socket.io received events     | `event`, `namespace` |\n| `socket_io_events_sent_total`     | Total count of socket.io sent events         | `event`, `namespace` |\n| `socket_io_receive_bytes`         | Total socket.io bytes received               | `event`, `namespace` |\n| `socket_io_transmit_bytes`        | Total socket.io bytes transmitted            | `event`, `namespace` |\n\n## Prometheus default metrics\n> available if `collectDefaultMetrics` is set to `true`\n\nMore information [here](https://github.com/siimon/prom-client#default-metrics) and [here](https://prometheus.io/docs/instrumenting/writing_clientlibs/#standard-and-runtime-collectors).\n\n## Namespaces support\n\nDefault namespace has label value of `'/'`.\n\nBy default library checks `io.nsps` variable for new namespaces to collect metrics from. This check occurs every 2 seconds. \n\nYou can disable this functionality by providing `checkForNewNamespaces` option with `false` value.\nFor example:\n\n```ts\nprometheus.metrics(io, {\n    checkForNewNamespaces: false\n});\n```\n\nWith this functionality disabled, library will only collect metrics from namespaces that \nwere available at the moment of call to `prometheus.metrics(io, ...)`, \ndefault namespace is included.  \n\nMore information about socket.io namespaces [here](https://socket.io/docs/rooms-and-namespaces).   \n\n## License\n\nLicensed under the Apache 2.0 License. See the LICENSE file for details.","readmeFilename":"README.md"}