{"id":20407828,"url":"https://github.com/restorando/statue","last_synced_at":"2025-04-12T15:21:44.264Z","repository":{"id":27137972,"uuid":"30606636","full_name":"restorando/statue","owner":"restorando","description":"Easily track application metrics into Statsite","archived":false,"fork":false,"pushed_at":"2018-11-15T15:46:32.000Z","size":48,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-03-26T09:51:14.362Z","etag":null,"topics":["instrumentation","metrics","ruby","sending-metrics","statsd"],"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/restorando.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}},"created_at":"2015-02-10T18:16:31.000Z","updated_at":"2020-10-21T20:15:07.000Z","dependencies_parsed_at":"2022-08-31T20:10:43.816Z","dependency_job_id":null,"html_url":"https://github.com/restorando/statue","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restorando%2Fstatue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restorando%2Fstatue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restorando%2Fstatue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restorando%2Fstatue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/restorando","download_url":"https://codeload.github.com/restorando/statue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586307,"owners_count":21129013,"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":["instrumentation","metrics","ruby","sending-metrics","statsd"],"created_at":"2024-11-15T05:26:26.692Z","updated_at":"2025-04-12T15:21:44.238Z","avatar_url":"https://github.com/restorando.png","language":"Ruby","readme":"# Statue\n\n![Build Status](https://travis-ci.org/restorando/statue.svg?branch=master)\n\n    / ___)(_  _)/ _\\(_  _)/ )( \\(  __)\n    \\___ \\  )( /    \\ )(  ) \\/ ( ) _)\n    (____/ (__)\\_/\\_/(__) \\____/(____)\nRock solid metrics report...\n\nEasily track application metrics into [Statsite](https://github.com/armon/statsite) (Statsd compatible).\n\n## Configuration\n\nThe library has different backends, one to be used for production environment (ie. actually\n sending metrics using the Statsd protocol), and the others for testing or developing.\n\nThe available backends are:\n\n`Statue::UDPBackend` -\u003e this is the one that actually sends metrics to the Statsd.\n\neg.\n```ruby\nStatue.backend = Statue::UDPBackend.new(statsd_host, statsd_port)\n```\n\n`Statue::NullBackend`, this backend discards all metrics (useful for test environment, if you\naren't interested in testing which metrics are sent).\n\n`Statue::CaptureBackend`, this backend collects all metrics (useful for test environment, if you\narent interested in testing which metrics are sent). You can check the metrics with `Statue.backend.captures`\nand reset this array with `Statue.backend.captures.clear` or by setting a new instance before each test.\n\n`Statue::LoggerBackend`, this backend logs the received metrics to a logger (useful for development purposes)\n\neg.\n```ruby\nStatue.backend = Statue::LoggerBackend.new(Rails.logger)\n```\n\n## Usage\n\n### Common measurements\n\n`Statue.report_increment('metric.name')` -\u003e send to Statsd an increment to the counter `metric.name`\n\n`Statue.report_gauge('metric.name', value)` -\u003e send to Statsd the gauge value for `metric.name`\n\n`Statue.report_duration('metric.name') { some_operation } # =\u003e some_operation_result` -\u003e send to Statsd the\nmeasure for the block duration in `metric.name`\n\n`Statue.report_success_or_failure('metric.name') { some_operation } # =\u003e some_operation_result` -\u003e checks the\nresult of the block, if its a `truthy` value, then increments `metric.name.success`, else it increments\n`metric.name.failure`.\n\n### Stopwatch\n\nThe stopwatch provides an easy way to track the duration of a long process with multiple phases.\n\n```ruby\nstopwatch = Statue.stopwatch(\"metric\") # =\u003e Starts tracking time\n\nwhile something do\n  do_something\n  stopwatch.partial # =\u003e reports duration from last partial until now as: \"metric.runtime.partial\"\nend\n\nstopwatch.stop # =\u003e reports duration from start until now as: \"metric.runtime.total\"\n```\n\n### Rack Integration\n\nWe provide a middleware to track basic request metrics, see: Statue::RackStatistics\n\n### Sidekiq Integration\n\nThere's also a middleware for **Sidekiq**, which can easily be added by adding these lines to the initializer:\n\n```ruby\n# config/initializers/sidekiq.rb\n\nSidekiq.configure_server do |config|\n  config.server_middleware do |chain|\n    chain.add Statue::SidekiqStatistics::SidekiqMiddleware\n  end\nend\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/restorando/statue/fork )\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 a new Pull Request\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestorando%2Fstatue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frestorando%2Fstatue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestorando%2Fstatue/lists"}