{"id":13879589,"url":"https://github.com/yabeda-rb/yabeda-http_requests","last_synced_at":"2025-04-13T19:04:28.067Z","repository":{"id":54884554,"uuid":"247882060","full_name":"yabeda-rb/yabeda-http_requests","owner":"yabeda-rb","description":"Buildin metrics for monitor external HTTP requests","archived":false,"fork":false,"pushed_at":"2023-12-14T06:06:14.000Z","size":1224,"stargazers_count":18,"open_issues_count":2,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-08T05:46:46.425Z","etag":null,"topics":["external-api","metrics","monitoring","ruby","yabeda"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/yabeda-rb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2020-03-17T04:51:43.000Z","updated_at":"2024-10-27T21:44:46.000Z","dependencies_parsed_at":"2023-12-14T06:41:50.771Z","dependency_job_id":null,"html_url":"https://github.com/yabeda-rb/yabeda-http_requests","commit_stats":{"total_commits":33,"total_committers":5,"mean_commits":6.6,"dds":"0.33333333333333337","last_synced_commit":"1da5f8cdd2989b5b1657e4458fb8c888089bf361"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yabeda-rb%2Fyabeda-http_requests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yabeda-rb%2Fyabeda-http_requests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yabeda-rb%2Fyabeda-http_requests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yabeda-rb%2Fyabeda-http_requests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yabeda-rb","download_url":"https://codeload.github.com/yabeda-rb/yabeda-http_requests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245819671,"owners_count":20677699,"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":["external-api","metrics","monitoring","ruby","yabeda"],"created_at":"2024-08-06T08:02:26.063Z","updated_at":"2025-03-29T11:30:54.601Z","avatar_url":"https://github.com/yabeda-rb.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"\u003ca href=\"https://amplifr.com/?utm_source=yabeda-http_requests\"\u003e\n  \u003cimg width=\"100\" height=\"140\" align=\"right\"\n    alt=\"Sponsored by Amplifr\" src=\"https://amplifr-direct.s3-eu-west-1.amazonaws.com/social_images/image/37b580d9-3668-4005-8d5a-137de3a3e77c.png\" /\u003e\n\u003c/a\u003e\n\n# ![Yabeda::HttpRequests](./yabeda-http_requests-logo.png)\n\nBuilt-in metrics for external services HTTP calls! This gem is a Part of the [yabeda](https://github.com/yabeda-rb/yabeda) suite.\n\nRead [introduction article on dev.to](https://dev.to/dsalahutdinov/monitoring-external-services-with-prometheus-and-grafana-5eh6).\n\n## Metrics\n\nWorks as the Puma plugin and provides following metrics:\n - `http_request_total` - the number of external HTTP request attempts (by host, port, method)\n - `http_response_total` - the number of made external HTTP requeusts (by host, port, method, status)\n - `http_response_duration` - the histogram of response duration (by host, port, method, status)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'yabeda-http_requests'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install yabeda-http_requests\n\n## Usage\n\nAfter plugin the gem, you just have to set up metrics exporting with [yabeda-prometheus](https://github.com/yabeda-rb/yabeda-prometheus) gem.\n\nThe metrics page will look like this:\n\n```\n# TYPE http_requests_total_count counter\n# HELP http_requests_total_count A counter of the total number of external HTTP requests.\nhttp_request_total{host=\"twitter.com\",port=\"443\",method=\"GET\",query=\"/dsalahutdinov1\"} 149.0\nhttp_request_total{host=\"dev.to\",port=\"443\",method=\"GET\",query=\"/amplifr\"} 145.0\n...\n```\n\nTo simple set up Grafana, try the [sample dashboard](https://github.com/yabeda-rb/yabeda-http_requests/blob/master/example/grafana/provisioning/dashboards/yabeda-http_requests.json).\n\n## Sample application\n\nSample application aims to show how Ruby web-application, this gem and Prometheus/Grafana work togather.\nGet into `example` directory and run docker compose:\n\n```sh\n$ cd example\n$ docker-compose up\n```\n\nAfter docker image builds and all the services get up, you can browse application endpoints:\n - Ruby web-application runs on [http://localhost:9292/](http://localhost:9292/). Everytime you request page, it schedules random web-scrapping job into sidekiq.\n - Sidekiq exposes prometheus metrics on [http://localhost:9394/metrics](http://localhost:9394/metrics). This endpoint is scrapped by prometheus exporter every 5 seconds.\n - Grafana runs on [http://localhost:3000/](http://localhost:3000/). Use `admin/foobar` as login and password to get in. Grafana already has specific dashboard with data visualisation.\n\nFollow the [yabeda-external-http-requests](http://localhost:3000/d/OGd-oEXWz/yabeda-external-http-requests?orgId=1\u0026refresh=5s) dashboard in Grafana.\nFinally, after a couple of minutes when data collected you will see the following:\n![Monitor external HTTP calls with Grafana](docs/dashboard.png)\n\n## Development with Docker\n\nGet local development environment working and tests running is very easy with docker-compose:\n```bash\ndocker-compose run app bundle\ndocker-compose run app bundle exec rspec\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-http_requests.\n\n### Releasing\n\n1. Bump version number in `lib/yabeda/http_requests/version.rb`\n\n   In case of pre-releases keep in mind [rubygems/rubygems#3086](https://github.com/rubygems/rubygems/issues/3086) and check version with command like `Gem::Version.new(Yabeda::VERSION).to_s`\n\n2. Fill `CHANGELOG.md` with missing changes, add header with version and date.\n\n3. Make a commit:\n\n   ```sh\n   git add lib/yabeda/http_requests/version.rb CHANGELOG.md\n   version=$(ruby -r ./lib/yabeda/http_requests/version.rb -e \"puts Gem::Version.new(Yabeda::HttpRequests::VERSION)\")\n   git commit --message=\"${version}: \" --edit\n   ```\n\n4. Create annotated tag:\n\n   ```sh\n   git tag v${version} --annotate --message=\"${version}: \" --edit --sign\n   ```\n\n5. Fill version name into subject line and (optionally) some description (list of changes will be taken from changelog and appended automatically)\n\n6. Push it:\n\n   ```sh\n   git push --follow-tags\n   ```\n\n7. GitHub Actions will create a new release, build and push gem into RubyGems! You're done!\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyabeda-rb%2Fyabeda-http_requests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyabeda-rb%2Fyabeda-http_requests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyabeda-rb%2Fyabeda-http_requests/lists"}