Pure-Python otlp-proto-grpc (drop protobuf + grpcio) [4/4 RFC] - #5506
Draft
ocelotl wants to merge 5 commits into
Draft
Pure-Python otlp-proto-grpc (drop protobuf + grpcio) [4/4 RFC]#5506ocelotl wants to merge 5 commits into
ocelotl wants to merge 5 commits into
Conversation
Swap the google.protobuf-generated message classes for hand-written pure-Python encoders under opentelemetry._proto, keeping the public opentelemetry.proto.* import namespace via thin re-export shims. Removes the protobuf (and native upb) dependency entirely; only the serialize path used by the OTLP exporters is implemented (plus the empty export-service response decode).
Point the shared OTLP encoders at the pure-Python opentelemetry-proto package. No google.protobuf dependency; public opentelemetry.exporter.otlp.proto.common.* API preserved via re-export shims over the private _proto implementation.
Drop the requests dependency in favour of stdlib urllib.request + ssl for the OTLP/HTTP export, and use the pure-Python protobuf encoders. Removes both the protobuf and requests native/third-party dependencies. The requests.Session credential-provider feature (session= arg and *_CREDENTIAL_PROVIDER env vars, plus the gcp-auth extra) is not carried over, as it is typed to requests.Session.
…no requests) Reinstates the original exporter's pluggable-client capability without a `requests` dependency: - A `urllib.request.OpenerDirector` is now the supported injectable, via the `session` constructor argument or an `opentelemetry_otlp_credential_provider` entry point named by the existing OTEL_PYTHON_EXPORTER_OTLP_HTTP[_TRACES|_METRICS|_LOGS]_CREDENTIAL_PROVIDER environment variables (previously loaded but never wired in). - A `requests.Session` is still accepted for backwards compatibility, detected structurally (never importing `requests`) and routed through its `.post()`; passing one now emits a DeprecationWarning. Its transport errors are normalized to URLError so the retry loop is unchanged. - Default (no injection) builds a stdlib opener from the SSL context, matching prior behavior. `_common` gains `_resolve_client` (the client seam) and `_opener_client` / `_session_client` senders; `_load_session_from_envvar` becomes `_load_provider_from_envvar`. The three HTTP credential-provider docstrings in opentelemetry-sdk are updated to document the OpenerDirector contract and the requests.Session deprecation. Drops the moot pyproto-vs-requests equivalence test and covers the new client-resolution paths.
Drop the grpcio dependency in favour of a pure-Python gRPC-over-HTTP/2 transport (_pygrpc) and the pure-Python protobuf encoders. Removes both the protobuf and grpcio native dependencies from the OTLP/gRPC exporter.
ocelotl
force-pushed
the
pure-python-otlp-4-grpc
branch
from
August 3, 2026 03:13
785406e to
e536536
Compare
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.
What
Replace the
opentelemetry-exporter-otlp-proto-grpctransport with a pure-Python implementation that:protobuf, and_pygrpc) instead ofgrpcio— drops thegrpcionative dependency.Also drops
googleapis-common-protosand thegcp-authoptional extra (arequests.Session-typed credential provider, incompatible with a non-requestsstack).Why drop
grpciogrpciois a large compiled native dependency and one of the most common source-build / wheel-availability pain points in the ecosystem (new Python versions, musl/arm/exotic platforms, version pinning). A pure-Python gRPC-over-HTTP/2 transport removes that native dependency for the OTLP/gRPC exporter.Stacked series (merge in order)
opentelemetry-proto→ pure-Pythonopentelemetry-exporter-otlp-proto-common→ pure-Python backendopentelemetry-exporter-otlp-proto-http→ pure-Python + urllibopentelemetry-exporter-otlp-proto-grpc→ pure-Python gRPC (this PR)Depends on #5503–#5505; diff is cumulative. Isolated per-package diff:
https://github.com/ocelotl/opentelemetry-python/compare/pure-python-otlp-3-http...pure-python-otlp-4-grpcDiscussion points (why this is a draft)
_pygrpc. A hand-written gRPC/HTTP-2 transport is a meaningful surface to own; performance, flow-control, keepalive, and error-mapping vsgrpcioall deserve scrutiny before this could be a default.otlp_proto_grpc) are unchanged. Existing tests need adaptation; CI not expected green while the stack is in flight. See Pure-Python opentelemetry-proto (drop the protobuf dependency) [1/4 RFC] #5503 for the full rationale.Stack (merge in order): #5503 (proto) → #5504 (common) → #5505 (http) → #5506 (grpc)