Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Register now

Implement trace context initialization in Rails for CI job telemetry

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Collaborate/take over this issue

Summary

Implement trace context initialization in Rails so that all telemetry spans for a CI job share the same trace_id. The trace context is passed to the Runner in the job payload response when job_telemetry is enabled.

Job payload change

Add a trace_context object to the /api/v4/jobs/request response (only when job_telemetry is enabled):

{
  "trace_context": {
    "trace_id": "00000000000000000000000002a6c18e",
    "parent_span_id": "a1b2c3d4e5f60718"
  }
}
Field Type Description
trace_id String (32-char hex) Deterministically derived from job_id. All spans for this job share this trace ID.
parent_span_id String (16-char hex) The span ID of the Rails-created job_lifecycle span (Phase 3). For MVC this is a placeholder root — the Runner's job_execution span becomes the trace root and will be re-parented once Phase 3 adds the Rails job_lifecycle span.

Requirements

  1. Generate trace_id deterministically from job_id (e.g., zero-padded hex representation, or UUID v5)
  2. Generate parent_span_id as a random 16-char hex span ID (placeholder for MVC; becomes the actual job_lifecycle span ID in Phase 3)
  3. Only include trace_context when the job_telemetry feature is enabled (see #590588)

Architecture Reference

  • Job payload changes
  • Multi-source trace context coordination

Dependencies

  • Feature negotiation (#590588) must be implemented first — trace_context is only included when job_telemetry is enabled
  • Coordinate with grouprunner core on job payload schema changes (&20633)

Parent Epic

&20945

Edited Feb 20, 2026 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading