{"id":17355178,"url":"https://github.com/zephinzer/ezpromhttp","last_synced_at":"2025-03-27T15:21:55.852Z","repository":{"id":79926639,"uuid":"156563994","full_name":"zephinzer/ezpromhttp","owner":"zephinzer","description":"Convenience middleware for adding of Prometheus HTTP metrics to a server.","archived":false,"fork":false,"pushed_at":"2018-11-07T16:04:10.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T19:14:06.113Z","etag":null,"topics":["golang","instrumentation","metrics","middleware","prometheus"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","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/zephinzer.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-07T15:05:46.000Z","updated_at":"2018-11-07T16:01:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"cbab5cab-1fb7-46fc-a67d-548b9ec076fd","html_url":"https://github.com/zephinzer/ezpromhttp","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"35db4d206cee6a0e296633d9841a96915f365264"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fezpromhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fezpromhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fezpromhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephinzer%2Fezpromhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zephinzer","download_url":"https://codeload.github.com/zephinzer/ezpromhttp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245868335,"owners_count":20685609,"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":["golang","instrumentation","metrics","middleware","prometheus"],"created_at":"2024-10-15T17:42:33.777Z","updated_at":"2025-03-27T15:21:55.816Z","avatar_url":"https://github.com/zephinzer.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Convenience Prometheus HTTP Metrics Middleware for Go\n\n[![Build Status](https://travis-ci.org/zephinzer/ezpromhttp.svg?branch=master)](https://travis-ci.org/zephinzer/ezpromhttp)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/zephinzer/ezpromhttp.svg)](https://github.com/zephinzer/ezpromhttp/releases)\n\nConvenience middleware for adding of Prometheus HTTP metrics to a server that includes path, status, and method labels by default.\n\n\u003e See [this issue](https://github.com/prometheus/client_golang/issues/491) for potential performance issues.\n\n# Scope\nThis middleware automatically adds convenience labels to Prometheus HTTP metrics.\n\nThe following metrics are exposed:\n\n- `http_request_total{method=\"${method}\",path=\"/x/y/z\",status=\"xxx\"}`\n- `http_request_duration_ms{method=\"${method}\",path=\"/x/y/z\",status=\"xxx\"}`\n- `http_response_size_bytes{method=\"${method}\",path=\"/x/y/z\",status=\"xxx\"}`\n- `http_response_codes{status=\"xxx\"}`\n\n`xxx` corresponds to a HTTP status code.\n\n`${method}` corresponds to a HTTP verb such as `get`, `post`, `put`, `delete`, *et cetera*.\n\n\n# Installation\n\n```\ngo get github.com/zephinzer/ezpromhttp\n```\n\n# Usage\n\n## Import It\n\n```go\nimport (\n  \"github.com/prometheus/client_golang/prometheus/promhttp\"\n  // ...\n  \"github.com/zephinzer/ezpromhttp\"\n)\n```\n\n## Summon the Middleware\n\nExpose the Prometheus handler and instrument the main handler.\n\n```go\nfunc main() {\n  // ... assume a main handler named `handler`\n  handler.Handle(\"/metrics\", promhttp.Handler())\n  // ... other setup\n  handler = ezpromhttp.InstrumentHandler(handler)\n  http.ListenAndServe(\"0.0.0.0:8080\", handler)\n}\n```\n\n# License\n\nThis package is licensed under the MIT license. See [the LICENSE file](./LICENSE) for the full text.\n\n# Contributing\n\nYou will need the following software to run the development environment based off [this boilerplate at github.com/zephinzer/goboil](https://github.com/zephinzer/goboil):\n\n- Docker\n- Make\n\nIf you don't have Docker, you'll also need:\n\n- Go\n- Python\n- Dep (Go)\n- Realize (Go)\n\n## Development\n\n### Getting Started in Development\n\nCopy `./sample.properties` into `./Makefile.properties` and set your required values there. These configurations are mostly for production image releasing so you may not need to change anything.\n\n## Testing\n\nAppend a `.local` to run the below on your host machine (`test.local`, `testc.local`, `testw.local`). Note that this may or may not work depending on what you have available on your host machine.\n\n### Standalone Tests\n\nRun `make test` to run the tests once.\n\n### Standalone Tests with Live-Reload\n\nRun `make testw` to run the tests in automated live-reload mode.\n\n\u003e Requires `python` to be installed on your machine. The script is at `./.scripts/auto-run.py` courtesy of GoConvey.\n\n### Standalone Tests with Coverage\n\nRun `make testc` to run the tests once and output the coverage.\n\n## Releasing\n\nTo get the latest version of the application, use `make version.get`.\n\nTo bump the **patch** version, use `make version.bump`\n\nTo bump the **minor** version, use `make version.bump BUMP=minor`\n\nTo bump the **major** version, use `make version.bump BUMP=major`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzephinzer%2Fezpromhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzephinzer%2Fezpromhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzephinzer%2Fezpromhttp/lists"}