Skip to content

fix: say which tracing destination rejected the data - #2714

Open
tonyandrewmeyer wants to merge 2 commits into
canonical:mainfrom
tonyandrewmeyer:fix/2137-tracing-error-detail
Open

fix: say which tracing destination rejected the data#2714
tonyandrewmeyer wants to merge 2 commits into
canonical:mainfrom
tonyandrewmeyer:fix/2137-tracing-error-detail

Conversation

@tonyandrewmeyer

@tonyandrewmeyer tonyandrewmeyer commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

When the collector rejects an export, the log line says the status code but not which destination it came from, and it goes through logger.exception, so you get a full traceback for something the status code already explains. This adds config.url to the message, drops to logger.error, and reads at most 1000 bytes of the response body rather than reading all of it and slicing afterwards, so a verbose collector can't make us buffer megabytes we're about to throw away.

I went with error rather than warning because the previous call was exception and we do lose the batch, but tracing is best-effort.

Fixes #2137

When the OTLP collector responds with an HTTP error, include the
destination URL in the log line, drop the traceback (the status code
is enough on its own), and read at most 1000 bytes from the response
body rather than reading all of it and slicing afterwards.
pyright, run from the tracing directory, rejects a bare dict for the
hdrs argument.
@tonyandrewmeyer
tonyandrewmeyer marked this pull request as ready for review August 31, 2026 01:20

@dwilding dwilding left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic makes sense to me, thanks!

503,
'Service Unavailable',
email.message.Message(),
io.BytesIO(long_body), # type: ignore[arg-type]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tox -e lint passes even without the type ignore. Shall we drop it?

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.

Better errors when tracing destination returns errors

2 participants