Return typed HTTP statuses on OTLP ingest errors#7
Open
phall1 wants to merge 1 commit into
Open
Conversation
Before: every `/v1/traces` and `/v1/logs` failure — a protobuf-payload
exporter, a malformed body, a downstream worker panic — collapsed into
a generic `500 Internal Server Error` with an empty body. That made
protocol-mismatch debugging opaque; a caller sending OTLP/HTTP-protobuf
(the SDK default on most platforms) had no hint that motel implements
only the JSON encoding.
Now the predictable failure modes map to informative statuses:
415 Unsupported Media Type — Content-Type isn't application/json
(protobuf payloads hit this; body
names the fix: protocol=http/json).
400 Bad Request — body is JSON-claimed but unparseable.
500 Internal Server Error — genuine downstream failures (unchanged).
The classification is extracted into `src/otlpIngestResponse.ts` so the
Content-Type / error-message branches are unit-testable without an HTTP
runtime. 13 new tests; full suite remains green (170/170).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This improves the error handling, but I think the underlying root cause is that default OTLP/HTTP exporters send |
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.
Before: every
/v1/tracesand/v1/logsfailure (eg a protobuf-payload exporter, a malformed body, a downstream worker panic) collapsed into a generic500 Internal Server Errorwith an empty body.This made protocol mismatching debugging opaque. I was sending OTLP/HTTP-protobuf, and the clankers didn't have a hint that motel implements only the JSON encoding.
Now the predictable failure modes map to informative statuses:
415 Unsupported Media Type— Content-Type isn't application/json (protobuf payloads hit this -> body names the fix: protocol=http/json).400 Bad Request— body is JSON but unparseable.500 Internal Server Error— genuine downstream failures (unchanged).The classification is extracted into
src/otlpIngestResponse.tsso the Content-Type / error-message branches are unit-testable without an HTTP runtime. 13 new tests