From c3b2883aa361a73427d65232b115cba54d762440 Mon Sep 17 00:00:00 2001 From: Jeremy Friesen Date: Mon, 29 Nov 2021 14:53:56 -0500 Subject: [PATCH] Instrumentation: adding tags to data tracing (#15517) * Adding tags to data tracing Prior to this commit, the feed's class was part of the resource. That resulted in a more opaque view of things. With this change, we're adding tags to the view so we should have a better sense of filtering. * Bump for license/cla test --- app/controllers/stories/feeds_controller.rb | 12 ++++++++---- app/controllers/stories_controller.rb | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/controllers/stories/feeds_controller.rb b/app/controllers/stories/feeds_controller.rb index d4781a5cc..cac63353a 100644 --- a/app/controllers/stories/feeds_controller.rb +++ b/app/controllers/stories/feeds_controller.rb @@ -43,8 +43,10 @@ module Stories else Articles::Feeds::LargeForemExperimental.new(user: current_user, page: @page, tag: params[:tag]) end - Datadog.tracer.trace("feed.query", span_type: "db", - resource: "#{self.class}.#{__method__}.#{feed.class.to_s.dasherize}") do + Datadog.tracer.trace("feed.query", + span_type: "db", + resource: "#{self.class}.#{__method__}", + tags: { feed_class: feed.class.to_s.dasherize }) do # Hey, why the to_a you say? Because the # LargeForemExperimental has already done this. But the # weighted strategy has not. I also don't want to alter the @@ -65,8 +67,10 @@ module Stories else Articles::Feeds::LargeForemExperimental.new(user: current_user, page: @page, tag: params[:tag]) end - Datadog.tracer.trace("feed.query", span_type: "db", - resource: "#{self.class}.#{__method__}.#{feed.class.to_s.dasherize}") do + Datadog.tracer.trace("feed.query", + span_type: "db", + resource: "#{self.class}.#{__method__}", + tags: { feed_class: feed.class.to_s.dasherize }) do # Hey, why the to_a you say? Because the # LargeForemExperimental has already done this. But the # weighted strategy has not. I also don't want to alter the diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 3d9182e0d..c71588e73 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -250,8 +250,10 @@ class StoriesController < ApplicationController else Articles::Feeds::LargeForemExperimental.new(page: @page, tag: params[:tag]) end - Datadog.tracer.trace("feed.query", span_type: "db", - resource: "#{self.class}.#{__method__}.#{feed.class.to_s.dasherize}") do + Datadog.tracer.trace("feed.query", + span_type: "db", + resource: "#{self.class}.#{__method__}", + tags: { feed_class: feed.class.to_s.dasherize }) do # Hey, why the to_a you say? Because the # LargeForemExperimental has already done this. But the # weighted strategy has not. I also don't want to alter the