Skip to content

OTLP gRPC/Protobuf export support #87

@miton18

Description

@miton18

Currently, pg_tracing exports spans using OTLP HTTP/JSON protocol via the pg_tracing.otel_endpoint parameter (/v1/traces).

It would be great to add support for OTLP gRPC/Protobuf export as an alternative.
This is the format we use at Clever Cloud for our OpenTelemetry infrastructure, and we'd love to use pg_tracing with our existing collectors.

this can bring:

  • Lower overhead: Protobuf binary encoding is significantly more compact than JSON, reducing network bandwidth usage — especially relevant for high-throughput PostgreSQL instances generating many spans
  • Faster serialization/deserialization: Protobuf parsing is ~5-10x faster than JSON parsing, reducing CPU overhead on both the sender and collector side
  • Streaming support: gRPC enables persistent connections and bidirectional streaming, avoiding the overhead of establishing new HTTP connections for each batch
  • Industry standard: gRPC is the recommended protocol by OpenTelemetry for production environments when performance matters

Suggested implementation
A new GUC parameter like pg_tracing.otel_protocol with values http/json (default, current behavior) and grpc could control the export format. The gRPC endpoint would typically use port 4317 instead of 4318.

Happy to discuss or contribute if there's interest!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions