iceberg: couple logging improvements#27715
Conversation
It's very verbose as is.
There was a problem hiding this comment.
Pull Request Overview
This PR improves logging in the Iceberg REST client for better debugging and operational visibility. The changes add trace-level logging for failed REST requests and throttle frequent warning messages about default partition specs with AWS Glue.
- Added trace-level logging with request payloads when REST client operations fail
- Implemented rate limiting for AWS Glue default partition spec warnings to reduce log noise
- Enhanced error diagnostics by logging request details on failure
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/v/iceberg/rest_client/catalog_client.cc | Added trace logging for failed requests with payloads and improved error handling structure |
| src/v/iceberg/rest_client/BUILD | Added dependency on iobuf_parser for payload logging functionality |
| src/v/datalake/coordinator/coordinator.cc | Implemented rate limiting for AWS Glue partition spec warning messages |
| template<typename T> | ||
| void maybe_log_payload_as_json( | ||
| ss::logger& l, ss::log_level lvl, std::string_view msg, const T& payload) { | ||
| if (!l.is_enabled(lvl)) { | ||
| return; | ||
| } | ||
| auto buf = serialize_payload_as_json(payload); | ||
| iobuf_parser p(std::move(buf)); | ||
| vlogl(iceberg::log, lvl, "{}: {}", msg, p.read_string_safe(4_KiB)); | ||
| } |
There was a problem hiding this comment.
This function should have a docstring explaining its purpose, parameters, and the 4_KiB limit rationale. It's unclear why 4_KiB was chosen as the safe read limit for payload logging.
| } | ||
| auto buf = serialize_payload_as_json(payload); | ||
| iobuf_parser p(std::move(buf)); | ||
| vlogl(iceberg::log, lvl, "{}: {}", msg, p.read_string_safe(4_KiB)); |
There was a problem hiding this comment.
The 4_KiB limit should be defined as a named constant instead of a magic number. Consider defining it as constexpr auto max_payload_log_size = 4_KiB; at the top of the file.
232dda3 to
138231a
Compare
|
Force pushed a non-functional bug (s/iceberg::logger/l) |
Retry command for Build#72892please wait until all jobs are finished before running the slash command |
When there is an error returned from the REST catalog, we have very little context about what we sent. This commit addresses this by logging the logical contents of the request as JSON. I considered logging at a lower level, and logging the entire HTTP request payload (e.g. in perform_request() after signing and such), but opted to place the at the callsite because the context we have there is already const and available to be logged conditionally (vs in perform_request(), the request is moved, making conditional logging trickier).
138231a to
e315237
Compare
CI test resultstest results on build#72910
|
|
/backport v25.2.x |
|
/backport v25.1.x |
|
Failed to create a backport PR to v25.1.x branch. I tried: |
|
Failed to create a backport PR to v25.2.x branch. I tried: |
Backports Required
Release Notes
Improvements