Module: Datadog::Contrib::Dalli::Instrumentation
- Defined in:
- lib/ddtrace/contrib/dalli/instrumentation.rb
Overview
Instruments every interaction with the memcached server
Class Method Summary collapse
Class Method Details
.patch! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ddtrace/contrib/dalli/instrumentation.rb', line 11 def patch! ::Dalli::Server.class_eval do alias_method :__request, :request def request(op, *args) pin = Datadog::Pin.get_from(::Dalli) pin.tracer.trace(Datadog::Contrib::Dalli::NAME) do |span| span.resource = op.to_s.upcase span.service = pin.service span.span_type = pin.app_type span.set_tag(Datadog::Ext::NET::TARGET_HOST, hostname) span.set_tag(Datadog::Ext::NET::TARGET_PORT, port) cmd = Datadog::Contrib::Dalli::Quantize.format_command(op, args) span.set_tag(Datadog::Contrib::Dalli::CMD_TAG, cmd) __request(op, *args) end end end end |