Skip to content

Fix: accept gzip Content-Encoding on the OTLP/HTTP receiver - #2

Merged
den-vasyliev merged 2 commits into
triageagent-dev:mainfrom
Punkoivan:feat/otlp-gzip
Sep 30, 2026
Merged

den-vasyliev merged 2 commits into
triageagent-dev:mainfrom
Punkoivan:feat/otlp-gzip

Conversation

@Punkoivan

Copy link
Copy Markdown

Closes #1

Problem

POST /v1/traces reads the request body as-is. The OpenTelemetry Collector's otlphttp exporter gzips by default, so every export from a stock collector fails to decode and gets 400. The exporter treats that as a permanent error and drops the data, and agentevals itself logs nothing, so the failure only shows up on the collector side.

Repro

One span sent through otelcol-contrib 0.156.0 with default exporter settings to the current main (54107cf) and to this branch (b31c2d1):

exporters:
  otlphttp/upstream-54107cf: { endpoint: http://ae-old:4318 }   # compression defaults to gzip
  otlphttp/fix-b31c2d1:      { endpoint: http://ae-new:4318 }

Collector log:

error  Exporting failed. Dropping data.  "otelcol.component.id": "otlphttp/upstream-54107cf",
  "error": "not retryable error: Permanent error: rpc error: code = InvalidArgument desc = error exporting
  items, request to http://ae-old:4318/v1/traces responded with HTTP Status Code 400"

(no error for otlphttp/fix-b31c2d1)

main (54107cf)  GET /api/streaming/sessions -> []
this branch     GET /api/streaming/sessions -> [{"sessionId": "gzip-repro", "spanCount": 1}]

main's own log shows nothing about the rejection, only the startup lines.

Change

  • otlpRequestBody undoes Content-Encoding before the protobuf/JSON decode: gzip and identity are supported, an unknown encoding gets 415, and a body that isn't valid gzip gets 400.
  • Additive over Python: api/otlp_routes.py's receive_traces also reads the raw body with no decompression, so the port mirrored that. Noted in the code comment and in docs/STATUS.md.
  • Also verified against a real collector in a KinD cluster: with default compression, 0 dropped exports, where every export was dropped before the fix.
  • Not included: deflate/zstd (the issue's optional part). They get 415 for now; happy to add them in a follow-up if wanted.

Checklist

  • go build ./..., go vet ./... and gofmt -l . are clean
  • go test ./... passes; new test internal/api/otlp_http_test.go covers protobuf identity/gzip, JSON gzip, a case-insensitive header, an unsupported encoding (415) and a non-gzip body (400)
  • Additive-over-Python change documented in docs/STATUS.md
  • ui/ untouched, so npm run build isn't needed

🤖 Generated with Claude Code

Ivan Punko and others added 2 commits September 29, 2026 22:18
The OpenTelemetry Collector's otlphttp exporter gzips by default, and
POST /v1/traces read the body as-is, so every export from a stock
collector failed to decode and got a 400 -- which the exporter treats as
permanent and drops. Undo Content-Encoding (gzip, identity) before the
protobuf/JSON decode; answer 415 for an encoding it doesn't know and 400
for a body that isn't valid gzip.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@den-vasyliev
den-vasyliev merged commit 9a868bc into triageagent-dev:main Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OTLP/HTTP receiver: support Content-Encoding: gzip

2 participants