Mapping bigquery errors to http status codes - #2041
Open
adamallegro wants to merge 14 commits into
Open
Conversation
adamallegro
commented
Jun 12, 2026
Collaborator
- TANGO-3103 : Permanent errors of bigquery-consumer mapped to 4xx http code
- TANGO-3103 : Added logging of error and statusCode
- TANGO-3103 : Added custom http status code in error handling as well
- TANGO-3103 : Fixes after merge
- TANGO-3103 : Default 500 when any other error will appear
- TANGO-3103 : Removed unnecessary loggings
- TANGO-3103 : Removed unused logger field
- TANGO-3103 : Reformatted code
✅ Benchmark comparison: PASSED
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Google BigQuery consumer sender flow to translate certain BigQuery (gRPC) failures into HTTP status codes (notably mapping permanent errors to 4xx), so downstream Hermes error handling can treat them as client vs server failures.
Changes:
- Added a
failedResult(int statusCode, Throwable cause)path to propagate both status code and failure cause. - Introduced gRPC-status → HTTP-status mapping for BigQuery append failures.
- Added a dedicated exception to enrich BigQuery append serialization error messages.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/consumer/sender/SingleMessageSendingResult.java |
Adds a constructor allowing status code + failure to be carried together. |
hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/consumer/sender/MessageSendingResult.java |
Adds a static factory overload for failedResult(statusCode, cause). |
hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/GoogleBigQueryFailedAppendException.java |
New exception to provide clearer failure messages for append serialization errors. |
hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/GoogleBigQueryDataWriter.java |
Changes error handling from throwing to completing resultFuture with status-mapped failures. |
hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/consumer/sender/googlebigquery/GoogleBigQueryAppendCompleteCallback.java |
Adds permanent error mapping from gRPC status codes to HTTP status codes on failure callback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| this.resultFuture = resultFuture; | ||
| } | ||
|
|
||
| public static Integer mapToPermanentErrorHttpStatus(Throwable cause) { |
Contributor
There was a problem hiding this comment.
we can return "int"
nit: what's "permanent" in that context? we can skip it in the function name
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.