Skip to content

Commit

Permalink
Add builder metrics initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabianoshz committed Dec 10, 2022
1 parent 194f480 commit 24f379c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions server/events/project_command_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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,
Expand All @@ -74,6 +82,7 @@ func NewInstrumentedProjectCommandBuilder(
logger,
),
Logger: logger,
scope: scope,
}
}

Expand Down Expand Up @@ -317,7 +326,6 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context
commentFlags,
repoDir,
repoCfg.Automerge,
mergedCfg.DeleteSourceBranchOnMerge,
repoCfg.ParallelApply,
repoCfg.ParallelPlan,
verbose,
Expand Down Expand Up @@ -355,7 +363,6 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context
commentFlags,
repoDir,
DefaultAutomergeEnabled,
pCfg.DeleteSourceBranchOnMerge,
DefaultParallelApplyEnabled,
DefaultParallelPlanEnabled,
verbose,
Expand Down Expand Up @@ -689,7 +696,6 @@ func (p *DefaultProjectCommandBuilder) buildProjectCommandCtx(ctx *command.Conte
commentFlags,
repoDir,
automerge,
projCfg.DeleteSourceBranchOnMerge,
parallelApply,
parallelPlan,
verbose,
Expand All @@ -705,7 +711,6 @@ func (p *DefaultProjectCommandBuilder) buildProjectCommandCtx(ctx *command.Conte
commentFlags,
repoDir,
automerge,
projCfg.DeleteSourceBranchOnMerge,
parallelApply,
parallelPlan,
verbose,
Expand Down

0 comments on commit 24f379c

Please sign in to comment.