Skip to content

Commit

Permalink
Consolidate dedicated redis tracing (forem#21327)
Browse files Browse the repository at this point in the history
  • Loading branch information
benhalpern authored Oct 14, 2024
1 parent e04390c commit 5511dfb
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions config/initializers/datadog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,8 @@
c.tracing.instrument :http, service_name: unified_service_name
c.tracing.instrument :faraday, service_name: unified_service_name

# Multiple Redis integrations to split Redis usage per-instance to
# accommodate having a different Redis instance for each use case.
c.tracing.instrument :redis, service_name: "#{service_name}-redis-rpush",
describes: { url: ENV.fetch("REDIS_RPUSH_URL", nil) }
c.tracing.instrument :redis, service_name: "#{service_name}-redis-sessions",
describes: { url: ENV.fetch("REDIS_SESSIONS_URL", nil) }
# Sidekiq jobs that spin up thousands of other jobs end up consuming a
# *lot* of memory on instrumentation alone. This env var allows us to
# enable it only when needed.
if ENV["DD_ENABLE_REDIS_SIDEKIQ"] == "true"
c.tracing.instrument :redis, service_name: "#{service_name}-redis-sidekiq",
describes: { url: ENV.fetch("REDIS_SIDEKIQ_URL", nil) }
end
# Generic REDIS_URL comes last, allowing it to overwrite any of the
# above when multiple Redis use cases are backed by the same Redis URL.
c.tracing.instrument :redis, service_name: "#{service_name}-redis", describes: { url: ENV.fetch("REDIS_URL", nil) }
# Instrument all Redis calls (excluding cache) under "#{service_name}-redis"
c.tracing.instrument :redis, service_name: "#{service_name}-redis"
end

ForemStatsClient = Datadog::Statsd.new
ForemStatsClient = Datadog::Statsd.new

0 comments on commit 5511dfb

Please sign in to comment.