Module: Datadog::Tracing::Contrib::Dalli::Instrumentation::InstanceMethods
- Defined in:
- lib/datadog/tracing/contrib/dalli/instrumentation.rb
Overview
InstanceMethods - implementing instrumentation
Instance Method Summary collapse
Instance Method Details
#request(op, *args) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/datadog/tracing/contrib/dalli/instrumentation.rb', line 21 def request(op, *args) Tracing.trace(Ext::SPAN_COMMAND) do |span| span.resource = op.to_s.upcase span.service = datadog_configuration[:service_name] span.type = Ext::SPAN_TYPE_COMMAND if datadog_configuration[:peer_service] span.set_tag( Tracing::Metadata::Ext::TAG_PEER_SERVICE, datadog_configuration[:peer_service] ) end # Tag original global service name if not used if span.service != Datadog.configuration.service span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service) end span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT) span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT) span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_COMMAND) span.set_tag(Tracing::Metadata::Ext::TAG_PEER_HOSTNAME, hostname) # Set analytics sample rate if Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled]) Contrib::Analytics.set_sample_rate(span, datadog_configuration[:analytics_sample_rate]) end span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_HOST, hostname) span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_PORT, port) span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM) if datadog_configuration[:command_enabled] cmd = Quantize.format_command(op, args) span.set_tag(Ext::TAG_COMMAND, cmd) end Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES) super end end |