Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved API compatibility and log-field preservation issues remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds configurable Kafka logging modes to reduce duplicate logs while bounding payloads and preserving useful fields.
Changes:
- Adds one-line/two-line logging configuration.
- Consolidates and filters Kafka logging output.
- Adds tests, documentation, and dependency updates.
File summaries
| File | Summary |
|---|---|
README.md |
Documents logging configuration. |
kafka/consumer.go |
Implements consolidated Kafka logging and payload bounds. |
kafka/consumer_group_test.go |
Tests Kafka logging helpers. |
http/webconfig_server.go |
Adds logging configuration, filtering, and producer logging. |
http/webconfig_server_test.go |
Tests logging behavior and payload handling. |
go.sum |
Updates dependency checksums. |
go.mod |
Updates dependencies. |
config/sample_webconfig.conf |
Adds sample logging configuration. |
Review details
Suppressed comments (3)
http/webconfig_server.go:1279
- Removing
output_bodyhere leaves every correction sent by this loop with the sameoutput_key(the MAC), so messages for different namespaces cannot be distinguished in the logs. Include the current message namespace, or another bounded per-message identifier, before logging each send.
tfields["output_key"] = mac
log.WithFields(tfields).Info("send")
http/webconfig_server.go:1222
- In
one_linemode this is the replacement for the consumer success record, but the consumer always populateskafka_lagandhandleGetMessagepopulatesstatus; neither field is allowlisted here. The consolidated log therefore silently loses Kafka lag and HTTP result status. Preserve these fields (and update the capacity hint) so one-line mode retains the useful consumer telemetry.
"app_name", "audit_id", "body", "cpe_mac", "subdoc_id",
"kafka_key", "topic", "cluster_name", "kafka_partition", "kafka_offset",
"message_length", "duration", "event_name", "rpt", "kafka_operation",
kafka/consumer.go:326
- After
output_bodywas removed from the producer log, these state-correction records no longer identify the subdocument being sent:fieldsstill describes the original notification and the Kafka key is only the device key. When multipleupdatedSubdocIdsare corrected, their enqueue logs are indistinguishable; add the currentsubdocIdto the fields before forwarding.
fields["kafka_operation"] = "state_correction_send"
c.ForwardKafkaMessage(message.Key, em, fields, logMessage)
- Files reviewed: 7/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
…reduce logs