- OTLP over gRPC — the default, streaming-based approach (recommended for production).
- OTLP over HTTP — a request-based alternative often easier to traverse firewalls and HTTP-only gateways.

gRPC (recommended)
For production communication between SDKs and the OpenTelemetry Collector (or other backends), gRPC is usually the best choice because of its streaming and multiplexing capabilities. Typical layer stack:- OTLP signals: traces, metrics, logs.
- Protobuf binary encoding (compact, schema-driven).
- gRPC framework (RPC methods, streaming semantics).
- HTTP/2 transport (multiplexing, flow control, header compression).

- Requires HTTP/2 as the transport protocol.
- Default port:
4317(configurable). - Persistent connections with multiplexed streams over a single TCP connection.
- Bidirectional streaming, built-in flow control, and header compression (HPACK).
- Efficient, low-latency; often the best choice for SDK-to-collector communication.

gRPC requires HTTP/2. If your environment, proxy, or gateway does not support HTTP/2 (or enforces HTTP/1.x only), prefer OTLP over HTTP.
OTLP over HTTP (Protobuf encoding)
When gRPC is not available or desired, OTLP payloads can be sent over HTTP POST requests using Protobuf binary encoding. This preserves the compact, schema-driven serialization while using familiar HTTP semantics. Typical flow:- OTLP signals → Protobuf binary encoding.
- HTTP POST with
Content-Type: application/x-protobuf. - Transport over HTTP/1.1 or HTTP/2 (HTTP/2 is optional).
- Endpoints:
/v1/traces,/v1/metrics,/v1/logs. - Default port:
4318(configurable).
OTLP over HTTP (JSON encoding)
HTTP transport can also send Protobuf-defined messages encoded as JSON. JSON payloads are human-readable and useful for debugging, but they are larger and slower to parse than binary Protobuf. Flow for JSON encoding:- OTLP signals → Protobuf → JSON encoding.
- HTTP POST with
Content-Type: application/json. - Transport over HTTP/1.1 or HTTP/2.
- Same endpoints:
/v1/traces,/v1/metrics,/v1/logs.

Routing and endpoints
Routing differs between gRPC and HTTP:- gRPC: a single endpoint (for example
collector.example.com:4317) exposes multiple RPC services and methods (as defined in the OTLP protobuf). All signals share the same connection and are routed by gRPC service/method names. - HTTP: the SDK/client constructs full URLs by appending specific paths to a base endpoint (for example
https://collector.example.com:4318/v1/traces).
- gRPC — typically configure just the endpoint host and port (e.g.,
collector.example.com:4317). - HTTP — configure the base endpoint and let the SDK append
/v1/traces,/v1/metrics,/v1/logs.

End-to-end transport flow
A succinct view of the telemetry journey:- Application generates telemetry (traces, metrics, logs).
- OTLP SDK structures data (resource → scope → signals).
- Serialization: data encoded as binary Protobuf or JSON-encoded Protobuf.
- Transport:
- gRPC: binary Protobuf over HTTP/2 (default port
4317). - HTTP: Protobuf binary (
application/x-protobuf) or JSON (application/json) over HTTP/1.1 or HTTP/2 (default port4318).
- gRPC: binary Protobuf over HTTP/2 (default port
- Backend (collector or observability backend) receives, processes, and optionally forwards/exports the data.

Comparison at a glance
| Feature | gRPC + Protobuf | HTTP + Protobuf | HTTP + JSON |
|---|---|---|---|
| Default port | 4317 | 4318 | 4318 |
| Transport protocol | Requires HTTP/2 | HTTP/1.1 or HTTP/2 | HTTP/1.1 or HTTP/2 |
| Encoding | Protobuf (binary) | Protobuf (binary) | Protobuf → JSON (text) |
| Endpoint routing | Single endpoint, routed by gRPC services/methods | Distinct URL paths: /v1/traces, /v1/metrics, /v1/logs | Distinct URL paths: /v1/traces, /v1/metrics, /v1/logs |
| Request shape | RPC calls / persistent streams | HTTP POSTs | HTTP POSTs |
| Content-Type | Handled by gRPC layer | application/x-protobuf | application/json |
| Compression | Built-in gRPC support | HTTP-level (e.g., gzip) | HTTP-level (e.g., gzip) |
| Performance | Best (lowest latency, efficient) | Slightly slower than gRPC | Slowest (larger payloads & parsing) |
| Best fit | Production SDK-to-collector when HTTP/2 is available | Environments where gRPC is not feasible but binary efficiency is desired | Debugging, demos, or when human-readable payloads are preferred |
Best use cases & recommendations
- gRPC: preferred for SDK-to-collector or high-throughput production setups when HTTP/2 is supported.
- HTTP + Protobuf: choose when gRPC is blocked or unsupported but you still want compact binary encoding.
- HTTP + JSON: use for debugging, quick manual inspection, or environments that require text payloads.
Choose transports based on environment constraints (HTTP/2 availability), performance needs (low-latency streaming vs. request-based), and debugging requirements (binary vs. human-readable).
