Skip to content

Commit c79f45e

Browse files
committed
graph is at the end now
1 parent a422514 commit c79f45e

File tree

3 files changed

+12
-36
lines changed

3 files changed

+12
-36
lines changed

provisioner/terraform/executor.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -566,33 +566,6 @@ func (e *executor) apply(
566566
}, nil
567567
}
568568

569-
// stateResources must only be called while the lock is held.
570-
func (e *executor) stateResources(ctx, killCtx context.Context) (*State, error) {
571-
ctx, span := e.server.startTrace(ctx, tracing.FuncName())
572-
defer span.End()
573-
574-
state, err := e.state(ctx, killCtx)
575-
if err != nil {
576-
return nil, err
577-
}
578-
rawGraph, err := e.graph(ctx, killCtx)
579-
if err != nil {
580-
return nil, xerrors.Errorf("get terraform graph: %w", err)
581-
}
582-
converted := &State{}
583-
if state.Values == nil {
584-
return converted, nil
585-
}
586-
587-
converted, err = ConvertState(ctx, []*tfjson.StateModule{
588-
state.Values.RootModule,
589-
}, rawGraph, e.server.logger)
590-
if err != nil {
591-
return nil, err
592-
}
593-
return converted, nil
594-
}
595-
596569
// state must only be called while the lock is held.
597570
func (e *executor) state(ctx, killCtx context.Context) (*tfjson.State, error) {
598571
ctx, span := e.server.startTrace(ctx, tracing.FuncName())

provisioner/terraform/provision.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ func (s *server) Init(
146146
s.logger.Debug(ctx, "ran initialization")
147147

148148
return &proto.InitComplete{
149+
Timings: e.timings.aggregate(),
149150
Modules: modules,
150151
ModuleFiles: moduleFiles,
151152
ModuleFilesHash: nil,
@@ -240,7 +241,9 @@ func (s *server) Graph(
240241
return provisionersdk.GraphError("unknown graph source: %q", request.Source.String())
241242
}
242243

244+
endStage := e.timings.startStage(database.ProvisionerJobTimingStageGraph)
243245
rawGraph, err := e.graph(ctx, killCtx)
246+
endStage(err)
244247
if err != nil {
245248
return provisionersdk.GraphError("generate graph: %s", err)
246249
}

site/src/modules/workspaces/WorkspaceTiming/StagesChart.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,31 +246,31 @@ export const provisioningStages: Stage[] = [
246246
},
247247
},
248248
{
249-
name: "graph",
250-
label: "graph",
249+
name: "apply",
250+
label: "apply",
251251
section: "provisioning",
252252
tooltip: {
253253
title: (
254254
<>
255-
<TooltipTitle>Terraform graph</TooltipTitle>
255+
<TooltipTitle>Terraform apply</TooltipTitle>
256256
<TooltipShortDescription>
257-
List all resources in plan, used to update coderd database.
257+
Execute Terraform plan to create/modify/delete resources into
258+
desired states.
258259
</TooltipShortDescription>
259260
</>
260261
),
261262
},
262263
},
263264
{
264-
name: "apply",
265-
label: "apply",
265+
name: "graph",
266+
label: "graph",
266267
section: "provisioning",
267268
tooltip: {
268269
title: (
269270
<>
270-
<TooltipTitle>Terraform apply</TooltipTitle>
271+
<TooltipTitle>Terraform graph</TooltipTitle>
271272
<TooltipShortDescription>
272-
Execute Terraform plan to create/modify/delete resources into
273-
desired states.
273+
List all resources in plan, used to update coderd database.
274274
</TooltipShortDescription>
275275
</>
276276
),

0 commit comments

Comments
 (0)