Export job requested tags in CI/CD observability data
What does this MR do and why?
Adds the tags each job requested to the CI/CD observability export, so platform teams can group job queue time by the tag set jobs are waiting on.
Today the export only carries the tags of the runner that ran the job (gitlab.cicd.worker.tags). Jobs that never got a runner (canceled or timed out while pending) have no runner, so their queue time can't be grouped at all. Those are the jobs a runner-capacity "starvation" view needs most.
New job span and job log attributes:
| Attribute | Value |
|---|---|
gitlab.cicd.pipeline.task.tags |
Requested tags, sorted. Empty array for untagged jobs. |
gitlab.cicd.pipeline.task.tag_set |
Sorted tags as a JSON array (for example ["docker","linux"]). Omitted for untagged jobs. JSON keeps a quoted tag that contains a comma distinct from two separate tags. Lets backends that can't group by array attributes group by tag set. |
gitlab.cicd.pipeline.task.untagged |
true when the job requested no tags. |
Bridges get none of these. The attributes are emitted whether or not a runner picked up the job.
Design notes
- Webhook payload unchanged. The tags are merged into the payload in
Ci::Observability::ExportService#with_requested_tags, not inGitlab::DataBuilder::Pipeline, so pipeline webhooks are unaffected. A spec checks this. - Metrics-only exports skip it. The tag lookup only runs when traces or logs are exported.
- No extra queries. Building the payload preloads
pipeline.latest_buildswithjob_definitionon the same pipeline object, andCi::Build#tag_listreads fromjob_definition. AQueryRecorderspec checks that no queries are added. - No feature flag. The change only adds attributes to an existing export, adds no queries, and doesn't change the webhook payload or metrics.
- Semconv namespace only. There's no matching legacy
job.*attribute. The OTel CI/CD semantic conventions have no attribute for requested tags, so these sit undergitlab.cicd.pipeline.task.*next to the existinggitlab.cicd.worker.tags. - Out of scope (see the issue): a per-tag-set queue-time histogram in the metrics export, live pending and running counts per tag set, and exporting the Job Router capability fingerprint.
References
- https://gitlab.com/gitlab-org/embody-team/experimental-observability/documentation/-/work_items/181
- #588769
Screenshots or screen recordings
Not applicable. No UI changes.
How to set up and validate locally
- Set up a group with observability enabled and a project that sets
GITLAB_OBSERVABILITY_EXPORT: traces,logs. - Run a pipeline with one job that has
tags: [docker, linux]and one job without tags. - In GitLab Observability, open the pipeline trace and check the job spans:
- The tagged job has
gitlab.cicd.pipeline.task.tags=[docker, linux],gitlab.cicd.pipeline.task.tag_set=["docker","linux"], andgitlab.cicd.pipeline.task.untagged=false. - The untagged job has
gitlab.cicd.pipeline.task.untagged=trueand notag_set.
- The tagged job has
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.