Skip to content

Instantly share code, notes, and snippets.

@joeyAghion
Created September 6, 2019 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeyAghion/c109ffb6234df6417c1332741e85a0d0 to your computer and use it in GitHub Desktop.
Save joeyAghion/c109ffb6234df6417c1332741e85a0d0 to your computer and use it in GitHub Desktop.
This patch is based on https://github.com/DataDog/dd-trace-rb/pull/798 and can be added (e.g., as a rails initializer) to provide more meaningful trace labels rather than `Sidekiq::Extensions::DelayedClass`.
module Datadog
module Contrib
module Sidekiq
module Tracing
def job_resource(job)
if job['wrapped']
job['wrapped']
elsif job['class'] == 'Sidekiq::Extensions::DelayedClass'
YAML.load(job['args'].first)[0..1].join('.') rescue job['class'] # rubocop:disable Security/YAMLLoad
else
job['class']
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment