Module: Datadog::Tracing::Contrib::ActiveRecord::Events::Instantiation
- Defined in:
- lib/datadog/tracing/contrib/active_record/events/instantiation.rb
Overview
Defines instrumentation for instantiation.active_record event
Constant Summary collapse
- EVENT_NAME =
'instantiation.active_record'
Class Method Summary collapse
- .event_name ⇒ Object
- .on_start(span, event, _id, payload) ⇒ Object
- .span_name ⇒ Object
- .supported? ⇒ Boolean
Methods included from Datadog::Tracing::Contrib::ActiveRecord::Event
Class Method Details
.event_name ⇒ Object
27 28 29 |
# File 'lib/datadog/tracing/contrib/active_record/events/instantiation.rb', line 27 def event_name self::EVENT_NAME end |
.on_start(span, event, _id, payload) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/datadog/tracing/contrib/active_record/events/instantiation.rb', line 35 def on_start(span, event, _id, payload) span.resource = payload.fetch(:class_name) span.type = Ext::SPAN_TYPE_INSTANTIATION span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT) span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_INSTANTIATION) # Set analytics sample rate if Contrib::Analytics.enabled?(configuration[:analytics_enabled]) Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate]) end # Measure service stats Contrib::Analytics.set_measured(span) span.set_tag(Ext::TAG_INSTANTIATION_CLASS_NAME, payload.fetch(:class_name)) span.set_tag(Ext::TAG_INSTANTIATION_RECORD_COUNT, payload.fetch(:record_count)) rescue StandardError => e Datadog.logger.error(e.) Datadog::Core::Telemetry::Logger.report(e) end |
.span_name ⇒ Object
31 32 33 |
# File 'lib/datadog/tracing/contrib/active_record/events/instantiation.rb', line 31 def span_name Ext::SPAN_INSTANTIATION end |
.supported? ⇒ Boolean
22 23 24 25 |
# File 'lib/datadog/tracing/contrib/active_record/events/instantiation.rb', line 22 def supported? Gem.loaded_specs['activerecord'] \ && Gem.loaded_specs['activerecord'].version >= Gem::Version.new('4.2') end |