-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Pro Metrics
Mike Perham edited this page Mar 29, 2018
·
30 revisions
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'
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
endOther metrics systems will have ingesters for importing Statsd metric data into their native format:
Sidekiq Pro will send the following metrics for a worker named Foo::BarWorker:
jobs.Foo.BarWorker.count => counter
jobs.Foo.BarWorker.success => counter
jobs.Foo.BarWorker.failure => counter
jobs.Foo.BarWorker.perform => gauge (time)
jobs.Foo.BarWorker.perform_count => counter
jobs.Foo.BarWorker.perform_sum => counter
jobs.count => counter
jobs.success => counter
jobs.failure => counter
i.e. count will always be incremented. success or failure will be incremented based on the outcome. perform tracks the amount of time spent in the worker.
Sidekiq Pro sends several tags with each perform 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
batch.created - when a batch is created
batch.complete - when a batch is completed
batch.success - when a batch is successful