Skip to content

[BE] queue time fetch improvelemt #6831

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ WITH selected_data AS (
{granularity:String} = 'month', 1440,
1
) AS time_divisor,
max(max_queue_time) AS aggr_max_queue_time,
sum(avg_queue_time * total_count) AS weighted_sum,
sum(total_count) AS total_count_sum,
groupArray(histogram) AS al
job_name,
max(max_queue_time) AS max_queue_time,
sum(avg_queue_time * total_count) AS sumi,
sum(total_count) AS count_sum,
groupArray(histogram) AS partial_al
FROM misc.oss_ci_queue_time_histogram
WHERE time > {startTime: DateTime64}
AND time <= {endTime: DateTime64}
Expand All @@ -35,11 +36,24 @@ WITH selected_data AS (
)
AND (
{runnerLabels: Array(String)} = [] OR hasAny(runner_labels, {runnerLabels: Array(String)})
)
GROUP BY truncated_time, job_name, time_divisor
),
final AS (
SELECT
truncated_time,
time_divisor,
max(max_queue_time) AS aggr_max_queue_time,
sum(sumi * count_sum) AS weighted_sum,
sum(count_sum) AS total_count_sum,
groupArray(arrayMap(
i -> arraySum(arrayMap(arr -> arr[i], partial_al)),
range(1, length(partial_al[1]))
)) AS al
FROM selected_data
group by truncated_time, time_divisor
)
GROUP BY truncated_time
)

SELECT
SELECT
aggr_max_queue_time AS max_queue_time,
total_count_sum,
time_divisor,
Expand Down Expand Up @@ -76,5 +90,5 @@ WITH selected_data AS (
arrayEnumerate(arrayMap(i -> arraySum(arrayMap(arr -> arr[i], al)), range(1, length(al[1]))))
)))
) AS p20_index
FROM selected_data
FROM final
ORDER BY time ASC