Skip to content

Simplify opentelemetry-proto: SDK decoupling, gRPC separation #3045

Open

Description

@lalitb

Related issue #2508

This issue proposes a refactor of the opentelemetry-proto crate to improve clarity, reduce unnecessary dependencies, and simplify usage for consumers of just the OTLP types.

🔄 Proposed Changes

1. Decouple opentelemetry-proto from SDK

  • Remove opentelemetry-sdk as a dependency of opentelemetry-proto.
  • Move transform logic (e.g., impl From<Resource> for proto::*) to opentelemetry-otlp, so opentelemetry-proto contains only wire format definitions.

2. Logical Re-exports for Protobuf Types

  • Organize generated Protobuf messages (e.g., LogsData, LogRecord, etc.) under logical module paths like:
    proto::opentelemetry::proto::logs::v1::*
  • This avoids consumers needing to depend directly on the file layout under src/proto/tonic.

3. Isolate gRPC Service Definitions

  • Keep gRPC service definitions (e.g., LogsServiceClient, LogsServiceServer) in the same physical location (src/proto/tonic), but expose them only behind the gen-tonic feature via:
    proto::tonic::opentelemetry::proto::collector::logs::v1::*

4. Rename tonic Folder for Clarity (Optional)

  • To reduce confusion, consider renaming src/proto/tonic to src/proto/generated since it contains both tonic and prost-generated code.
  • Maintain tonic-specific exports in a mod tonic gated by the gen-tonic feature.

5. Remove gen-tonic-messages Feature

  • This flag is no longer needed now that grpcio support has been dropped. All prost-based message generation should be unconditional.

✅ Benefits

  • Consumers can use Protobuf messages (for file/HTTP ingestion) without pulling in tonic or SDK dependencies.
  • Reduces compile times and simplifies the dependency tree.
  • Improves modularity and aligns with crate responsibilities:
    • opentelemetry-proto: types only
    • opentelemetry-otlp: SDK + transform logic
    • gen-tonic: gRPC transport

Activity

  1. scottgerring commented on Dec 5, 2025

    @scottgerring
    Member

    Hey @lalitb what's the go here? I'm trying to work out what we have outstanding to declare otlp stable.

  2. herin049 commented on Oct 5, 2026

    @herin049
    Contributor

    Hey all, are you accepting contributions for this issue? If so, I'd love to contribute.

    For some additional context, I'm one of the maintainers of OpenTelemetry Python and we're currently in the process of implementing OTEP-4719 (Process Context Sharing) (see open-telemetry/opentelemetry-python-contrib#5040). We're using a native Rust extension with PyO3/Maturin for this and were looking to reuse the opentelemetry-proto crate, but opted against it because it has hard dependencies on the entire Rust SDK. We'd benefit greatly from a zero-dependency/minimal Rust crate dedicated to protobuf definitions.

  3. scottgerring commented on Oct 6, 2026

    @scottgerring
    Member

    Per slack, #3512 should cover this ; have rebased on main and re-opened and spoken with @lalitb about how we can move forward!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions