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

Commitf651e46

Browse files
committed
chore: add second graph stage to workspace build
Second graph stage should be measured
1 parent80631df commitf651e46

File tree

11 files changed

+47
-15
lines changed

11 files changed

+47
-15
lines changed

‎coderd/database/dump.sql‎

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- Leave the enum as is, dropping enum values is not easily supported.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Currently have 2 graph stages in a workspace build
2+
ALTERTYPE provisioner_job_timing_stage ADD VALUE IF NOT EXISTS'graph_second';

‎coderd/database/models.go‎

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎codersdk/workspacebuilds.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,11 @@ type TimingStage string
218218

219219
const (
220220
// Based on ProvisionerJobTimingStage
221-
TimingStageInitTimingStage="init"
222-
TimingStagePlanTimingStage="plan"
223-
TimingStageGraphTimingStage="graph"
224-
TimingStageApplyTimingStage="apply"
221+
TimingStageInitTimingStage="init"
222+
TimingStagePlanTimingStage="plan"
223+
TimingStageGraphTimingStage="graph"
224+
TimingStageGraphSecondTimingStage="graph_second"
225+
TimingStageApplyTimingStage="apply"
225226
// Based on WorkspaceAgentScriptTimingStage
226227
TimingStageStartTimingStage="start"
227228
TimingStageStopTimingStage="stop"

‎provisioner/terraform/executor.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,9 @@ func (e *executor) apply(
607607
}
608608

609609
// `terraform show` & `terraform graph`
610+
endGraph:=e.timings.startStage(database.ProvisionerJobTimingStageGraphSecond)
610611
state,err:=e.stateResources(ctx,killCtx)
612+
endGraph(err)
611613
iferr!=nil {
612614
returnnil,err
613615
}

‎provisioner/terraform/timings.go‎

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

112-
s.stage=t.stage
112+
// Only set the stage if it hasn't already been set on the span.
113+
// Explicitly set stage takes precedence.
114+
ifs.stage=="" {
115+
s.stage=t.stage
116+
}
113117
ts=dbtime.Time(ts.UTC())
114118

115119
switchs.kind {

‎site/src/api/typesGenerated.ts‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ export type Stage = {
3333
* The name is used to identify the stage.
3434
*/
3535
name:TimingStage;
36+
/**
37+
* The graph stage actually runs twice, the second with another name.
38+
*/
39+
alternativeNames?:TimingStage[];
3640
/**
3741
* The value to display in the stage label. This can differ from the stage
3842
* name to provide more context or clarity.
@@ -247,6 +251,7 @@ export const provisioningStages: Stage[] = [
247251
},
248252
{
249253
name:"graph",
254+
alternativeNames:["graph_second"],
250255
label:"graph",
251256
section:"provisioning",
252257
tooltip:{

‎site/src/modules/workspaces/WorkspaceTiming/WorkspaceTimings.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ export const WorkspaceTimings: FC<WorkspaceTimingsProps> = ({
132132
<StagesChart
133133
timings={stages.map((s)=>{
134134
conststageTimings=timings.filter(
135-
(t)=>t.stage===s.name,
135+
// graph has 2 stages, `graph` and `graph_second`
136+
(t)=>t.stage===s.name||s.alternativeNames?.includes(t.stage),
136137
);
138+
// console.log(s.name, stageTimings)
137139
conststageRange=
138140
stageTimings.length===0
139141
?undefined

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp