{"id":41489191,"url":"https://github.com/eggjs/egg-prometheus","last_synced_at":"2026-01-23T18:16:17.599Z","repository":{"id":57220678,"uuid":"151434870","full_name":"eggjs/egg-prometheus","owner":"eggjs","description":"Prometheus plugin for Egg.js","archived":false,"fork":false,"pushed_at":"2024-03-12T03:23:50.000Z","size":68,"stargazers_count":40,"open_issues_count":2,"forks_count":9,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-11-24T01:25:55.530Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://egg-prometheus.vercel.app","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/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-10-03T15:26:38.000Z","updated_at":"2025-08-18T03:24:39.000Z","dependencies_parsed_at":"2023-01-21T20:41:03.841Z","dependency_job_id":"45e19714-fbb8-40d3-be5c-9cb66fd573cb","html_url":"https://github.com/eggjs/egg-prometheus","commit_stats":{"total_commits":28,"total_committers":11,"mean_commits":"2.5454545454545454","dds":0.6428571428571428,"last_synced_commit":"1edf9e41ea5d2b38504b376bf76da8eb50f91421"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/eggjs/egg-prometheus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-prometheus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-prometheus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-prometheus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-prometheus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-prometheus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-prometheus/sbom","scorecard":{"id":368765,"data":{"date":"2025-08-11","repo":{"name":"github.com/eggjs/egg-prometheus","commit":"1edf9e41ea5d2b38504b376bf76da8eb50f91421"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-prometheus/nodejs.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-prometheus/release.yml/master?enable=pin","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":3,"reason":"Found 9/28 approved changesets -- score normalized to 3","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":"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":7,"reason":"binaries present in source code","details":["Warn: binary detected: test/fixtures/apps/rpc-app/target/classes/com/alipay/sofa/rpc/protobuf/NodeTRException.class:1","Warn: binary detected: test/fixtures/apps/rpc-app/target/rpc-app-facade-1.0.0-sources.jar:1","Warn: binary detected: test/fixtures/apps/rpc-app/target/rpc-app-facade-1.0.0.jar:1"],"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 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"}}]},"last_synced_at":"2025-08-18T12:29:42.000Z","repository_id":57220678,"created_at":"2025-08-18T12:29:42.000Z","updated_at":"2025-08-18T12:29:42.000Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"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":[],"created_at":"2026-01-23T18:16:16.862Z","updated_at":"2026-01-23T18:16:17.593Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-prometheus\n\nPrometheus plugin for egg framework\n\n[![NPM version][npm-image]][npm-url]\n[![CI](https://github.com/eggjs/egg-prometheus/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-prometheus/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-prometheus.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-prometheus\n[codecov-image]: https://codecov.io/gh/eggjs/egg-prometheus/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/eggjs/egg-prometheus\n[download-image]: https://img.shields.io/npm/dm/egg-prometheus.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-prometheus\n\n[Prometheus](https://prometheus.io) plugin for egg framework\n\n## Install\n\n```bash\nnpm i egg-prometheus --save\n```\n\n## Usage\n\n### Enable the plugin\n\nChange `${app_root}/config/plugin.js` to enable Prometheus plugin:\n\n```js\nexports.prometheus = {\n  enable: true,\n  package: \"egg-prometheus\",\n};\n```\n\n### Configuration\n\n```js\nexports.prometheus = {\n  timeout: 5000,\n  scrapePort: 3000,\n  scrapePath: '/metrics',\n  defaultHttpMetricsFilter: ({ method, status, routerName, path }) =\u003e true,\n  defaultLabels: { ... },\n};\n```\n\n- `timeout`: metrics pull timeout\n- `scrapePort`: the port to scrape metrics from\n- `scrapePath`: the path to scrape metrics from\n- `defaultLabels`: static labels may be applied to every metric emitted by a registry\n- `defaultHttpMetricsFilter`: can custom filter default http metrics, return false can prevent metrics\n\n## Default Metrics\n\n- `http_response_time_ms summary`: ms to handle a request\n- `http_request_rate counter`: number of requests to a route\n\nwhile egg-rpc-base is enabled\n\n- `rpc_consumer_response_time_ms summary`: ms of rpc time consuming\n- `rpc_consumer_request_rate counter`: number of rpc calls\n- `rpc_consumer_fail_response_time_ms summary`: ms of fail rpc time consuming\n- `rpc_consumer_request_fail_rate counter`: number of fail rpc calls\n- `rpc_consumer_request_size_bytes summary`: rpc request size in bytes\n- `rpc_consumer_response_size_bytes summary`: rpc response size in bytes\n- `rpc_provider_response_time_ms summary`: ms of request processed time\n- `rpc_provider_request_rate counter`: number of rpc calls\n- `rpc_provider_fail_response_time_ms summary`: ms of fail request processed time\n- `rpc_provider_request_fail_rate counter`: number of fail rpc calls\n\n## Custom Metrics\n\n```js\n// Here's an example senario:\n// Some metric called 'pv' stands for 'page view'\n// We are going to know its total count.\n// To ensure that we know the pv of each visit source\n// We define a label called from.\nconst counter = new app.prometheus.Counter({\n  name: \"pv_total\",\n  help: \"custom counter\",\n  labelNames: [\"from\"],\n});\n// To use the from label, we do as the following.\ncounter.labels(['google_com']).inc();\ncounter.labels(['facebook_com']).inc();\n\n// Gauge\nconst gauge = new app.prometheus.Gauge({\n  name: \"xxx_gauge\",\n  help: \"custom gauge\",\n  labelNames: [\"xxx\"],\n});\n\n// Histogram\nconst histogram = new app.prometheus.Histogram({\n  name: \"xxx_histogram\",\n  help: \"custom histogram\",\n  labelNames: [\"xxx\"],\n});\n\n// Summary\nconst summary = new app.prometheus.Summary({\n  name: \"xxx_summary\",\n  help: \"custom summary\",\n  labelNames: [\"xxx\"],\n});\n```\n\n## How to Contribute\n\nPlease let us know how can we help. Do check out [issues](https://github.com/eggjs/egg/issues) for bug reports or suggestions first.\n\nTo become a contributor, please follow our [contributing guide](https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n\n\u003c!-- GITCONTRIBUTOR_START --\u003e\n\n## Contributors\n\n|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1207064?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003egxcsoccer\u003c/b\u003e\u003c/sub\u003e](https://github.com/gxcsoccer)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1619030?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003exujihui1985\u003c/b\u003e\u003c/sub\u003e](https://github.com/xujihui1985)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/360661?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003epopomore\u003c/b\u003e\u003c/sub\u003e](https://github.com/popomore)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/2972143?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003enightink\u003c/b\u003e\u003c/sub\u003e](https://github.com/nightink)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/7581901?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003esjfkai\u003c/b\u003e\u003c/sub\u003e](https://github.com/sjfkai)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/26036163?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003ejgchenu\u003c/b\u003e\u003c/sub\u003e](https://github.com/jgchenu)\u003cbr/\u003e|\n| :---: | :---: | :---: | :---: | :---: | :---: |\n\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Fri Dec 15 2023 17:58:23 GMT+0800`.\n\n\u003c!-- GITCONTRIBUTOR_END --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-prometheus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-prometheus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-prometheus/lists"}