Skip to content
Snippets Groups Projects
Commit 3d5e199d authored by John Harris's avatar John Harris
Browse files

feat: remove env tagging, leave to the agent defaults

parent d2941bb2
No related branches found
Tags 1.7.3
No related merge requests found
Pipeline #34906 passed
......@@ -22,7 +22,7 @@ module NexusSemanticLogger
hash[:source] = :rails
level = hash.delete(:level)
hash[:status] = level
hash[:env] = Rails.env
hash[:railsenv] = Rails.env
hash[:service] = @service
hash.delete(:application)
hash.delete(:environment)
......
......@@ -15,13 +15,19 @@ module NexusSemanticLogger
# By default, runtime metrics from the application are sent to the Datadog Agent with DogStatsD on port 8125.
datadog_singleton = DatadogSingleton.instance
datadog_singleton.statsd = Datadog::Statsd.new(ENV['DD_AGENT_HOST'], 8125)
datadog_singleton.tags = ["env:#{Rails.env}", "service:#{service}"]
c.runtime_metrics.statsd = datadog_singleton.statsd
# Configure tags to be sent on all traces and metrics.
# Note that 'env' is NOT sent- that is set as the default on the agent e.g. staging, canary, production.
# It does not necessarily align with the Rails env, and we do not want to double tag the env.
datadog_singleton.tags = ["railsenv:#{Rails.env}", "service:#{service}"]
c.tags = datadog_singleton.tags
# Tracer requires configuration to a datadog agent via DD_AGENT_HOST.
dd_force_tracer_val = ENV.fetch('DD_FORCE_TRACER', false)
dd_force_tracer = dd_force_tracer_val.present? && dd_force_tracer_val.to_s == 'true'
c.tracer(enabled: Rails.env.production? || dd_force_tracer, env: Rails.env)
puts "** dd_force_tracer: #{dd_force_tracer}"
c.tracer(enabled: Rails.env.production? || dd_force_tracer)
end
c.use(:rails, service_name: service)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment