Use build-time Version constant for OTel `service.version` attribute
@renuka-fernando is already working on this.
Since Jun 4, 2026.
- Dominant language
- Go
- Stars
- 71
- Forks
- 111
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 110
Description
Description
The policy-engine sources its OpenTelemetry service.version resource attribute from a config field, tracing.service_version, with a hard-coded fallback of "1.0.0" when empty. As a result, every span carries service.version=1.0.0 regardless of the binary actually deployed (currently 1.1.0). Tracing dashboards (Jaeger, Tempo, Grafana) cannot filter spans by gateway version.
The binary already knows its version. Both gateway-runtime/policy-engine/cmd/policy-engine/main.go and gateway-controller/pkg/version/version.go declare a Version variable that the Dockerfile overrides via -ldflags from the build's VERSION argument. The tracing code never reads it.
A configurable service_version field also lets an operator set a value that does not match the binary, which is a foot-gun with no legitimate use case.
Proposed change:
- In
gateway-runtime/policy-engine/internal/tracing/tracer.go, sourceservice.versionfrom the build-injectedVersionconstant instead ofcfg.TracingConfig.ServiceVersion. - Remove
tracing.service_versionfrom the policy-engine config schema (TracingConfig.ServiceVersion) and from any shippedconfig.toml/config-template.toml. - Apply the same change in the gateway-controller's tracing setup (
gateway-controller/pkg/config/config.gohas the equivalentTracingConfig.ServiceVersionfield).
Acceptance criteria:
- Deploying gateway 1.1.0 produces spans with
service.version=1.1.0automatically, with no config required. tracing.service_versionno longer appears as a config option in either binary.- Spans from different gateway versions can be distinguished in tracing UIs.
Out of scope:
Tracing endpoint, batch settings, sampling rate, and other tracing config remain configurable.
Version
No response
Related Issue
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.