[route_check]: Add truncation indicator and mismatch summary counts#4587
Open
Bojun-Feng wants to merge 3 commits into
Open
[route_check]: Add truncation indicator and mismatch summary counts#4587Bojun-Feng wants to merge 3 commits into
Bojun-Feng wants to merge 3 commits into
Conversation
* Add PRINT_MSG_TRUNCATION_SUFFIX constant and truncation marker within PRINT_MSG_LEN_MAX budget * Extract summarize_results() helper for per-namespace mismatch counts * Add test_logging_truncation_indicator with coverage for suffix, short msg, and edge cases Signed-off-by: Bojun-Feng <bojundf@gmail.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* Break long print_message calls to fit within 120 char limit Signed-off-by: Bojun-Feng <bojundf@gmail.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* Align continuation lines to opening parenthesis Signed-off-by: Bojun-Feng <bojundf@gmail.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
What I did
Fix sonic-net/sonic-buildimage#27509
Added a truncation indicator and mismatch summary counts to
route_check.pyfailure output.When
print_message()truncates output atPRINT_MSG_LEN_MAX(1000 chars), it now appends... (truncated)within the length budget so operators know data was omitted. Additionally, a compact per-namespace mismatch count summary line is emitted before the detailed (potentially truncated) JSON dump.How I did it
PRINT_MSG_TRUNCATION_SUFFIXmodule-level constant and truncation marker logic inprint_message()that keeps total length ≤PRINT_MSG_LEN_MAXsummarize_results()helper to produce{namespace: {category: count}}dictjson.dumps(..., separators=(",",":"))before the detailed failure results in bothcheck_routes()andcheck_sids()How to verify it
test_logging— confirms backward compatibility (all length assertions pass unchanged)test_logging_truncation_indicator— confirms truncation suffix behavior at realisticPRINT_MSG_LEN_MAX=50, short message passthrough, and edge case where max < suffix lengthroute_check.py -l INFO, verify summary count line appears and truncated output ends with... (truncated)Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)