Repository navigation
Fix: accept gzip Content-Encoding on the OTLP/HTTP receiver - #2
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1
Problem
POST /v1/tracesreads the request body as-is. The OpenTelemetry Collector'sotlphttpexporter gzips by default, so every export from a stock collector fails to decode and gets400. 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.0with default exporter settings to the currentmain(54107cf) and to this branch (b31c2d1):Collector log:
(no error for
otlphttp/fix-b31c2d1)main's own log shows nothing about the rejection, only the startup lines.Change
otlpRequestBodyundoesContent-Encodingbefore the protobuf/JSON decode:gzipandidentityare supported, an unknown encoding gets415, and a body that isn't valid gzip gets400.api/otlp_routes.py'sreceive_tracesalso reads the raw body with no decompression, so the port mirrored that. Noted in the code comment and indocs/STATUS.md.deflate/zstd(the issue's optional part). They get415for now; happy to add them in a follow-up if wanted.Checklist
go build ./...,go vet ./...andgofmt -l .are cleango test ./...passes; new testinternal/api/otlp_http_test.gocovers protobuf identity/gzip, JSON gzip, a case-insensitive header, an unsupported encoding (415) and a non-gzip body (400)docs/STATUS.mdui/untouched, sonpm run buildisn't needed🤖 Generated with Claude Code