From a3a086eeefbb2b8e71f807505c008c774247373f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Nordstrand?= Date: Fri, 30 Aug 2024 15:22:26 +0200 Subject: [PATCH] Use a notification instead of StatsdDdog directly --- lib/request_queue_time/middleware.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/request_queue_time/middleware.rb b/lib/request_queue_time/middleware.rb index d631c19..4eabec4 100644 --- a/lib/request_queue_time/middleware.rb +++ b/lib/request_queue_time/middleware.rb @@ -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