Skip to content

Commit

Permalink
Use a notification instead of StatsdDdog directly
Browse files Browse the repository at this point in the history
  • Loading branch information
bjonord committed Aug 30, 2024
1 parent bab68cd commit a3a086e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/request_queue_time/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ def call(env)

unless metrics.ignore?
tags = ["request_method:#{env["REQUEST_METHOD"]}"]
if Object.const_defined?(:StatsdDdog)
StatsdDdog.timing("rails.request.queue_time", metrics.queue_time, tags:)
StatsdDdog.timing("rails.request.queue_time.network_time", metrics.network_time, tags:)
end

ActiveSupport::Notifications.instrument("request_queue_time.timings", extra: {
tags: tags,
queue_time: metrics.queue_time,
network_time: metrics.network_time
})

env["request_queue_time"] = metrics.queue_time
env["request_network_time"] = metrics.network_time
Expand Down

0 comments on commit a3a086e

Please sign in to comment.