Repository navigation
docs: add runnable OpenTelemetry tracing example - #7110
Merged
Merged
Conversation
Add a self-contained example under examples/internal/cmd/example-otel-tracing that wires stdouttrace, a W3C TraceContext propagator, an otelgrpc-instrumented in-process gRPC backend, and runtime.NewServeMux wrapped in otelhttp.NewHandler. A single HTTP request produces connected HTTP server -> gRPC client -> gRPC server spans that share one trace ID exported to stdout. Rewrite the OpenTelemetry section of the tracing docs to reference the example and clarify that otelhttp and otelgrpc need no custom tracingWrapper middleware, marking the OpenTracing and OpenCensus sections as legacy. Fixes grpc-ecosystem#3212
johanbrandhorst
enabled auto-merge (squash)
July 20, 2026 01:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a runnable OpenTelemetry tracing example demonstrating trace-context propagation through the gateway, and refreshes the tracing docs.
examples/internal/cmd/example-otel-tracing/main.go: instruments the gateway HTTP layer withotelhttpand the gRPC client/server withotelgrpcstats handlers, exporting tostdouttrace. A single incoming HTTP request produces three connected spans (HTTP server → gRPC client → gRPC server) sharing one trace ID.docs/docs/operations/tracing.mdand answers the issue's question directly: withotelhttp+otelgrpc, no custom tracing wrapper is needed. Marked the OpenTracing/OpenCensus sections as legacy.Fixes #3212
Breaking changes
None — additive example + docs only;
runtime/public API untouched. The new OpenTelemetry deps are referenced solely byexamples/internal.go build ./...andgazelle(+ update-repos) produce no diff