Answer the question
In order to leave comments, you need to log in
Why aren't metrics sent from Resque tasks?
The situation is such that metrics are sent at the start of the application, but not from tasks.
Trial metric:
DATADOG_CLIENT.increment('bbb', by: 1, tags: ['step:foo'])
app_boot.count
is visible on the Datadog charts. unless Rails.env.test? || ENV['DISABLE_DATADOG'].present?
require 'datadog/statsd'
if Rails.env.development?
Datadog.configure do |c|
c.use :rails, service_name: "#{`whoami`}-rails-app"
end
else
Datadog.configure do |c|
c.use :rails, service_name: "#{Rails.env}-rails-app"
c.use :resque, { service_name: 'resque' }
end
end
# Create a DogStatsD client instance.
DATADOG_CLIENT = Datadog::Statsd.new('localhost', 8125)
DATADOG_CLIENT.increment('app_boot.count', tags: ["env:#{Rails.env}"])
at_exit do
# release resources used by the client instance
DATADOG_CLIENT.close()
end
end
Answer the question
In order to leave comments, you need to log in
The gem developer advised:
1. update dogstatsd-ruby to version 5.3.0
2. add the optionsingle_thread: true
DATADOG_CLIENT = Datadog::Statsd.new('localhost', 8125, single_thread: true)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question