diff --git a/config/openobserve-queries.yaml b/config/openobserve-queries.yaml index 59f0234..2152003 100644 --- a/config/openobserve-queries.yaml +++ b/config/openobserve-queries.yaml @@ -43,6 +43,23 @@ queries: GROUP BY operation_name ORDER BY operation_name + - id: eligibility-to-start-by-job + title: Exact eligible-to-runner-start duration by job + stream: fleet_traces + search_type: traces + parameters: [] + sql: >- + SELECT queue_job_uuid, github_workflow_run_id, github_job_name, + queue_repository, queue_scale_set, queue_priority, + SUM(duration) AS eligibility_to_start_us, + MIN(_timestamp) AS first_eligible_at + FROM "fleet_traces" + WHERE operation_name IN ('queue.queued', 'queue.assigned', + 'queue.acquiring', 'queue.acquired') + GROUP BY queue_job_uuid, github_workflow_run_id, github_job_name, + queue_repository, queue_scale_set, queue_priority + ORDER BY eligibility_to_start_us DESC + - id: member-provisioning-summary title: Provider provisioning by Incus member stream: fleet_traces @@ -65,6 +82,7 @@ dashboards: visualization: table - query: queue-phase-summary visualization: table + - query: eligibility-to-start-by-job + visualization: table - query: member-provisioning-summary visualization: table - diff --git a/internal/observabilityrules/queries_test.go b/internal/observabilityrules/queries_test.go index 01b1a95..6489773 100644 --- a/internal/observabilityrules/queries_test.go +++ b/internal/observabilityrules/queries_test.go @@ -59,6 +59,19 @@ func TestOpenObserveQueryContractIsPortableAndComplete(t *testing.T) { } } text := string(raw) + for _, required := range []string{ + "eligibility-to-start-by-job", + "SUM(duration) AS eligibility_to_start_us", + "github_workflow_run_id", "github_job_name", + "'queue.queued'", "'queue.assigned'", "'queue.acquiring'", "'queue.acquired'", + } { + if !strings.Contains(text, required) { + t.Fatalf("eligibility-to-start query lacks %q", required) + } + } + if strings.Contains(text, "'queue.running'") { + t.Fatal("eligibility-to-start query includes execution time") + } for _, privateIdentity := range []string{"NDDev-it-com", "My-Attention-AI-Inc", "10.110.", "209.38."} { if strings.Contains(text, privateIdentity) { t.Fatalf("public query contract contains private identity %q", privateIdentity) diff --git a/internal/queuephase/emitter.go b/internal/queuephase/emitter.go index d934829..28de570 100644 --- a/internal/queuephase/emitter.go +++ b/internal/queuephase/emitter.go @@ -90,6 +90,7 @@ func emitSpan(ctx context.Context, phase Phase) { attribute.String("queue.scale_set", phase.Intent.ScaleSetName), attribute.Int("queue.priority", phase.Intent.Priority), attribute.Int64("github.workflow_run_id", phase.Intent.WorkflowRunID), + attribute.String("github.job_name", phase.Intent.JobDisplayName), attribute.Int64("github.runner_request_id", phase.Intent.RunnerRequestID), attribute.Int64("github.runner_id", phase.Intent.GitHubRunnerID), attribute.String("runner.name", phase.Intent.RunnerName),