Skip to content

Mapping bigquery errors to http status codes - #2041

Open
adamallegro wants to merge 14 commits into
masterfrom
TANGO-3103
Open

Mapping bigquery errors to http status codes#2041
adamallegro wants to merge 14 commits into
masterfrom
TANGO-3103

Conversation

@adamallegro

Copy link
Copy Markdown
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

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

✅ Benchmark comparison: PASSED

Metric Status Change
consumer.HermesConsumerBenchmark.benchmarkConsumingThroughput (thrpt) ✅ PASS ↑ 0.69%
consumer.HermesConsumerBenchmark.benchmarkConsumingThroughput (thrpt) - gc.alloc.rate.norm ✅ PASS ↓ 0.68%
consumer.HermesConsumerFilteringBenchmark.benchmarkConsumingThroughput (thrpt) ✅ PASS ↑ 0.58%
consumer.HermesConsumerFilteringBenchmark.benchmarkConsumingThroughput (thrpt) - gc.alloc.rate.norm ✅ PASS ↓ 0.30%
frontend.HermesServerBenchmark.benchmarkPublishingLatency (sample) ✅ PASS ↑ 0.46%
frontend.HermesServerBenchmark.benchmarkPublishingLatency (sample) - gc.alloc.rate.norm ✅ PASS ↑ 0.41%
frontend.HermesServerBenchmark.benchmarkPublishingThroughput (thrpt) ✅ PASS ↑ 5.55%
frontend.HermesServerBenchmark.benchmarkPublishingThroughput (thrpt) - gc.alloc.rate.norm ✅ PASS ↑ 0.38%

Copilot AI 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.

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) {

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.

we can return "int"

nit: what's "permanent" in that context? we can skip it in the function name

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants