Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add queuedDurationSec for job #1304

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bigquery_schema/workflow_report.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@
"name": "executorName",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "queuedDurationSec",
"type": "FLOAT",
"mode": "NULLABLE"
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion proto/workflow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ message PbJobReport {
string executorClass = 12;
string executorType = 13;
string executorName = 14;
float queuedDurationSec = 15;
}

message PbStepReport {
Expand All @@ -85,4 +86,4 @@ message PbWorkflowParams {
string workflowRunId = 2;
int32 buildNumber = 3;
string workflowName = 4;
}
}
2 changes: 2 additions & 0 deletions src/analyzer/bitrise_analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type JobReport = {
executorClass: string; // "standard"
executorType: string; // osx-vs4mac-stable
executorName: ""; // Bitrise does not support self-hosted runner
queuedDurationSec: 0; // BitriseAnalyzer does not support job queued duration yet
};

type StepReport = {
Expand Down Expand Up @@ -134,6 +135,7 @@ export class BitriseAnalyzer implements Analyzer {
executorClass: build.machine_type_id,
executorType: build.stack_identifier,
executorName: "",
queuedDurationSec: 0, // Not supported yet
},
],
startedAt,
Expand Down
2 changes: 2 additions & 0 deletions src/analyzer/circleci_analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export type JobReport = {
executorClass: ""; // CircleCIAnalyzer(v1) does not support
executorType: ""; // CircleCIAnalyzer(v1) does not support
executorName: ""; // CircleCIAnalyzer(v1) does not support
queuedDurationSec: 0; // CircleciAnalyzer(v1) does not support
};

type StepReport = {
Expand Down Expand Up @@ -142,6 +143,7 @@ export class CircleciAnalyzer implements Analyzer {
executorClass: "",
executorType: "",
executorName: "",
queuedDurationSec: 0, // Not supported yet
};
});

Expand Down
2 changes: 2 additions & 0 deletions src/analyzer/circleci_analyzer_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type JobReport = {
executorClass: string; // medium
executorType: string; // docker
executorName: ""; // CircleCI does not support self-hosted runner
queuedDurationSec: 0; // CircleciAnalyzerV2 does not support job queued duration yet
};

type StepReport = {
Expand Down Expand Up @@ -139,6 +140,7 @@ export class CircleciAnalyzerV2 implements Analyzer {
executorClass: job.detail.executor.resource_class,
executorType: job.detail.executor.type,
executorName: "",
queuedDurationSec: 0, // Not supported yet
};
});

Expand Down
7 changes: 5 additions & 2 deletions src/analyzer/github_analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type WorkflowReport = {
sumJobsDurationSec: number; // = sum(jobs sumStepsDurationSec)
successCount: 0 | 1; // = 'SUCCESS': 1, others: 0
parameters: []; // GithubAnalyzer does not support build parameters yet
queuedDurationSec: number; // createdAt - startedAt
queuedDurationSec: number; // workflow createdAt - workflow startedAt
commitMessage: string;
actor: string; // Kenta Kase
url: string; // https://github.com/{org}/{repo}/actions/runs/{runId}
Expand All @@ -57,6 +57,7 @@ type JobReport = {
executorClass: ""; // Github Actions does not provide about class of executor
executorType: ""; // Github Actions does not provde about type of executor
executorName: string; // self-hosted runner name
queuedDurationSec: number; // job createdAt - job startedAt
};

type StepReport = {
Expand Down Expand Up @@ -109,6 +110,7 @@ export class GithubAnalyzer implements Analyzer {

const startedAt = new Date(job.started_at);
const completedAt = new Date(job.completed_at!);
const createdAt = new Date(job.created_at);
// job
return {
workflowRunId: workflowRunId,
Expand All @@ -125,6 +127,7 @@ export class GithubAnalyzer implements Analyzer {
executorClass: "",
executorType: "",
executorName: job.runner_name ?? "",
queuedDurationSec: diffSec(createdAt, startedAt), // job.createdAt - job.startedAt
};
});

Expand Down Expand Up @@ -156,7 +159,7 @@ export class GithubAnalyzer implements Analyzer {
sumJobsDurationSec: sumBy(jobReports, "sumStepsDurationSec"),
successCount: status === "SUCCESS" ? 1 : 0,
parameters: [],
queuedDurationSec: diffSec(createdAt, startedAt),
queuedDurationSec: diffSec(createdAt, startedAt), // workflow.created_at - firstJob.started_at
commitMessage: workflow.head_commit?.message ?? "",
actor: workflow.head_commit?.author?.name ?? "",
url: workflow.html_url,
Expand Down
4 changes: 3 additions & 1 deletion src/analyzer/jenkins_analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ type JobReport = {
url: ""; // Jenkins does not provide each stage url
executorClass: ""; // JenkinsAnalyzer does not support
executorType: ""; // JenkinsAnalyzer does not support
executorName: ""; // JenkinsAnalyzer doen not support
executorName: ""; // JenkinsAnalyzer does not support
queuedDurationSec: 0; // JenkinsAnalyzer does not support job queued duration yet
};

type StepReport = {
Expand Down Expand Up @@ -130,6 +131,7 @@ export class JenkinsAnalyzer implements Analyzer {
executorClass: "",
executorType: "",
executorName: "",
queuedDurationSec: 0, // Not supported yet
};
});

Expand Down
1 change: 1 addition & 0 deletions src/pb_types/workflow.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.