Skip to content

[Bugfix] Improve auto trace parsing diagnostics - #1218

Draft
dante159753 wants to merge 4 commits into
ModelEngine-Group:developfrom
dante159753:fix-auto-trace-diagnostics
Draft

[Bugfix] Improve auto trace parsing diagnostics#1218
dante159753 wants to merge 4 commits into
ModelEngine-Group:developfrom
dante159753:fix-auto-trace-diagnostics

Conversation

@dante159753

Copy link
Copy Markdown
Contributor

What changed

  • Allow --log-dir to accept either a directory or a single log file, regardless of the file extension.
  • Print every discovered input file before parsing starts.
  • Report malformed trace lines with the parsing stage, source file, line number, column, cause, and a bounded line excerpt.
  • Continue parsing after malformed trace lines and print a consolidated failure count and error details after the scan.
  • Expose parse_failure_count and parse_failures in the generated analysis result.
  • Avoid scanning the same logs twice when --trace-output is enabled.
  • Add focused unit coverage for direct file input, file discovery, malformed and truncated traces, and successful CLI analysis after a bad line.

Why

Long ucm_block_ids log messages can be truncated before the list terminator. The existing non-greedy list pattern may then consume a later logger metadata bracket, and ast.literal_eval fails without identifying the offending line or parsing stage. One malformed line also previously aborted the entire analysis.

The new diagnostics make the source of malformed records actionable while allowing valid records later in the same file or other scanned files to remain usable.

Impact

Users can analyze a pasted or individually selected log file directly, see the exact input set, and still receive cache-hit analysis when only part of the trace is malformed. Completely unusable inputs continue to fail the existing aggregate validation.

Verification

python -m unittest benchmarks.test_auto_trace_analysis
python -m py_compile benchmarks/auto_trace_analysis.py benchmarks/test_auto_trace_analysis.py
python -m black --check benchmarks/auto_trace_analysis.py benchmarks/test_auto_trace_analysis.py
python -m isort --check-only benchmarks/auto_trace_analysis.py benchmarks/test_auto_trace_analysis.py
git diff --check origin/develop...HEAD

The commit-time codespell, Black, isort, and GitHub Actions workflow lint hooks also pass.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant