{"id":15405752,"url":"https://github.com/davydovanton/sidekiq-statistic","last_synced_at":"2025-05-14T18:05:36.091Z","repository":{"id":28121288,"uuid":"31620292","full_name":"davydovanton/sidekiq-statistic","owner":"davydovanton","description":"See statistic about your workers","archived":false,"fork":false,"pushed_at":"2023-12-01T18:55:58.000Z","size":925,"stargazers_count":797,"open_issues_count":22,"forks_count":83,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-06T05:03:36.888Z","etag":null,"topics":["ruby","sidekiq","statistic-inside-middleware"],"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/davydovanton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-03-03T20:42:33.000Z","updated_at":"2025-04-26T15:36:23.000Z","dependencies_parsed_at":"2024-01-13T11:57:53.931Z","dependency_job_id":"5c4a1be8-bf61-4c58-a4c1-6b9d5c75fda3","html_url":"https://github.com/davydovanton/sidekiq-statistic","commit_stats":null,"previous_names":["davydovanton/sidekiq-history"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davydovanton%2Fsidekiq-statistic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davydovanton%2Fsidekiq-statistic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davydovanton%2Fsidekiq-statistic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davydovanton%2Fsidekiq-statistic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davydovanton","download_url":"https://codeload.github.com/davydovanton/sidekiq-statistic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198514,"owners_count":22030965,"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":["ruby","sidekiq","statistic-inside-middleware"],"created_at":"2024-10-01T16:18:29.750Z","updated_at":"2025-05-14T18:05:31.083Z","avatar_url":"https://github.com/davydovanton.png","language":"Ruby","funding_links":[],"categories":["Background Job"],"sub_categories":[],"readme":"\n# Sidekiq::Statistic\n\n[![Build Status](https://travis-ci.org/davydovanton/sidekiq-statistic.svg)](https://travis-ci.org/davydovanton/sidekiq-statistic) [![Code Climate](https://codeclimate.com/github/davydovanton/sidekiq-history/badges/gpa.svg)](https://codeclimate.com/github/davydovanton/sidekiq-history) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/davydovanton/sidekiq-history?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\nImproved display of statistics for your Sidekiq workers and jobs.\n\n## Screenshots\n\n### Index page:\n![sidekiq-history_index](https://user-images.githubusercontent.com/15057257/66249364-74645d80-e708-11e9-8f06-a9a224be4e37.png)\n\n### Worker page with table (per day):\n![sidekiq-history_worker](https://cloud.githubusercontent.com/assets/1147484/8071171/1706924a-0f10-11e5-9ddc-8aeeb7f5c794.png)\n\n## Installation\nAdd this line to your application's Gemfile:\n\n    gem 'sidekiq-statistic'\n\nAnd then execute:\n\n    $ bundle\n\n## Usage\n\n### Using Rails\n\nRead [Sidekiq documentation](https://github.com/mperham/sidekiq/wiki/Monitoring#rails) to configure Sidekiq Web UI in your `routes.rb`.\n\nWhen Sidekiq Web UI is active you're going be able to see the option `Statistic` on the menu.\n\n### Using a standalone application\n\nRead [Sidekiq documentation](https://github.com/mperham/sidekiq/wiki/Monitoring#standalone) to configure Sidekiq in your Rack server.\n\nNext add `require 'sidekiq-statistic'` to your `config.ru`.\n\n``` ruby\n# config.ru\nrequire 'sidekiq/web'\nrequire 'sidekiq-statistic'\n\nuse Rack::Session::Cookie, secret: 'some unique secret string here'\nrun Sidekiq::Web\n```\n\n## Configuration\n\nThe Statistic configuration is an initializer that GEM uses to configure itself. The option `max_timelist_length`\nis used to avoid memory leak, in practice, whenever the cache size reaches that number, the GEM is going\nto remove 25% of the key values, avoiding inflating memory.\n\n``` ruby\nSidekiq::Statistic.configure do |config|\n  config.max_timelist_length = 250_000\nend\n```\n\n## Supported Sidekiq versions\n\nStatistic support the following Sidekiq versions:\n\n-   Sidekiq 6.\n-   Sidekiq 5.\n-   Sidekiq 4.\n-   Sidekiq 3.5.\n\n## JSON API\n### /api/statistic.json\nReturns statistic for each worker.\n\nParams:\n  * `dateFrom` - Date start (format: `yyyy-mm-dd`)\n  * `dateTo` - Date end (format: `yyyy-mm-dd`)\n\nExample:\n```\n$ curl http://example.com/sidekiq/api/statistic.json?dateFrom=2015-07-30\u0026dateTo=2015-07-31\n\n# =\u003e\n  {\n    \"workers\": [\n      {\n        \"name\": \"Worker\",\n        \"last_job_status\": \"passed\",\n        \"number_of_calls\": {\n          \"success\": 1,\n          \"failure\": 0,\n          \"total\": 1\n        },\n        \"runtime\": {\n          \"last\": \"2015-07-31 10:42:13 UTC\",\n          \"max\": 4.002,\n          \"min\": 4.002,\n          \"average\": 4.002,\n          \"total\": 4.002\n        }\n      },\n\n      ...\n    ]\n  }\n```\n\n### /api/statistic/:worker_name.json\nReturns worker statistic for each day in range.\n\nParams:\n  * `dateFrom` - Date start (format: `yyyy-mm-dd`)\n  * `dateTo` - Date end (format: `yyyy-mm-dd`)\n\nExample:\n```\n$ curl http://example.com/sidekiq/api/statistic/Worker.json?dateFrom=2015-07-30\u0026dateTo=2015-07-31\n\n# =\u003e\n{\n  \"days\": [\n    {\n      \"date\": \"2015-07-31\",\n      \"failure\": 0,\n      \"success\": 1,\n      \"total\": 1,\n      \"last_job_status\": \"passed\",\n      \"runtime\": {\n        \"last\": null,\n        \"max\": 0,\n        \"min\": 0,\n        \"average\": 0,\n        \"total\": 0\n      }\n    },\n\n    ...\n  ]\n}\n```\n\n## Update statistic inside middleware\nYou can update your worker statistic inside middleware. For this you should to update `sidekiq:statistic` redis hash.\nThis hash has the following structure:\n* `sidekiq:statistic` - redis hash with all statistic\n  - `yyyy-mm-dd:WorkerName:passed` - count of passed jobs for Worker name on yyyy-mm-dd\n  - `yyyy-mm-dd:WorkerName:failed` - count of failed jobs for Worker name on yyyy-mm-dd\n  - `yyyy-mm-dd:WorkerName:last_job_status` - string with status (`passed` or `failed`) for last job\n  - `yyyy-mm-dd:WorkerName:last_time` - date of last job performing\n  - `yyyy-mm-dd:WorkerName:queue` - name of job queue (`default` by default)\n\nFor time information you should push the runtime value to `yyyy-mm-dd:WorkerName:timeslist` redis list.\n\n## How it works\n\u003cdetails\u003e\n \u003csummary\u003eBig image 'how it works'\u003c/summary\u003e\n    \n ![how-it-works](https://cloud.githubusercontent.com/assets/1147484/8802272/fc0a1302-2fc8-11e5-86a5-817409259338.png)\n\n\u003c/details\u003e\n\n## Contributing\n1. Fork it ( https://github.com/davydovanton/sidekiq-statistic/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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavydovanton%2Fsidekiq-statistic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavydovanton%2Fsidekiq-statistic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavydovanton%2Fsidekiq-statistic/lists"}