-
Notifications
You must be signed in to change notification settings - Fork 11
Pro Metrics
Sidekiq Pro can send runtime metrics to Statsd for distribution. Set up a global metrics handler and add the middleware to track job execution.
require 'datadog/statsd' # gem 'dogstatsd-ruby'
# Be careful here. I've found that when using UDP, Statsd can perform a DNS lookup
# on this hostname for every single packet. This can lead to mysterious but severe
# performance issues.
#
# You might consider installing a local caching DNS resolver instead (e.g. dnsmasq)
# or performing the DNS resolution once, here in the initializer.
#
Sidekiq::Pro.dogstatsd = ->{ Datadog::Statsd.new("metrics.example.com", 8125) }
Sidekiq.configure_server do |config|
config.server_middleware do |chain|
require 'sidekiq/middleware/server/statsd'
chain.add Sidekiq::Middleware::Server::Statsd
end
end
Other metrics systems will have ingesters for importing Statsd metric data into their native format:
Sidekiq Pro will send the following metrics for each job:
jobs.count => counter
jobs.success => counter
jobs.failure => counter
jobs.perform => gauge (time)
i.e. count
will always be incremented. success
or failure
will be incremented based on the outcome. perform
tracks the amount of time (in milliseconds) spent in the worker. Your Statsd system may provide additional metrics based on these explicit ones..
Sidekiq Pro sends several tags with each metric. Some Statsd platforms will accept these tags and allow you to visualize/report the perform
metrics based on these additional dimensions:
tags: ["worker:VideoEncodeWorker", "queue:bulk"]
Several other metrics are sent for various Pro and Enterprise features:
jobs.expired - when a job is expired
jobs.recovered.push - when a job is recovered by reliable_push after network outage
jobs.recovered.fetch - when a job is recovered by super_fetch after process crash
jobs.poison - when a poison pill job is detected and killed by super_fetch
batch.created - when a batch is created
batch.complete - when a batch is completed
batch.success - when a batch is successful
Home | The Basics | Best Practices | Using Redis | Error Handling | Advanced Options | Problems?
This wiki is tracked by git and publicly editable. You are welcome to fix errors and typos. Any defacing or vandalism of content will result in your changes being reverted and you being blocked.