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
ls-trace-0.2.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.40.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.39.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.38.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.37.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.36.0 lib/ddtrace/contrib/redis/tags.rb
ls-trace-0.1.2 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.35.2 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.35.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.35.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.34.2 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.34.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.34.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.33.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.33.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.32.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.31.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.31.0 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.30.1 lib/ddtrace/contrib/redis/tags.rb
ddtrace-0.30.0 lib/ddtrace/contrib/redis/tags.rb