module OpenTelemetry::Instrumentation::Dalli::Patches::Server

Module to prepend to Dalli::Server for instrumentation

Public Instance Methods

request(op, *args) click to toggle source
Calls superclass method
# File lib/opentelemetry/instrumentation/dalli/patches/server.rb, line 13
def request(op, *args)
  operation = Utils.opname(op, multi?)
  attributes = {
    'db.system' => 'memcached',
    'net.peer.name' => hostname,
    'net.peer.port' => port
  }
  attributes['db.statement'] = Utils.format_command(operation, args) if config[:db_statement] == :include
  attributes['peer.service'] = config[:peer_service] if config[:peer_service]
  tracer.in_span(operation, attributes: attributes, kind: :client) do
    super
  end
end

Private Instance Methods

config() click to toggle source
# File lib/opentelemetry/instrumentation/dalli/patches/server.rb, line 33
def config
  Dalli::Instrumentation.instance.config
end
tracer() click to toggle source
# File lib/opentelemetry/instrumentation/dalli/patches/server.rb, line 29
def tracer
  Dalli::Instrumentation.instance.tracer
end