{"id":19723497,"url":"https://github.com/remind101/formatted-metrics","last_synced_at":"2025-04-29T22:30:58.767Z","repository":{"id":9797185,"uuid":"11774762","full_name":"remind101/formatted-metrics","owner":"remind101","description":"Easily produce metrics for consumption by l2met.","archived":false,"fork":false,"pushed_at":"2019-05-05T22:49:58.000Z","size":74,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":90,"default_branch":"master","last_synced_at":"2025-04-05T20:01:43.504Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/remind101.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":"2013-07-30T20:22:49.000Z","updated_at":"2019-07-19T19:27:15.000Z","dependencies_parsed_at":"2022-08-29T20:20:28.784Z","dependency_job_id":null,"html_url":"https://github.com/remind101/formatted-metrics","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remind101%2Fformatted-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remind101%2Fformatted-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remind101%2Fformatted-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remind101%2Fformatted-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remind101","download_url":"https://codeload.github.com/remind101/formatted-metrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251592952,"owners_count":21614448,"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-11T23:22:24.042Z","updated_at":"2025-04-29T22:30:58.173Z","avatar_url":"https://github.com/remind101.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Formatted Metrics\n\n[![Build Status](https://travis-ci.org/remind101/formatted-metrics.png)](https://travis-ci.org/remind101/formatted-metrics) [![Code Climate](https://codeclimate.com/github/remind101/formatted-metrics.png)](https://codeclimate.com/github/remind101/formatted-metrics)\n\nEasily produce metrics that can be consumed by [l2met](https://github.com/ryandotsmith/l2met) or statsd.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'formatted-metrics'\n```\n\n## Usage\n\n### Rack\n\nIf you want to instrument rack request times:\n\n```\nuse Rack::Instrumentation\n```\n\n### Instrument\n\nUse `Metrics.instrument` to instrument events to STDOUT.\n\n```ruby\nMetrics.instrument 'rack.request' do\n  @app.call(env)\nend\n# =\u003e 'source=app measure.rack.request=50ms'\n\nMetrics.instrument 'workers.busy', 10, units: 'workers'\n# =\u003e 'source=app measure.workers.busy=10workers'\n\nMetrics.instrument 'sidekiq.queue', source: 'background' do\n  yield\nend\n# =\u003e 'source=app.background measure.sidekiq.queue=500ms'\n\nMetrics.group 'sidekiq' do |group|\n  group.instrument 'queues.process', 100, units: 'jobs'\n  group.instrument 'workers.busy', 10, units: 'workers'\n\n  group.instrument 'queue.time', source: 'worker.1' do\n    sleep 1\n  end\nend\n\n# =\u003e 'source=app measure.sidekiq.queues.processed=100jobs measure.sidekiq.workers.busy=10workers'\n# =\u003e 'source=app.worker.1 measure.sidekiq.queue.time=1000.00ms'\n```\n\n## TODO\n\n* Add Rack middleware for outputting rack performance metrics.\n* Instrument some default rails stuff.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremind101%2Fformatted-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremind101%2Fformatted-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremind101%2Fformatted-metrics/lists"}