Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit321b8bf

Browse files
committed
chore: measure both terraform graph events
1 parent80631df commit321b8bf

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

‎provisioner/terraform/executor.go‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,21 +333,17 @@ func (e *executor) plan(ctx, killCtx context.Context, env, vars []string, logr l
333333
}
334334

335335
// Capture the duration of the call to `terraform graph`.
336-
graphTimings:=newTimingAggregator(database.ProvisionerJobTimingStageGraph)
337-
graphTimings.ingest(createGraphTimingsEvent(timingGraphStart))
338-
336+
endGraph:=e.timings.startStage(database.ProvisionerJobTimingStageGraph)
339337
state,plan,err:=e.planResources(ctx,killCtx,planfilePath)
338+
endGraph(err)
340339
iferr!=nil {
341-
graphTimings.ingest(createGraphTimingsEvent(timingGraphErrored))
342340
returnnil,xerrors.Errorf("plan resources: %w",err)
343341
}
344342
planJSON,err:=json.Marshal(plan)
345343
iferr!=nil {
346344
returnnil,xerrors.Errorf("marshal plan: %w",err)
347345
}
348346

349-
graphTimings.ingest(createGraphTimingsEvent(timingGraphComplete))
350-
351347
varmoduleFiles []byte
352348
// Skipping modules archiving is useful if the caller does not need it, eg during
353349
// a workspace build. This removes some added costs of sending the modules
@@ -390,7 +386,7 @@ func (e *executor) plan(ctx, killCtx context.Context, env, vars []string, logr l
390386
Parameters:state.Parameters,
391387
Resources:state.Resources,
392388
ExternalAuthProviders:state.ExternalAuthProviders,
393-
Timings:append(e.timings.aggregate(),graphTimings.aggregate()...),
389+
Timings:e.timings.aggregate(),
394390
Presets:state.Presets,
395391
Plan:planJSON,
396392
ResourceReplacements:resReps,
@@ -607,10 +603,13 @@ func (e *executor) apply(
607603
}
608604

609605
// `terraform show` & `terraform graph`
606+
//endGraph := e.timings.startStage(database.ProvisionerJobTimingStageGraph)
610607
state,err:=e.stateResources(ctx,killCtx)
608+
//endGraph(err)
611609
iferr!=nil {
612610
returnnil,err
613611
}
612+
614613
statefilePath:=e.files.StateFilePath()
615614
stateContent,err:=os.ReadFile(statefilePath)
616615
iferr!=nil {

‎provisioner/terraform/timings.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ func (t *timingAggregator) ingest(ts time.Time, s *timingSpan) {
109109
return
110110
}
111111

112-
s.stage=t.stage
112+
ifs.stage!="" {
113+
// Explicitly set stage takes precedence.
114+
s.stage=t.stage
115+
}
113116
ts=dbtime.Time(ts.UTC())
114117

115118
switchs.kind {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp