Sha256: 72fd98b87e54d5b49bf4c23a941e53d181184e13321623bd818cdb3e334e2769

Contents?: true

Size: 1.05 KB

Versions: 38

Compression:

Stored size: 1.05 KB

Contents

require 'ddtrace/ext/net'
require 'ddtrace/contrib/analytics'
require 'ddtrace/contrib/redis/ext'

module Datadog
  module Contrib
    module Redis
      # Tags handles generic common tags assignment.
      module Tags
        class << self
          def set_common_tags(client, span)
            # Set analytics sample rate
            Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?

            span.set_tag Datadog::Ext::NET::TARGET_HOST, client.host
            span.set_tag Datadog::Ext::NET::TARGET_PORT, client.port
            span.set_tag Ext::TAG_DB, client.db
            span.set_tag Ext::TAG_RAW_COMMAND, span.resource
          end

          private

          def datadog_configuration
            Datadog.configuration[:redis]
          end

          def analytics_enabled?
            Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled])
          end

          def analytics_sample_rate
            datadog_configuration[:analytics_sample_rate]
          end
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
ddtrace-0.29.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.26.1 lib/ddtrace/contrib/redis/tags.rb
ls-trace-0.1.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.29.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.28.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.27.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.26.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.25.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.25.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.24.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.23.3 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.23.2 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.23.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.23.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.22.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.21.2 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.21.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.21.0 lib/ddtrace/contrib/redis/tags.rb