internal/telemetry: add gRPC transport for OTLP trace export#33941
Merged
Conversation
fjl
requested changes
Mar 3, 2026
| } | ||
| if u.Scheme == "grpc" { | ||
| opts = append(opts, otlptracegrpc.WithInsecure()) | ||
| } |
Contributor
There was a problem hiding this comment.
The path is ignored here? Is it meaningful for GRPC?
Member
Author
There was a problem hiding this comment.
No, gRPC derives its HTTP/2 path from the protobuf service definition (/opentelemetry.proto.collector.trace.v1.TraceService/Export) there's no user-facing path option in otlptracegrpc. Added a validation error in the follow-up commit that rejects gRPC URLs with a path component.
gballet
reviewed
Mar 3, 2026
Member
Author
jrhea
previously approved these changes
Mar 3, 2026
Contributor
There was a problem hiding this comment.
very nice. i tested it locally and I can confirm that the HTTP transport still works with http://localhost:4318
rjl493456442
previously approved these changes
Mar 5, 2026
The OTLP specification defines two transports: HTTP (port 4318) and gRPC (port 4317). The existing exporter setup only supports HTTP/HTTPS schemes. This adds gRPC support via URL scheme dispatch: - grpc://host:port → plaintext gRPC - grpcs://host:port → TLS-secured gRPC Many observability backends (Jaeger, Tempo, Datadog) prefer gRPC for its lower overhead. Both otlptracehttp and otlptracegrpc return the same *otlptrace.Exporter type, so only the exporter construction changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract auth header construction before the switch to avoid duplication between HTTP and gRPC cases. - Return an error if a URL path is provided with a gRPC endpoint, since gRPC uses service/method routing rather than URL paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1d97a12 to
b6897d3
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8f1fc90 to
81f8aaa
Compare
Member
Author
|
@jrhea bump on this. Do I need to do anything else? |
jrhea
approved these changes
Apr 15, 2026
Contributor
jrhea
left a comment
There was a problem hiding this comment.
I just tested it again in dev mode and still seems fine.
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.
Summary
grpc://andgrpcs://URL scheme support for OTLP trace export alongside existinghttp:///https://otlptracehttpandotlptracegrpcreturn*otlptrace.Exporter, so only exporter construction changes — everything downstream (batch processor, tracer provider, lifecycle) is untouchedExample usage
Test plan
go build ./...compilesgo vet ./internal/telemetry/...passesgrpc://localhost:4317, verify traces arrivehttp://localhost:4318ftp://still returns error🤖 Generated with Claude Code