Sha256: 8989f0e321ab718a154e6c1c94879122e77372f1f7e575f6d2fd5964dca5b0c4

Contents?: true

Size: 876 Bytes

Versions: 5

Compression:

Stored size: 876 Bytes

Contents

# frozen_string_literal: true

# Copyright 2020 OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Instrumentation
    module Dalli
      module Patches
        # Module to prepend to Dalli::Server for instrumentation
        module Server
          def request(op, *args)
            operation = Utils.opname(op, multi?)
            attributes = {
              'db.system' => 'memcached',
              'db.statement' => Utils.format_command(operation, args),
              'net.peer.name' => hostname,
              'net.peer.port' => port
            }

            tracer.in_span(operation, attributes: attributes, kind: :client) do
              super
            end
          end

          private

          def tracer
            Dalli::Instrumentation.instance.tracer
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-dalli-0.10.0 lib/opentelemetry/instrumentation/dalli/patches/server.rb
opentelemetry-instrumentation-dalli-0.9.0 lib/opentelemetry/instrumentation/dalli/patches/server.rb
opentelemetry-instrumentation-dalli-0.8.0 lib/opentelemetry/instrumentation/dalli/patches/server.rb
opentelemetry-instrumentation-dalli-0.7.0 lib/opentelemetry/instrumentation/dalli/patches/server.rb
opentelemetry-instrumentation-dalli-0.6.0 lib/opentelemetry/instrumentation/dalli/patches/server.rb