apache / apache/airflow

Propagate OpenTelemetry context to Go SDK tasks

Open
#70,165 0 comments 0 reactions 0 assignees View on GitHub
area:core kind:feature needs-triage
Dominant language
Python
Stars
46.9k
Forks
17.8k
Avg merge
2d 9h
Merged PRs (30d)
472

Description

### Description

Go SDK tasks executed through the bundle gRPC path do not receive the task instance's OpenTelemetry context carrier. This breaks trace continuity at the Go task boundary, even though the bundle protobuf schema already provides an ``otel_context`` field.

### Use case/motivation

Teams instrumenting Go SDK tasks and their downstream API calls need those spans to continue the trace created for the Airflow task instance. Without the remote parent context, Go task spans begin unrelated traces, making an end-to-end task execution difficult to observe and diagnose.

The expected behaviour is that the bundle gRPC client forwards string-valued carrier entries, the bundle server reconstructs the carrier, and the Go task extracts the W3C Trace Context into its ``context.Context``. Task instrumentation and downstream calls can then inherit the remote parent span. Non-string carrier values should be ignored, consistently with Airflow's Python tracing path.

### Related issues

https://github.com/apache/airflow/blob/1e7e525b00ea8f4b1fa26d9d6337807c28c51129/go-sdk/bundle/bundlev1/bundlev1client/grpc.go#L92-L101

https://github.com/apache/airflow/blob/1e7e525b00ea8f4b1fa26d9d6337807c28c51129/go-sdk/bundle/bundlev1/bundlev1server/impl/plugin.go#L142-L152

### Are you willing to submit a PR?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Research direction

Start with go-sdk/bundle/bundlev1/bundlev1client/grpc.go and go-sdk/bundle/bundlev1/bundlev1server/impl/plugin.go, following the existing otel_context field through the bundle gRPC path. Check how the Python tracing path handles non-string carrier values and how the Go task extracts W3C Trace Context into context.Context. Done means string carriers reach Go task instrumentation and downstream calls, while non-string values are ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
api, backend, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
63/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.