{"id":41362645,"url":"https://github.com/danielrataj/sails-hook-prometheus","last_synced_at":"2026-02-01T19:00:30.555Z","repository":{"id":46693378,"uuid":"174560338","full_name":"danielrataj/sails-hook-prometheus","owner":"danielrataj","description":"Provides Prometheus /metrics endpoint with stats.","archived":false,"fork":false,"pushed_at":"2023-01-06T14:33:14.000Z","size":364,"stargazers_count":7,"open_issues_count":11,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-21T10:27:48.635Z","etag":null,"topics":["prometheus","sails","sails-hook"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielrataj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-08T15:21:12.000Z","updated_at":"2024-05-07T00:30:56.000Z","dependencies_parsed_at":"2023-02-06T05:16:14.273Z","dependency_job_id":null,"html_url":"https://github.com/danielrataj/sails-hook-prometheus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danielrataj/sails-hook-prometheus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielrataj%2Fsails-hook-prometheus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielrataj%2Fsails-hook-prometheus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielrataj%2Fsails-hook-prometheus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielrataj%2Fsails-hook-prometheus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielrataj","download_url":"https://codeload.github.com/danielrataj/sails-hook-prometheus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielrataj%2Fsails-hook-prometheus/sbom","scorecard":{"id":320333,"data":{"date":"2025-08-11","repo":{"name":"github.com/danielrataj/sails-hook-prometheus","commit":"72ee966a086b77bdf2decd48a939c32e5c20746a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 3/18 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"39 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-x55w-vjjp-222r","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-35q2-47q7-3pc3","Warn: Project is vulnerable to: GHSA-gpw9-fwm8-7rx7","Warn: Project is vulnerable to: GHSA-8v3j-jfg3-v3fv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-qgmg-gppg-76g5","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T01:11:59.015Z","repository_id":46693378,"created_at":"2025-08-18T01:11:59.015Z","updated_at":"2025-08-18T01:11:59.015Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28986317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T18:17:03.387Z","status":"ssl_error","status_checked_at":"2026-02-01T18:16:57.287Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["prometheus","sails","sails-hook"],"created_at":"2026-01-23T08:00:35.462Z","updated_at":"2026-02-01T19:00:30.516Z","avatar_url":"https://github.com/danielrataj.png","language":"JavaScript","funding_links":[],"categories":["Hooks"],"sub_categories":["Free"],"readme":"[![Build Status](https://api.travis-ci.org/danielrataj/sails-hook-prometheus.svg?branch=master)](https://travis-ci.org/danielrataj/sails-hook-prometheus)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=danielrataj_sails-hook-prometheus\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=danielrataj_sails-hook-prometheus)\n![npm](https://img.shields.io/npm/dt/sails-hook-prometheus.svg)\n![npm](https://img.shields.io/npm/v/sails-hook-prometheus.svg)\n![node](https://img.shields.io/node/v/sails-hook-prometheus.svg)\n![NPM](https://img.shields.io/npm/l/sails-hook-prometheus.svg)\n\n# sails-hook-prometheus\n\nGather Prometheus metrics for your SailsJS application. Also it will opens `/metrics` endpoint where Prometheus can scrap all statistics.\n\n- [sails-hook-prometheus](#sails-hook-prometheus)\n  - [Installation](#installation)\n- [Configuration](#configuration)\n  - [Configuration in depth](#configuration-in-depth)\n    - [`defaultMetrics.enabled` (boolean)](#defaultmetricsenabled-boolean)\n    - [`defaultMetrics.prefix` (string)](#defaultmetricsprefix-string)\n    - [`httpMetric.enabled` (boolean)](#httpmetricenabled-boolean)\n    - [`httpMetric.name` (string)](#httpmetricname-string)\n    - [`httpMetric.type` (string)](#httpmetrictype-string)\n    - [`httpMetric.help` (string)](#httpmetrichelp-string)\n    - [`httpMetric.buckets` (array of numbers)](#httpmetricbuckets-array-of-numbers)\n    - [`httpMetric.route.exclude` (array of strings)](#httpmetricrouteexclude-array-of-strings)\n    - [`httpMetric.urlQueryString` (boolean)](#httpmetricurlquerystring-boolean)\n    - [`httpMetric.urlParams` (boolean)](#httpmetricurlparams-boolean)\n    - [`upMetric.enabled` (boolean)](#upmetricenabled-boolean)\n    - [`upMetric.name` (string)](#upmetricname-string)\n    - [`upMetric.help` (string)](#upmetrichelp-string)\n    - [`throughputMetric.enabled` (boolean)](#throughputmetricenabled-boolean)\n    - [`throughputMetric.name` (string)](#throughputmetricname-string)\n    - [`throughputMetric.help` (string)](#throughputmetrichelp-string)\n    - [`sockets.enabled` (boolean)](#socketsenabled-boolean)\n  - [Custom metrics](#custom-metrics)\n    - [Counter metric](#counter-metric)\n    - [Gauge metric](#gauge-metric)\n  - [Labels for custom metrics](#labels-for-custom-metrics)\n    - [Example for counter metric](#example-for-counter-metric)\n  - [Custom `/metrics` endpoint](#custom-metrics-endpoint)\n- [Contributors](#contributors)\n- [License](#license)\n\n## Installation\n\nInstall and save NPM dependency.\n\n```bash\nnpm install --save sails-hook-prometheus\n```\n\n# Configuration\n\nYou can override default configuration. Create a file in `/config/prometheus.js` with configuration values listed bellow.\n\n## Configuration in depth\n\nAll configuration values bellow are optional.\n\n### `defaultMetrics.enabled` (boolean)\n\n```js\nmodule.exports.prometheus = {\n  defaultMetrics: {\n    enabled: true\n  }\n}\n```\n\nEnable/disable metric.\n\n### `defaultMetrics.prefix` (string)\n\n```js\nmodule.exports.prometheus = {\n  defaultMetrics: {\n    prefix: ``\n  }\n}\n```\n\nPrefix for default collected metrics.\n\n### `httpMetric.enabled` (boolean)\n\n```js\nmodule.exports.prometheus = {\n  httpMetric: {\n    enabled: true\n  }\n}\n```\n\nEnable/disable metric.\n\n### `httpMetric.name` (string)\n\n```js\nmodule.exports.prometheus = {\n  httpMetric: {\n    name: `http_request_duration_seconds`\n  }\n}\n```\n\nHelp text displayed as a metric title under _/metrics_ page.\n\n### `httpMetric.type` (string)\n\n```js\nmodule.exports.prometheus = {\n  httpMetric: {\n    type: `histogram`\n  }\n}\n```\n\nYou can select between _histogram_ or _summary_.\n\n### `httpMetric.help` (string)\n\n```js\nmodule.exports.prometheus = {\n  httpMetric: {\n    help: `duration histogram of http responses labeled with: `\n  }\n}\n```\n\nHelp text displayed next to the metric name.\n\n### `httpMetric.buckets` (array of numbers)\n\n```js\nmodule.exports.prometheus = {\n  httpMetric: {\n    buckets: [0.003, 0.03, 0.1, 0.3, 1.5, 10]\n  }\n}\n```\n\nBuckets related to histogram metric.\n\n### `httpMetric.route.exclude` (array of strings)\n\n```js\nmodule.exports.prometheus = {\n  httpMetric: {\n    exclude: [\n      '\\\\.css$',\n      '\\\\.js$',\n      '\\\\.(ico|gif|jpg|jpeg|png)$',\n      '\\\\.(eot|ttf|woff|woff2|svg)$'\n    ]\n  }\n}\n```\n\nDefine which routes are excluded from histogram. Every element in array has to be a regular expression.\n\n### `httpMetric.urlQueryString` (boolean)\n\n```js\nmodule.exports.prometheus = {\n  httpMetric: {\n    urlQueryString: true\n  }\n}\n```\n\nInclude URL query params in `path` label. It is `true` by default but please note your Prometheus server might not be ready for this amount of data (every unique URL).\n\n\n### `httpMetric.urlParams` (boolean)\n\n```js\nmodule.exports.prometheus = {\n  httpMetric: {\n    urlParams: true\n  }\n}\n```\n\nInclude URL params in `path` label. It is `true` by default but please note your Prometheus server might not be ready for this amount of data (every unique URL).\n\n### `upMetric.enabled` (boolean)\n\n```js\nmodule.exports.prometheus = {\n  upMetric: {\n    enabled: true\n  }\n}\n```\n\nEnable/disable metric.\n\n### `upMetric.name` (string)\n\n```js\nmodule.exports.prometheus = {\n  upMetric: {\n    name: `up`\n  }\n}\n```\n\n### `upMetric.help` (string)\n\n```js\nmodule.exports.prometheus = {\n  upMetric: {\n    help: '1 = up, 0 = not up'\n  }\n}\n```\n\n### `throughputMetric.enabled` (boolean)\n\n```js\nmodule.exports.prometheus = {\n  throughputMetric: {\n    enabled: false\n  }\n}\n```\n\nEnable/disable metric.\n\n### `throughputMetric.name` (string)\n\n```js\nmodule.exports.prometheus = {\n  throughputMetric: {\n    name: `throughput`\n  }\n}\n```\n\n### `throughputMetric.help` (string)\n\n```js\nmodule.exports.prometheus = {\n  throughputMetric: {\n    help: 'The number of requests served'\n  }\n}\n```\n\n### `sockets.enabled` (boolean)\n\n```js\nmodule.exports.prometheus = {\n  sockets: {\n    enabled: false\n  }\n}\n```\n\nLog socket requests as well. Due to the fact that status code is reserved for HTTP protocol only, the result of status code is always going to be 0.\n\n## Custom metrics\nYou can add two kind of metrics on your own:\n\n- counter (increase a metric)\n- gauge (increase or decrease a metric)\n\n### Counter metric\n```js\nlet counter = sails.hooks.prometheus.counter.setup({\n  name: `testcounter`,\n  help: `help to the metric`\n})\n\ncounter.inc() // increase a metric by default 1\n\n // increase a metric by 2\ncounter.inc({\n  amount: 2\n})\n\n// increase a metric by 10\ncounter.inc({\n  amount: 10\n})\n```\n\n### Gauge metric\n```js\nlet gauge = sails.hooks.prometheus.gauge.setup({\n  name: `testgauged`,\n  help: `help to the metric`\n})\n\n// increase a metric by default 1\ngauge.inc()\n\n// increase a metric by 10\ngauge.inc({\n  amount: 10\n})\n\n// decrease a metric by default 1\ngauge.dec()\n\n// decrease a metric by 2\ngauge.dec({\n  amount: 2\n})\n\n// set a metric to 100\ngauge.set({\n  amount: 100\n})\n```\n\n## Labels for custom metrics\nBoth count and gauge metrics comes with labels feature as well.\n\n### Example for counter metric\n\n```js\nlet counter = sails.hooks.prometheus.counter.setup({\n  name: `testcounter`,\n  help: `help to the metric`\n  labelNames: [`counter1`, `counter2`]\n})\n\ncounter.inc({\n  amount: 1,\n  labels: {\n    counter1: `value`\n  }\n})\n```\n\n*Note:* Gauge metric goes the same.\n\n## Custom `/metrics` endpoint\nYou can configure your own public route by editing `/config/routes.js` file.\n\n```js\nmodule.exports.routes = {\n  'GET /api/v1/metrics': 'prometheus/metrics',\n}\n```\n\n# Contributors\n\nThis project was originally created by Daniel Rataj.\n\n# License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielrataj%2Fsails-hook-prometheus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielrataj%2Fsails-hook-prometheus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielrataj%2Fsails-hook-prometheus/lists"}