{"id":19235539,"url":"https://github.com/wirehead/strapi-plugin-prometheus-metrics","last_synced_at":"2025-04-21T05:32:05.420Z","repository":{"id":52821966,"uuid":"245687369","full_name":"wirehead/strapi-plugin-prometheus-metrics","owner":"wirehead","description":" A Strapi plugin to add Prometheus metrics","archived":false,"fork":false,"pushed_at":"2021-04-18T01:21:42.000Z","size":21,"stargazers_count":12,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T10:03:20.368Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wirehead.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-07T18:49:34.000Z","updated_at":"2024-04-25T09:17:42.000Z","dependencies_parsed_at":"2022-08-17T14:51:50.865Z","dependency_job_id":null,"html_url":"https://github.com/wirehead/strapi-plugin-prometheus-metrics","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wirehead%2Fstrapi-plugin-prometheus-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wirehead%2Fstrapi-plugin-prometheus-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wirehead%2Fstrapi-plugin-prometheus-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wirehead%2Fstrapi-plugin-prometheus-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wirehead","download_url":"https://codeload.github.com/wirehead/strapi-plugin-prometheus-metrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250002270,"owners_count":21359083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-09T16:17:17.174Z","updated_at":"2025-04-21T05:32:05.139Z","avatar_url":"https://github.com/wirehead.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# strapi-plugin-prometheus-metrics\n\n[![CircleCI](https://circleci.com/gh/wirehead/strapi-plugin-prometheus-metrics.svg?style=shield)](https://circleci.com/gh/wirehead/strapi-plugin-prometheus-metrics)[![npm version](https://badge.fury.io/js/strapi-plugin-prometheus-metrics.svg)](https://www.npmjs.com/package/strapi-plugin-prometheus-metrics)[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)[![Contributor Covenant](https://img.shields.io/badge/license-Hippocratic%20OSL%202.0-4baaaa)](https://firstdonoharm.dev/)\n\nAdds Prometheus metrics to a [Strapi](http://strapi.io/) instance using [prometheus-api-metrics](https://github.com/Zooz/prometheus-api-metrics).\n\nAlternatively, it's a good extremely-simple example of how to add koa functionality to strapi.\n\n## Release status\n\nIt's probably usable at this point.\n\n## Installation\n\nUse the package manager [npm](https://https://www.npmjs.com/) to install.\n\n```bash\nnpm i strapi-plugin-prometheus-metrics\n```\n\n## Usage\n\nYou need to set the `settings.prom.enabled` key to true and also set a metrics path in `settings.prom.metricsPath`.\n\nIf your `config/middleware.js` looks something like this:\n\n```javascript\nmodule.exports = {\n  settings: {\n  },\n};\n````\n\nYou would want to add \n\n```javascript\nmodule.exports = {\n  settings: {\n    \"prom\": {\n      \"enabled\": true,\n      \"metricsPath\": \"/metrics\",\n    },\n  },\n};\n```\n\n\n## Configuration:\n\nIf your `config/middleware.js` you can configure keys like this:\n\n```javascript\nmodule.exports = {\n  settings: {\n    \"prom\": {\n      \"enabled\": true,\n      \"metricsPath\": \"/metrics\",\n      \"metricsPrefix\": \"foo\"\n    },\n  },\n};\n```\n\nKeys you can set are:\n\n* `metricsPath` - The URL path the metrics are accessible under.  The default is `/metrics`\n* `defaultMetricsInterval` - The interval that metrics are collected over.  The default is `10000`\n* `durationBuckets` - An array of buckets that the response time is bucketed over, in seconds.  The default is `[0.001, 0.005, 0.015, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5]`\n* `requestSizeBuckets` - An array of buckets that the request size is bucketed over, in bytes.  The default is `[5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000]`\n* `responseSizeBuckets` - An array of buckets that the response size is bucketed over, in bytes.  The default is `[5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000]`\n* `useUniqueHistogramName` - Set this key to use the project name (from the `package.json` file) as a prefix.\n* `metricsPrefix` - Set this key to set a string that will be added with an undescore before the metrics name.\n* `excludeRoutes` - Set this key to exclude routes from collection.\n* `includeQueryParams` - A boolean that indicate if to include query params in route, the query parameters will be sorted in order to eliminate the number of unique labels.\n\n## A few security concerns to think about\n\nGenerally, you want to be running strapi with some sort of front-end process (say Apache HTTPD or nginx), just as a matter of good practice.  If you expose the `/metrics` endpoint to the world, it might leak some amount of information to an attacker.\n\nAlso, if you aren't careful with the includeQueryParams feature, it might leak more information than you intended.\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## Code of conduct\n\nPlease note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.\n\n## License\n\n[Hippocratic Open Source License 2.0](https://firstdonoharm.dev/) see LICENSE.md","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwirehead%2Fstrapi-plugin-prometheus-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwirehead%2Fstrapi-plugin-prometheus-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwirehead%2Fstrapi-plugin-prometheus-metrics/lists"}