-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix(exporter): ensure response is closed #4477
base: main
Are you sure you want to change the base?
bugfix(exporter): ensure response is closed #4477
Conversation
Fix open-telemetry#4476 Signed-off-by: Alex Boten <[email protected]>
The metrics failure looks like a double close or something in case the response is a 200? |
Signed-off-by: Alex Boten <[email protected]>
Turns out the |
Signed-off-by: Alex Boten <[email protected]>
@@ -167,8 +167,12 @@ def export(self, batch: Sequence[LogData]) -> LogExportResult: | |||
resp = self._export(serialized_data) | |||
# pylint: disable=no-else-return | |||
if resp.ok: | |||
if resp.raw is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if moving this right after getting resp
will make resp.ok
and self._retryable(resp)
change behavior? If not would be nice to do this just once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a quick test it looks like it should be fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the suggestion, updated the code and tested it locally, seems ok
Signed-off-by: Alex Boten <[email protected]>
Signed-off-by: Alex Boten <[email protected]>
After further testing, the problem is caused by the Session object sending a Instead, I added a try/except around the post, to catch the ConnectionError and try to post another time (which causes the connection to be re-established successfully in this case). PTAL |
Signed-off-by: Alex Boten <[email protected]>
Description
I was experiencing connection aborted when using the OTLP exporters to emit metrics. After reading the documentation for the requests library, it appears that if the body is not read, it is not necessarily returned to the connection pool.
Fix #4476
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Manually tested to validate that the connection aborted errors no longer happen.
Does This PR Require a Contrib Repo Change?
Checklist: