Remove gRPC dependencies from metric and log OTLP HTTP exporters #9499
<!-- pull-request-dashboard-status -->
<!-- pull-request-dashboard-status-revision:24 -->
Pull request dashboard status
Merged · refreshed 2026-11-27 13:40 UTC
<details>
<summary>Status above doesn't look right?</summary>
<br>
</details>
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 90.0%. Comparing base (
beb960d) to head (c2111db).:warning: Report is 1 commits behind head on main.
<details><summary>Additional details and impacted files</summary>

@@ Coverage Diff @@
## main #9499 +/- ##
=====================================
Coverage 90.0% 90.0%
=====================================
Files 360 360
Lines 24732 24667 -65
=====================================
- Hits 22261 22211 -50
+ Misses 2471 2456 -15
| Files with missing lines | Coverage Δ | |
|---|---|---|
| exporters/otlp/otlplog/otlploghttp/client.go | 92.6% <ø> (+0.5%) | :arrow_up: |
| ...otlp/otlplog/otlploghttp/internal/transform/log.go | 98.3% <ø> (ø) | |
| exporters/otlp/otlpmetric/otlpmetrichttp/client.go | 91.8% <ø> (-0.6%) | :arrow_down: |
| ...porters/otlp/otlpmetric/otlpmetrichttp/exporter.go | 90.9% <ø> (ø) | |
| ...otlpmetric/otlpmetrichttp/internal/observ/count.go | 100.0% <ø> (ø) | |
| .../otlpmetrichttp/internal/observ/instrumentation.go | 100.0% <ø> (ø) | |
| ...tlpmetric/otlpmetrichttp/internal/oconf/options.go | 90.7% <100.0%> (-4.8%) | :arrow_down: |
| ...otlpmetric/otlpmetrichttp/internal/otest/client.go | 98.6% <ø> (ø) | |
| ...pmetric/otlpmetrichttp/internal/otest/collector.go | 79.8% <ø> (+12.6%) | :arrow_up: |
| ...ric/otlpmetrichttp/internal/transform/attribute.go | 97.6% <ø> (ø) | |
| ... and 2 more | |
... and 7 files with indirect coverage changes
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
<!-- ccr-overview-v2 -->
🟢 Approval recommended
No active review issues require further changes before approval.
No open issues 🎉
<sub>Review effort: Balanced</sub>
Would it make sense to add a depguard rule in .golangci.yml for otlpmetrichttp and otlploghttp so CI catches any accidental re-import of google.golang.org/grpc or go.opentelemetry.io/proto/otlp?
Could we use {{- if .isHTTP }} / {{- else }} for the TLS assertions in internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl (similar to WithTLSClientConfig in options.go.tmpl) so gotmpl outputs valid indentation directly without needing gofmt -w here?
Approved these changes.
Added in 49a61247f. The otlphttp depguard rule covers source and test files, including nested packages, in both HTTP exporters. It rejects gRPC, grpc-gateway, and canonical OTLP protobuf imports and directs users to the slim protobuf package. The repository's existing generated-file exclusion still applies.
Verified forbidden-import fixtures from both module directories, allowed slim imports, and a gRPC exporter control. make precommit passes.
Done in 49a61247f. The five TLS assertions now use {{- if .isHTTP }} / {{- else }} branches, and the extra gofmt generation directive is removed.
Verified that raw gotmpl output for both HTTP and gRPC is already gofmt-clean and byte-identical to the checked-in files. make precommit passes.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@open-telemetry/go-approvers PTAL
<!-- ccr-overview-v2 -->
🟢 Approval recommended
No active review issues remain for the change removing gRPC dependencies from the metric and log HTTP exporters.
No open issues 🎉
<sub>Review effort: Balanced</sub>
Approved these changes.
<!-- ccr-overview-v2 -->
🟢 Approval recommended
No active review issues block the metric and log HTTP exporter dependency cleanup.
No open issues 🎉
<sub>Review effort: Balanced</sub>
dashpole
pellared
The
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttpandgo.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttpmodules currently pull ingoogle.golang.org/grpcandgithub.com/grpc-ecosystem/grpc-gateway/v2. Replacego.opentelemetry.io/proto/otlpwithgo.opentelemetry.io/proto/slim/otlp v1.11.1to remove those dependencies from their module graphs and compiled dependencies.The slim release includes the descriptor coexistence fix from open-telemetry/opentelemetry-proto-go#707. These HTTP exporters can coexist with exporters backed by
go.opentelemetry.io/proto/otlpwithout a protobuf registration panic.Partially addresses #2579. The
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttpmodule remains unchanged: its v1 client/exporter API exposes types fromgo.opentelemetry.io/proto/otlp, so removing that dependency requires a new major API or a separate module.Shared transformation and collector templates accept a protobuf import root with
go.opentelemetry.io/proto/otlpas the default. Metric HTTP generation also omits unusedgoogle.golang.org/grpcconfiguration and its corresponding test collector. Public metric/log HTTP APIs, TLS cloning, and transport behavior are preserved. Generated output forgo.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpcandgo.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpcremains unchanged.Compatibility
opentelemetry-proto-go#707 documents a deliberate v1 compatibility exception in
go.opentelemetry.io/proto/slim/otlpto fix descriptor-registration collisions. Public exporter Go APIs, OTLP wire encoding, and ordinary ProtoJSON mappings remain compatible.opentelemetry.proto.slim.*, and source descriptor paths useopentelemetry/proto/slim/.... These identities differ from bothgo.opentelemetry.io/proto/otlpand oldergo.opentelemetry.io/proto/slim/otlpreleases. Custom integrations using reflection,proto.MessageName, global registry lookups, or service full names must account for the distinct namespace. The HTTP endpoints remain unchanged.google.protobuf.Anyenvelopes containing slim messages use different type URLs. Stored envelopes or custom resolvers tied to the previous identities may need migration. Core OTLP schemas do not embedgoogle.protobuf.Any, so ordinary exported telemetry does not acquire these type URLs.go.opentelemetry.io/proto/slim/otlpandgo.opentelemetry.io/proto/otlpare distinct, despite compatible serialization. Both HTTP exporters' public APIs use SDK data rather than these protobuf types, so the internal type substitution does not change their signatures.Ordinary exporter users do not need to add
go.opentelemetry.io/proto/otlp. A specific exception is code that looks up original OTLP protobuf names in the global registry and relied on these HTTP exporters to register them indirectly. An explicit import of the relevantgo.opentelemetry.io/proto/otlpmessage package restores those entries. Applications already importing the relevant packages need no changes. This workaround can retaingoogle.golang.org/grpcandgithub.com/grpc-ecosystem/grpc-gateway/v2in the application's dependency graph.Validation
make precommitpasses, including repository-wide linting, module checks, generation, and race-enabled tests.make generateruns produce identical output; formatting during precommit leaves that output unchanged.go mod why -m google.golang.org/grpc github.com/grpc-ecosystem/grpc-gateway/v2reports that neither HTTP module needs either dependency.google.golang.org/grpc,github.com/grpc-ecosystem/grpc-gateway/v2, andgo.opentelemetry.io/proto/otlpfrom module graphs and compiled test dependencies. A separate consumer imports all six existing OTLP exporters and race-tests populated metric/log requests with gzip and decoders/responses fromgo.opentelemetry.io/proto/otlp.benchstat. Transform bytes/allocations are unchanged. Timing results are included below; HTTP benchmark timings include local transport overhead.Manual verification code is included below for reproducibility and is not added to the repository. The Makefile and CI workflows remain unchanged.
<details>
<summary>Self-contained manual verification script</summary>
Run from the repository checkout with a Go toolchain that supports the race detector. Save the script below as
/tmp/verify_otlp_http_dependencies.sh, then execute:The script generates both Go consumer tests in temporary directories, supplies local module replacements, and removes temporary files on exit.
</details>
<details>
<summary>Metric benchmark comparison (benchstat)</summary>
Run in
exporters/otlp/otlpmetric/otlpmetrichttpbefore and after the change:</details>
<details>
<summary>Log benchmark comparison (benchstat)</summary>
Run in
exporters/otlp/otlplog/otlploghttpbefore and after the change:</details>