From 24f379cf59776be928bfe54f0d5e5330f3e54a75 Mon Sep 17 00:00:00 2001 From: Fabiano Honorato Date: Sat, 10 Dec 2022 11:01:12 -0300 Subject: [PATCH] Add builder metrics initialization --- server/events/project_command_builder.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/events/project_command_builder.go b/server/events/project_command_builder.go index 63c4c44049..4c84718f06 100644 --- a/server/events/project_command_builder.go +++ b/server/events/project_command_builder.go @@ -11,6 +11,7 @@ import ( "github.com/runatlantis/atlantis/server/core/config/valid" "github.com/runatlantis/atlantis/server/logging" + "github.com/runatlantis/atlantis/server/metrics" "github.com/pkg/errors" @@ -54,6 +55,13 @@ func NewInstrumentedProjectCommandBuilder( scope tally.Scope, logger logging.SimpleLogging, ) *InstrumentedProjectCommandBuilder { + scope = scope.SubScope("builder") + + for _, m := range []string{metrics.ExecutionSuccessMetric, metrics.ExecutionErrorMetric} { + s := scope.Counter(m) + s.Inc(0) + } + return &InstrumentedProjectCommandBuilder{ ProjectCommandBuilder: NewProjectCommandBuilder( policyChecksSupported, @@ -74,6 +82,7 @@ func NewInstrumentedProjectCommandBuilder( logger, ), Logger: logger, + scope: scope, } } @@ -317,7 +326,6 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context commentFlags, repoDir, repoCfg.Automerge, - mergedCfg.DeleteSourceBranchOnMerge, repoCfg.ParallelApply, repoCfg.ParallelPlan, verbose, @@ -355,7 +363,6 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context commentFlags, repoDir, DefaultAutomergeEnabled, - pCfg.DeleteSourceBranchOnMerge, DefaultParallelApplyEnabled, DefaultParallelPlanEnabled, verbose, @@ -689,7 +696,6 @@ func (p *DefaultProjectCommandBuilder) buildProjectCommandCtx(ctx *command.Conte commentFlags, repoDir, automerge, - projCfg.DeleteSourceBranchOnMerge, parallelApply, parallelPlan, verbose, @@ -705,7 +711,6 @@ func (p *DefaultProjectCommandBuilder) buildProjectCommandCtx(ctx *command.Conte commentFlags, repoDir, automerge, - projCfg.DeleteSourceBranchOnMerge, parallelApply, parallelPlan, verbose,