Seamless Distributed Tracing for CI Pipelines in Kubernetes
In today's fast-paced development environment, understanding the performance of your CI pipelines is crucial. Distributed tracing provides visibility into the execution of workflows, helping you pinpoint bottlenecks and optimize processes. With the right setup, you can achieve this without ever touching your workflow files, making it easier to maintain and scale your CI/CD practices.
The magic happens with an OpenTelemetry Collector configured to receive GitHub webhook events. When a workflow runs, it triggers both workflow_run and workflow_job events. The collector, equipped with the githubreceiver component, converts these events directly into OTLP spans. Each workflow becomes an outer span, while jobs and steps within those jobs are represented as child spans. This hierarchical structure allows you to trace the execution flow effectively. Key configuration parameters include the webhook endpoint, path, and secret, as well as the OTLP exporter endpoint and authorization headers. For instance, your collector configuration might look like this:
1receivers:
2 github:
3 webhook:
4 endpoint: 0.0.0.0:19418
5 path: /events
6 secret: ${env:GITHUB_WEBHOOK_SECRET}
7 scrapers:
8 scraper:
9 github_org: ${env:GITHUB_ORG}
10
11exporters:
12 otlp:
13 endpoint: ${env:TRACE_BACKEND_ENDPOINT}
14 headers:
15 authorization: ${env:TRACE_BACKEND_API_KEY}
16
17service:
18 pipelines:
19 traces:
20 receivers: [github]
21 exporters: [otlp]In production, be aware of some critical considerations. The collector must be publicly accessible for GitHub to send webhooks, so plan for IP allowlisting or a WAF to secure it. Additionally, setting up an org-level webhook requires admin access, which can be a roadblock if not confirmed early in the process. Lastly, the scrapers block, while seemingly unrelated to tracing, is mandatory for configuration validation, potentially wasting your time if overlooked.
Key takeaways
- →Configure an OpenTelemetry Collector with the GitHub webhook to enable distributed tracing.
- →Understand that `workflow_run` and `workflow_job` events are converted into OTLP spans.
- →Ensure the collector has a publicly reachable endpoint for GitHub webhooks.
- →Plan for IP allowlisting or WAF to secure your collector endpoint.
- →Confirm org admin access early to avoid delays in setting up the webhook.
Why it matters
Implementing distributed tracing in CI pipelines enhances visibility into workflow performance, allowing teams to identify and resolve issues faster, ultimately improving deployment speed and reliability.
Code examples
1receivers:
2 github:
3 webhook:
4 endpoint: 0.0.0.0:19418
5 path: /events
6 secret: ${env:GITHUB_WEBHOOK_SECRET}
7 scrapers:
8 scraper:
9 github_org: ${env:GITHUB_ORG}
10
11exporters:
12 otlp:
13 endpoint: ${env:TRACE_BACKEND_ENDPOINT}
14 headers:
15 authorization: ${env:TRACE_BACKEND_API_KEY}
16
17service:
18 pipelines:
19 traces:
20 receivers: [github]
21 exporters: [otlp]When NOT to use this
The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.
Want the complete reference?
Read official docsIndustry-standard certifications built by the people behind Linux and Kubernetes. Earn the CKA — the gold standard Kubernetes administrator cert. OpsCanary readers get 30% off year-round with code OPSCANARY3.
Get CKA certified →Mastering Observability for AI Agents on Amazon EKS
Observability is crucial for understanding AI agent performance and costs in production. By leveraging LLM call traces and tool call spans, you can gain insights into your agents' behavior. This article dives into practical patterns for implementing observability on Amazon EKS.
Kubernetes on Edge Day: Elevating Distributed Cloud Native Workloads
Kubernetes on Edge Day is back at KubeCon + CloudNativeCon North America 2026, and it’s crucial for engineers working with distributed systems. This event dives deep into observability and security, two pillars that are essential when managing cloud native workloads across various locations.
From 40 Seconds to Under 10: Revolutionizing Incident Detection with OpenTelemetry, Kafka, and Flink
Incident detection can make or break your system's reliability. By leveraging OpenTelemetry, Apache Kafka, and Apache Flink, you can reduce detection times from 40 seconds to under 10. This article dives into the architecture that powers this transformation.
Get the daily digest
One email. 5 articles. Every morning.
No spam. Unsubscribe anytime.