Module: Datadog::Core::Metrics::Options
Overview
For defining and adding default options to metrics
Constant Summary collapse
- 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
Instance Method Summary collapse
Instance Method Details
#default_metric_options ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/datadog/core/metrics/options.rb', line 32 def # Return dupes, so that the constant isn't modified, # and defaults are unfrozen for mutation in Statsd. DEFAULT.dup.tap do || [:tags] = [:tags].dup env = Datadog.configuration.env [:tags] << "#{Environment::Ext::TAG_ENV}:#{env}" unless env.nil? version = Datadog.configuration.version [:tags] << "#{Environment::Ext::TAG_VERSION}:#{version}" unless version.nil? end end |
#metric_options(options = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/datadog/core/metrics/options.rb', line 19 def ( = nil) return if .nil? .merge() do |key, old_value, new_value| case key when :tags old_value.dup.concat(new_value).uniq else new_value end end end |