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}", "#{Ext::TAG_LANG_INTERPRETER}:#{Environment::Identity.lang_interpreter}", "#{Ext::TAG_LANG_VERSION}:#{Environment::Identity.lang_version}", # TODO: Technically not accurate, if tracing version diverges from datadog gem version # If we extract tracing to its own gem, this needs to be updated. "#{Ext::TAG_TRACER_VERSION}:#{Environment::Identity.gem_datadog_version}" ].freeze }.freeze
Instance Method Summary collapse
Instance Method Details
#default_metric_options ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/datadog/core/metrics/options.rb', line 36 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
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/datadog/core/metrics/options.rb', line 23 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 |