This integration monitors Sidekiq through Dogstatsd. It collects metrics through Datadog's Dogstatsd Ruby client.
Note Only Sidekiq Pro (>= 3.6) or Enterprise (>= 1.1.0) users can collect metrics.
The Sidekiq integration is packaged with the Datadog Agent. No additional installation is needed on your server.
-
Install the
dogstatsd-ruby
gem:gem install dogstatsd-ruby
-
Enable Sidekiq Pro metric collection by including this in your initializer; for a containerized deployment, update
localhost
to your Agent container address:require 'datadog/statsd' # gem 'dogstatsd-ruby' Sidekiq::Pro.dogstatsd = ->{ Datadog::Statsd.new('localhost', 8125, namespace:'sidekiq') } Sidekiq.configure_server do |config| config.server_middleware do |chain| require 'sidekiq/middleware/server/statsd' chain.add Sidekiq::Middleware::Server::Statsd end end
If you are using Sidekiq Enterprise and would like to collect historical metrics, include this line as well:
Sidekiq.configure_server do |config| # history is captured every 30 seconds by default config.retain_history(30) end
See the Sidekiq Pro and Enterprise documentation for more information, and the Dogstatsd Ruby documentation for further configuration options.
-
Update the Datadog Agent main configuration file
datadog.yaml
by adding the following configs:# dogstatsd_mapper_cache_size: 1000 # default to 1000 dogstatsd_mapper_profiles: - name: sidekiq prefix: "sidekiq." mappings: - match: 'sidekiq\.sidekiq\.(.*)' match_type: "regex" name: "sidekiq.$1" - match: 'sidekiq\.jobs\.(.*)\.perform' name: "sidekiq.jobs.perform" match_type: "regex" tags: worker: "$1" - match: 'sidekiq\.jobs\.(.*)\.(count|success|failure)' name: "sidekiq.jobs.worker.$2" match_type: "regex" tags: worker: "$1"
These parameters can also be set by adding the
DD_DOGSTATSD_MAPPER_PROFILES
environment variable to the Datadog Agent.
See metadata.csv for a list of metrics provided by this integration.
The Sidekiq integration also allows custom metrics, see Sidekiq Enterprise Historical Metrics.
-
Collecting logs is disabled by default in the Datadog Agent. Enable it in the
datadog.yaml
file with:logs_enabled: true
-
Add this configuration block to your
sidekiq.d/conf.yaml
file to start collecting your Sidekiq logs:logs: - type: file path: /var/log/sidekiq.log source: sidekiq service: <SERVICE>
Change the
path
andservice
parameter values and configure them for your environment. If you cannot find your logs, see Sidekiq Logging.
Sidekiq does not include any service checks.
Sidekiq does not include any events.
Need help? Contact Datadog support.