Skip to content

fix(log-analysis): rectify traceback extraction logic and add root stacktrace support#628

Open
akshayrw25 wants to merge 1 commit intomainfrom
detect-litellm-proxy-stacktraces
Open

fix(log-analysis): rectify traceback extraction logic and add root stacktrace support#628
akshayrw25 wants to merge 1 commit intomainfrom
detect-litellm-proxy-stacktraces

Conversation

@akshayrw25
Copy link
Contributor

@akshayrw25 akshayrw25 commented Mar 6, 2026

  • Fix fallback when "with data {" pattern not matched: use event_msg instead of traceback_dict_str_temp (which was undefined in that branch of stacktrace-detection)
  • Add fallback extraction when balanced curlies lookup fails, using traceback_dict_str_temp
  • Extract stacktrace from root-level "stacktrace" key in JSON logs (Step 2)
  • Pass str(log_str_json_obj) when object is not a dict to avoid type errors

Note

Medium Risk
Changes parsing and fallback paths in traceback extraction, which can alter which stacktraces are detected and may impact downstream alerting/diagnostics. Scope is localized to log parsing but affects production observability behavior.

Overview
Improves PythonTracebackExtractor.extract_traceback_from_dict_log to be more robust when extracting Python stacktraces from JSON logs.

It fixes fallback extraction when the "error handling"/"with data {" pattern or balanced-curly parsing fails, ensuring extraction runs against the appropriate string and that recovered tracebacks are appended. It also adds support for a root-level JSON stacktrace field and ensures non-dict JSON values are coerced to str before running pattern extraction.

Written by Cursor Bugbot for commit 238949b. Configure here.

…acktrace support

- Fix fallback when "with data {" pattern not matched: use event_msg instead
  of traceback_dict_str_temp (which was undefined in that branch of stcktrc-detection)
- Add fallback extraction when balanced curlies lookup fails, using
  traceback_dict_str_temp
- Extract stacktrace from root-level "stacktrace" key in JSON logs (Step 2)
- Pass str(log_str_json_obj) when object is not a dict to avoid type errors
@akshayrw25 akshayrw25 requested a review from a team as a code owner March 6, 2026 14:17
@akshayrw25 akshayrw25 self-assigned this Mar 6, 2026
@akshayrw25
Copy link
Contributor Author

bugbot run

@akshayrw25 akshayrw25 requested a review from answersamir March 6, 2026 14:17
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

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