lib/opentelemetry/instrumentation/dalli/patches/server.rb in opentelemetry-instrumentation-dalli-0.19.1 vs lib/opentelemetry/instrumentation/dalli/patches/server.rb in opentelemetry-instrumentation-dalli-0.20.0
- old
+ new
@@ -6,19 +6,24 @@
module OpenTelemetry
module Instrumentation
module Dalli
module Patches
- # Module to prepend to Dalli::Server for instrumentation
+ # Module to prepend to Dalli::Server (or Dalli::Protocol::Binary in 3.0+) for instrumentation
module Server
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
+ if config[:db_statement] == :include
+ attributes['db.statement'] = Utils.format_command(operation, args)
+ elsif config[:db_statement] == :obfuscate
+ attributes['db.statement'] = "#{operation} ?"
+ end
+
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
tracer.in_span(operation, attributes: attributes, kind: :client) do
super
end
end