Sha256: cd0a48d54179ad296c39cd810948008edaae0f3cc12cc84c27e1928b8cc68f71
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module Dalli module Patches # Module to prepend to Dalli::Server (or Dalli::Protocol::Binary in 3.0+) for instrumentation module Server def request(op, *args) # rubocop:disable Naming/MethodParameterName operation = Utils.opname(op, multi?) attributes = { 'db.system' => 'memcached', 'net.peer.name' => hostname, 'net.peer.port' => port } 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 private def tracer Dalli::Instrumentation.instance.tracer end def config Dalli::Instrumentation.instance.config end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems