Sha256: 073fd505a680de07da187d713e89bc03c422b40aaa33543a174c1a650639388a
Contents?: true
Size: 1.58 KB
Versions: 4
Compression:
Stored size: 1.58 KB
Contents
# typed: true require 'datadog/core/metrics/ext' require 'datadog/core/environment/ext' require 'datadog/core/environment/identity' module Datadog module Core module Metrics # For defining and adding default options to metrics module Options DEFAULT = { tags: DEFAULT_TAGS = [ "#{Ext::TAG_LANG}:#{Environment::Identity.lang}".freeze, "#{Ext::TAG_LANG_INTERPRETER}:#{Environment::Identity.lang_interpreter}".freeze, "#{Ext::TAG_LANG_VERSION}:#{Environment::Identity.lang_version}".freeze, "#{Ext::TAG_TRACER_VERSION}:#{Environment::Identity.tracer_version}".freeze ].freeze }.freeze def metric_options(options = nil) return default_metric_options if options.nil? default_metric_options.merge(options) do |key, old_value, new_value| case key when :tags old_value.dup.concat(new_value).uniq else new_value end end end def default_metric_options # Return dupes, so that the constant isn't modified, # and defaults are unfrozen for mutation in Statsd. DEFAULT.dup.tap do |options| options[:tags] = options[:tags].dup env = Datadog.configuration.env options[:tags] << "#{Environment::Ext::TAG_ENV}:#{env}" unless env.nil? version = Datadog.configuration.version options[:tags] << "#{Environment::Ext::TAG_VERSION}:#{version}" unless version.nil? end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems