From 96cf38835e15cd2822739076bb3c9e540fa76f09 Mon Sep 17 00:00:00 2001 From: Alberto Rojas Date: Mon, 22 May 2023 14:48:31 +0200 Subject: [PATCH] metrics: Fix Add missing project and command scopes to ProjectCommandRunner (#3416) Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> --- server/events/instrumented_project_command_runner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/events/instrumented_project_command_runner.go b/server/events/instrumented_project_command_runner.go index 0f99e49c99..3d44ed8767 100644 --- a/server/events/instrumented_project_command_runner.go +++ b/server/events/instrumented_project_command_runner.go @@ -22,7 +22,7 @@ type InstrumentedProjectCommandRunner struct { func NewInstrumentedProjectCommandRunner(scope tally.Scope, projectCommandRunner ProjectCommandRunner) *InstrumentedProjectCommandRunner { projectTags := command.ProjectScopeTags{} - scope = scope.Tagged(projectTags.Loadtags()) + scope = scope.SubScope("project").Tagged(projectTags.Loadtags()) for _, m := range []string{metrics.ExecutionSuccessMetric, metrics.ExecutionErrorMetric, metrics.ExecutionFailureMetric} { metrics.InitCounter(scope, m) @@ -60,7 +60,7 @@ func (p *InstrumentedProjectCommandRunner) StateRm(ctx command.ProjectContext) c func RunAndEmitStats(commandName string, ctx command.ProjectContext, execute func(ctx command.ProjectContext) command.ProjectResult, scope tally.Scope) command.ProjectResult { // ensures we are differentiating between project level command and overall command - scope = ctx.SetProjectScopeTags(scope) + scope = ctx.SetProjectScopeTags(scope).SubScope(commandName) logger := ctx.Log executionTime := scope.Timer(metrics.ExecutionTimeMetric).Start()