Pcornel
Browse topics
Options
Recent
Favorites
Observability · Technical reference

OTLP Protocol

Direct answer

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).

When to use this

Use it when connecting SDKs, Collectors and backends.

First 30 seconds

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.

Operational verification

SDK → OTLP gRPC/HTTP → receiver → pipeline

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
OpenTelemetry / Prometheus / Grafana / common metrics-log-trace pipelines
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformOpenTelemetry / Prometheus / Grafana / common metrics-log-trace pipelines
Scope / prerequisiteUse it when connecting SDKs, Collectors and backends.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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
TransportPortPath
gRPC4317—
HTTP/protobuf or JSON4318/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.

Step 3 Common failures Narrow the fault

Proxies that do not support HTTP/2 break gRPC. Wrong URL paths on HTTP return 404. Large batches exceed receiver message size limits.

Key points

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.

Key checks
  • nc -vz collector 4317 — first check for this topic
  • curl -s localhost:9090/-/ready — Prometheus ready
  • curl -s 'localhost:9090/api/v1/query?query=up' — scrape targets up/down
  • promtool 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/gRPCOTLP/HTTP
Default port43174318
PathsgRPC service methods/v1/traces, /v1/metrics, /v1/logs
EncodingProtobufProtobuf (application/x-protobuf) or JSON (application/json)
Through proxiesNeeds HTTP/2 end to endWorks 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Terminology layer

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.

Aliases that resolve here
otlp protocolotlp grpc httpotlp 4317 4318
Confirmation

Confirm action

Continue?