lib/ddtrace/contrib/sucker_punch/instrumentation.rb in ddtrace-0.16.1 vs lib/ddtrace/contrib/sucker_punch/instrumentation.rb in ddtrace-0.17.0
- old
+ new
@@ -1,6 +1,7 @@
require 'sucker_punch'
+require 'ddtrace/contrib/sucker_punch/ext'
module Datadog
module Contrib
module SuckerPunch
# Defines instrumentation patches for the `sucker_punch` gem
@@ -13,31 +14,31 @@
alias_method :__run_perform_without_datadog, :__run_perform
def __run_perform(*args)
pin = Datadog::Pin.get_from(::SuckerPunch)
pin.tracer.provider.context = Datadog::Context.new
- __with_instrumentation('sucker_punch.perform') do |span|
+ __with_instrumentation(Ext::SPAN_PERFORM) do |span|
span.resource = "PROCESS #{self}"
__run_perform_without_datadog(*args)
end
rescue => e
::SuckerPunch.__exception_handler.call(e, self, args)
end
alias_method :__perform_async, :perform_async
def perform_async(*args)
- __with_instrumentation('sucker_punch.perform_async') do |span|
+ __with_instrumentation(Ext::SPAN_PERFORM_ASYNC) do |span|
span.resource = "ENQUEUE #{self}"
__perform_async(*args)
end
end
alias_method :__perform_in, :perform_in
def perform_in(interval, *args)
- __with_instrumentation('sucker_punch.perform_in') do |span|
+ __with_instrumentation(Ext::SPAN_PERFORM_IN) do |span|
span.resource = "ENQUEUE #{self}"
- span.set_tag('sucker_punch.perform_in', interval)
+ span.set_tag(Ext::TAG_PERFORM_IN, interval)
__perform_in(interval, *args)
end
end
private
@@ -46,10 +47,10 @@
pin = Datadog::Pin.get_from(::SuckerPunch)
pin.tracer.trace(name) do |span|
span.service = pin.service
span.span_type = pin.app_type
- span.set_tag('sucker_punch.queue', to_s)
+ span.set_tag(Ext::TAG_QUEUE, to_s)
yield span
end
end
end
end