-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Metrics
Sidekiq 7.0 introduces a subsystem for gathering job execution times along with a new Metrics tab within the Web UI to explore this data. The data is designed to help you answer a few questions:
- Which type of jobs executed?
- Which type of jobs took the most amount of time to execute?
- How has the performance of Job X changed over the last hour?
- When did any deploys occur during this time?
The Metrics home page shows two lists:
- The top N jobs by execution count
- The top N jobs by total execution time
Each job links to a detail page where you can see the data for the last hour for that job.
The detail page shows fine-grained data per-minute for the given job. Each minute has a histogram of execution times.
Sidekiq provides a simple API so capistrano scripts or similar can mark a deploy. The Metrics graphs will show a vertical line at that point in time so sudden changes can be correlated. If the current directory is a Git repo, here's a simple script which will label mark each deploy with the current git SHA and commit subject (e.g. "d0f12ab3 Add foo to bar"):
require "sidekiq/metrics/deploy"
gitdesc = `git log -1 --format="%h %s"`.strip
Sidekiq::Metrics::Deploy.new.mark(label: gitdesc)The Metrics subsystem is brand new and rough right now. It's ripe for improvement! I am especially interested in high-quality graphs and visualizations in the Web UI. Here's how to contribute:
- Fork and clone the repo:
git clone git@github.com:USERNAME/sidekiq.git bundle && cd myapp && bundleSIDEKIQ_METRICS_BETA=1 bin/rails sSIDEKIQ_METRICS_BETA=1 bundle exec sidekiqbundle exec rake seed_jobs- Open http://localhost:3000/sidekiq/metrics
Refresh the Metrics page over the next few minutes as jobs are performed and metrics data streams into Redis.
The Ruby code is in lib/sidekiq/metrics. The Web UI is in web/views/metrics*.erb.
As time passes, you will need to periodically re-seed the data by re-running the rake task.