Use it when connecting SDKs, Collectors and backends.
OTLP Protocol
OTLP is the OpenTelemetry protocol for metrics, logs and traces over gRPC (port 4317) or HTTP/protobuf (port 4318, paths /v1/traces, /v1/metrics, /v1/logs).
1. Port open: nc -vz collector 4317 / 4318.
2. HTTP test: curl -i -X POST http://collector:4318/v1/traces -H 'Content-Type: application/json' -d '{}'.
3. Protocol variable OTEL_EXPORTER_OTLP_PROTOCOL.
4. TLS/headers.
5. Collector receiver logs.
SDK → OTLP gRPC/HTTP → receiver → pipeline
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
Send a test span with a CLI tool or SDK example and confirm it reaches the backend. Check TLS certificate validation on the exporter.
Step 2 Endpoints and checks Verify boundary
| Transport | Port | Path |
|---|---|---|
| gRPC | 4317 | — |
| HTTP/protobuf or JSON | 4318 | /v1/traces, /v1/metrics, /v1/logs |
Test: curl -i http://collector:4318/v1/traces -H 'Content-Type: application/json' -d '{}' should return 200/400, not connection refused. Use TLS and authentication (headers via OTEL_EXPORTER_OTLP_HEADERS) across networks.
Match protocol and port: gRPC to 4317, HTTP to 4318 with path. Use TLS and auth headers across networks. Errors often show only in SDK debug logs.
nc -vz collector 4317— first check for this topiccurl -s localhost:9090/-/ready— Prometheus readycurl -s 'localhost:9090/api/v1/query?query=up'— scrape targets up/downpromtool check config prometheus.yml— config valid
ReferenceWhat it is1 section · depth on demand
How it works
OTLP payloads are protobuf messages grouped by resource and scope. Receivers acknowledge requests; retryable errors (unavailable, resource exhausted) make exporters retry.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Request structure
Every OTLP export is grouped as resource → instrumentation scope → items: one request can carry spans from one service (resource), split by the library that produced them (scope). Keeping the resource once per batch is what makes OTLP compact.
Transports
| OTLP/gRPC | OTLP/HTTP | |
|---|---|---|
| Default port | 4317 | 4318 |
| Paths | gRPC service methods | /v1/traces, /v1/metrics, /v1/logs |
| Encoding | Protobuf | Protobuf (application/x-protobuf) or JSON (application/json) |
| Through proxies | Needs HTTP/2 end to end | Works through ordinary HTTP/1.1 proxies |
Responses and retries
The receiver answers with success, a partial success (some items rejected — the response says how many and why), or an error. Clients retry only retryable errors (for example gRPC UNAVAILABLE, RESOURCE_EXHAUSTED with retry info; HTTP 429, 502, 503, 504) with exponential back-off, honouring Retry-After. Other errors (malformed data, auth failures) are dropped after logging.
Worked smoke test without an SDK
cat > span.json <<'EOF'
{"resourceSpans":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"otlp-smoke"}}]},
"scopeSpans":[{"spans":[{"traceId":"5b8efff798038103d269b633813fc60c","spanId":"eee19b7ec3c1b174",
"name":"smoke","kind":1,"startTimeUnixNano":"1795770843000000000","endTimeUnixNano":"1795770843100000000"}]}]}]}
EOF
curl -sS -i http://otel-collector:4318/v1/traces -H 'Content-Type: application/json' --data @span.json
# HTTP/1.1 200 OK → then search the backend for service "otlp-smoke"
A 404 means the path is wrong (or the endpoint is gRPC); 415 means the content type is not accepted; a TLS error means the client expects https or does not trust the certificate.
Common mistakes
- Mixing gRPC and HTTP OTLP ports (4317 vs 4318).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.