Skip to content

Adds metric for disconnects during upload#1117

Open
aagbsn wants to merge 5 commits intomasterfrom
fix_1116_uncaught_exc
Open

Adds metric for disconnects during upload#1117
aagbsn wants to merge 5 commits intomasterfrom
fix_1116_uncaught_exc

Conversation

@aagbsn
Copy link
Copy Markdown
Contributor

@aagbsn aagbsn commented Mar 12, 2026

catch exception raised and keep track of this metric #1116

hellais

This comment was marked as outdated.

except ClientDisconnect:
log.info(f"Client disconnected mid-upload")
Metrics.CLIENT_DISCONNECT.inc()
return empty_measurement
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should verify how clients behave when we return empty_measurement instead of raising an exception, since this might affect changes in the client behavior.

I would actually suggest we preserve the original behavior by re-rasing the exception

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

if we re-raise the exception it pollutes the logs with a Traceback; but if the client has disconnected - how would it receive anything?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah I think for the ClientDisconnect you are right. In the case of the catch-all exception, we ought to though return something that's an error to the client, either a 5xx error (by just re-raising the exception) or a specific 5xx/4xx status code.

return empty_measurement
except Exception as e:
log.error(f"Uncaught exception {e}")
return empty_measurement
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We should return something that indicates that this was not a successful submission; verify what repsonse should be sent. IE, should re-raise as a wrapped HTTPException?

aagbsn added 2 commits March 24, 2026 16:11
on ClientDisconnect this won't be returned, but will suppress a noisy
traceback in logs.
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.

2 participants