Skip to content

Commit

Permalink
metrics: Fix Add missing project and command scopes to ProjectCommand…
Browse files Browse the repository at this point in the history
…Runner (runatlantis#3416)

Co-authored-by: nitrocode <[email protected]>
  • Loading branch information
2 people authored and ijames-gc committed Feb 13, 2024
1 parent 92636d1 commit 20952d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/events/instrumented_project_command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 20952d2

Please sign in to comment.