{"id":13879085,"url":"https://github.com/yabeda-rb/yabeda-sidekiq","last_synced_at":"2025-05-15T11:07:48.874Z","repository":{"id":50337569,"uuid":"151414168","full_name":"yabeda-rb/yabeda-sidekiq","owner":"yabeda-rb","description":"Yabeda plugin for complete monitoring of Sidekiq","archived":false,"fork":false,"pushed_at":"2025-02-05T11:52:13.000Z","size":80,"stargazers_count":131,"open_issues_count":9,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T10:12:13.615Z","etag":null,"topics":["metrics","monitoring","sidekiq","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":"2018-10-03T13:07:56.000Z","updated_at":"2025-04-02T13:12:44.000Z","dependencies_parsed_at":"2024-03-07T14:41:30.427Z","dependency_job_id":"00259fdf-6b66-4a8c-a9e7-49a2aa71fc2f","html_url":"https://github.com/yabeda-rb/yabeda-sidekiq","commit_stats":{"total_commits":35,"total_committers":8,"mean_commits":4.375,"dds":"0.19999999999999996","last_synced_commit":"8b97eb30d4d46b87ace06be8182846537c3b5bb9"},"previous_names":["evil-metrics/evil-metrics-sidekiq"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yabeda-rb%2Fyabeda-sidekiq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yabeda-rb%2Fyabeda-sidekiq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yabeda-rb%2Fyabeda-sidekiq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yabeda-rb%2Fyabeda-sidekiq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yabeda-rb","download_url":"https://codeload.github.com/yabeda-rb/yabeda-sidekiq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253416591,"owners_count":21905070,"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":["metrics","monitoring","sidekiq","yabeda"],"created_at":"2024-08-06T08:02:09.317Z","updated_at":"2025-05-15T11:07:48.852Z","avatar_url":"https://github.com/yabeda-rb.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# ![Yabeda::Sidekiq](./yabeda-sidekiq-logo.png)\n\nBuilt-in metrics for [Sidekiq] monitoring out of the box! Part of the [yabeda] suite.\n\nSample Grafana dashboard ID: [11667](https://grafana.com/grafana/dashboards/11667)\n\n## Installation\n\n```ruby\ngem 'yabeda-sidekiq'\n# Then add monitoring system adapter, e.g.:\n# gem 'yabeda-prometheus'\n```\n\nAnd then execute:\n\n    $ bundle\n\nIf you're not on Rails then configure Yabeda after your application was initialized:\n\n```ruby\nYabeda.configure!\n```\n\n_If you're using Ruby on Rails then Yabeda will configure itself automatically!_\n\n**And that is it!** Sidekiq metrics are being collected!\n\nAdditionally, depending on your adapter, you may want to setup metrics export. E.g. for [yabeda-prometheus]:\n\n```ruby\n# config/initializers/sidekiq or elsewhere\nSidekiq.configure_server do |_config|\n  Yabeda::Prometheus::Exporter.start_metrics_server!\nend\n```\n\n## Metrics\n\n### Local per-process metrics\n\nMetrics representing state of current Sidekiq worker process and stats of executed or executing jobs:\n\n - Total number of executed jobs: `sidekiq_jobs_executed_total` -  (segmented by queue and class name)\n - Number of jobs have been finished successfully: `sidekiq_jobs_success_total` (segmented by queue and class name)\n - Number of jobs have been failed: `sidekiq_jobs_failed_total` (segmented by queue and class name)\n - Time of job run: `sidekiq_job_runtime` (seconds per job execution, segmented by queue and class name)\n - Time of the job latency `sidekiq_job_latency` (the difference in seconds since the enqueuing until running job)\n - Maximum runtime of currently executing jobs: `sidekiq_running_job_runtime` (useful for detection of hung jobs, segmented by queue and class name)\n\n### Global cluster-wide metrics\n\nMetrics representing state of the whole Sidekiq installation (queues, processes, etc):\n\n - Number of jobs in queues: `sidekiq_jobs_waiting_count` (segmented by queue)\n - Time of the queue latency `sidekiq_queue_latency` (the difference in seconds since the oldest job in the queue was enqueued)\n - Number of scheduled jobs:`sidekiq_jobs_scheduled_count`\n - Number of jobs in retry set: `sidekiq_jobs_retry_count`\n - Number of jobs in dead set (“morgue”): `sidekiq_jobs_dead_count`\n - Active processes count: `sidekiq_active_processes`\n - Active servers count: `sidekiq_active_workers_count`\n\nBy default all sidekiq worker processes (servers) collects global metrics about whole Sidekiq installation. This can be overridden by setting `collect_cluster_metrics` config key to `true` for non-Sidekiq processes or to `false` for Sidekiq processes (e.g. by setting `YABEDA_SIDEKIQ_COLLECT_CLUSTER_METRICS` env variable to `no`, see other methods in [anyway_config] docs).\n\n### Client metrics\n\nMetrics collected where jobs are being pushed to queues (everywhere):\n\n- Total number of enqueued jobs: `sidekiq_jobs_enqueued_total` (segmented by `queue` and `worker` class name)\n\n- Total number of rerouted jobs: `sidekiq_jobs_rerouted_total` (segmented by origin queue `from_queue`, rerouted queue `to_queue`, and `worker` class name).\n\n  Rerouted jobs are jobs that on enqueue were pushed to different queue from the one specified in worker's `sidekiq_options`, most probably by some middleware.\n\n## Custom tags\n\nYou can add additional tags to these metrics by declaring `yabeda_tags` method in your worker.\n\n```ruby\n# This block is optional but some adapters (like Prometheus) requires that all tags should be declared in advance\nYabeda.configure do\n  default_tag :importance, nil\nend\n\nclass MyWorker\n  include Sidekiq::Worker\n\n  def yabeda_tags(*params) # This method will be called first, before +perform+\n    { importance: extract_importance(params) }\n  end\n\n  def perform(*params)\n    # Your logic here\n  end\nend\n```\n\n## Configuration\n\nConfiguration is handled by [anyway_config] gem. With it you can load settings from environment variables (upcased and prefixed with `YABEDA_SIDEKIQ_`), YAML files, and other sources. See [anyway_config] docs for details.\n\n| Config key                                     | Type    | Default                                                 | Description                                                                                                                                        |\n|------------------------------------------------|---------|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `collect_cluster_metrics`                      | boolean | Enabled in Sidekiq worker processes, disabled otherwise | Defines whether this Ruby process should collect and expose metrics representing state of the whole Sidekiq installation (queues, processes, etc). |\n| `declare_process_metrics`                      | boolean | Enabled in Sidekiq worker processes, disabled otherwise | Declare metrics that are only tracked inside worker process even outside of them. Useful for multiprocess metric collection.                       |\n| `retries_segmented_by_queue`                   | boolean | Disabled                                                | Defines wheter retries are segemented by queue or reported as a single metric                                                                      |\n| `label_for_error_class_on_sidekiq_jobs_failed` | boolean | Disabled                                                | Defines whether `error` label should be added to `sidekiq_jobs_failed_total` metric.                                                               |\n\n# Roadmap (TODO or Help wanted)\n\n - Implement optional segmentation of schedule/dead sets\n\n   It should be disabled by default as it requires to iterate over all jobs in sets and may be very slow on large sets.\n\n - Maybe add some hooks for ease of plugging in metrics for myriads of Sidekiq plugins?\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-sidekiq.\n\n### Releasing\n\n1. Bump version number in `lib/yabeda/sidekiq/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::Sidekiq::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/sidekiq/version.rb CHANGELOG.md\n   version=$(ruby -r ./lib/yabeda/sidekiq/version.rb -e \"puts Gem::Version.new(Yabeda::Sidekiq::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\n[Sidekiq]: https://github.com/mperham/sidekiq/ \"Simple, efficient background processing for Ruby\"\n[yabeda]: https://github.com/yabeda-rb/yabeda\n[yabeda-prometheus]: https://github.com/yabeda-rb/yabeda-prometheus\n[anyway_config]: https://github.com/palkan/anyway_config \"Configuration library for Ruby gems and applications\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyabeda-rb%2Fyabeda-sidekiq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyabeda-rb%2Fyabeda-sidekiq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyabeda-rb%2Fyabeda-sidekiq/lists"}