Built-in build stage span instrumentation
Summary
Instrument GitLab Runner to emit child spans for each built-in build stage under the job_execution parent span. This is Phase 2 of Runner instrumentation — builds on the OTLP export client and job_execution span from Phase 1.
Build Stages to Instrument
Each stage becomes a child span of job_execution:
| Span Name | Description |
|---|---|
prepare_executor |
Executor setup (Docker, Kubernetes, etc.) |
pull_image |
Container image pull |
get_sources |
Git clone/fetch |
restore_cache |
Cache download and extraction |
step_script |
Main script execution |
after_script |
After-script execution |
archive_cache |
Cache creation and upload |
upload_artifacts |
Artifact upload |
Metadata to Capture
Each span should include relevant attributes:
-
pull_image:ci.image.name,ci.image.tag,ci.image.pull_policy -
get_sources:ci.git.operation(clone/fetch),ci.git.depth,ci.git.filter -
restore_cache/archive_cache:ci.cache.key,ci.cache.hit(boolean),ci.cache.size_bytes -
upload_artifacts:ci.artifact.name,ci.artifact.type,ci.artifact.size_bytes -
All stages:
ci.stage.status(success/failed), duration via span timing
Requirements
- Create child spans under the
job_executionspan from Phase 1 - Stream spans to the OTEL Collector as each stage completes (not batched at job end)
- Spans must have accurate start/end timestamps
- Failed stages should set span status to
ERRORwith a description
Architecture Reference
Related
- Phase 1 (prerequisite): #39232 (closed), #39231
- Phase 3 (CI Functions): #39271
- Parent epic: &20633
Edited by Pedro Pombeiro