diff --git a/lib/ddtrace/contrib/racecar/events.rb b/lib/ddtrace/contrib/racecar/events.rb index f9abc604d3..a0a18e4255 100644 --- a/lib/ddtrace/contrib/racecar/events.rb +++ b/lib/ddtrace/contrib/racecar/events.rb @@ -1,5 +1,6 @@ require 'ddtrace/contrib/racecar/events/batch' require 'ddtrace/contrib/racecar/events/message' +require 'ddtrace/contrib/racecar/events/consume' module Datadog module Contrib @@ -7,6 +8,7 @@ module Racecar # Defines collection of instrumented Racecar events module Events ALL = [ + Events::Consume, Events::Batch, Events::Message ].freeze diff --git a/lib/ddtrace/contrib/racecar/events/consume.rb b/lib/ddtrace/contrib/racecar/events/consume.rb new file mode 100644 index 0000000000..b488ca3eb2 --- /dev/null +++ b/lib/ddtrace/contrib/racecar/events/consume.rb @@ -0,0 +1,27 @@ +require 'ddtrace/contrib/racecar/ext' +require 'ddtrace/contrib/racecar/event' + +module Datadog + module Contrib + module Racecar + module Events + # Defines instrumentation for main_loop.racecar event + module Consume + include Racecar::Event + + EVENT_NAME = 'main_loop.racecar'.freeze + + module_function + + def event_name + self::EVENT_NAME + end + + def span_name + Ext::SPAN_CONSUME + end + end + end + end + end +end diff --git a/lib/ddtrace/contrib/racecar/ext.rb b/lib/ddtrace/contrib/racecar/ext.rb index 81f2a3a36b..44d6f6f451 100644 --- a/lib/ddtrace/contrib/racecar/ext.rb +++ b/lib/ddtrace/contrib/racecar/ext.rb @@ -10,6 +10,7 @@ module Ext ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_RACECAR_ANALYTICS_SAMPLE_RATE'.freeze ENV_ANALYTICS_SAMPLE_RATE_OLD = 'DD_RACECAR_ANALYTICS_SAMPLE_RATE'.freeze SERVICE_NAME = 'racecar'.freeze + SPAN_CONSUME = 'racecar.consume'.freeze SPAN_BATCH = 'racecar.batch'.freeze SPAN_MESSAGE = 'racecar.message'.freeze TAG_CONSUMER = 'kafka.consumer'.freeze