Skip to content

fix(detect_exceptions): replace catch-all rule with targeted patterns for JavaException - #305

Open
vparfonov wants to merge 1 commit into
ViaQ:v0.47.0-rhfrom
vparfonov:log9963-v0.47.0-rh
Open

fix(detect_exceptions): replace catch-all rule with targeted patterns for JavaException#305
vparfonov wants to merge 1 commit into
ViaQ:v0.47.0-rhfrom
vparfonov:log9963-v0.47.0-rh

Conversation

@vparfonov

@vparfonov vparfonov commented Sep 1, 2026

Copy link
Copy Markdown

Summary

Fix incorrect multiline exception detection that merges independent JSON log records (LOG-9963) while maintaining support for legitimate multi-line exceptions including Java exceptions with non-indented continuation lines like Oracle ORA errors (LOG-9995).

Problem

The detect_exceptions transform was using a bounded catch-all regex pattern ^.+$ to match continuation lines of Java exceptions. While bounded (max 2 lines), this pattern was still too greedy and would match ANY non-empty line after an exception keyword, causing independent log records to be incorrectly merged into a single event.

Example of the bug:

java.lang.RuntimeException: something went wrong    ← matches exception keyword
first continuation line without stack trace         ← matches ^.+$, merged
second continuation line without stack trace        ← matches ^.+$, merged
third unrelated message                             ← stops here (limit reached)

Result: 3 independent messages merged into 1 event

Solution

Replace the generic catch-all with 3 targeted continuation patterns that:

  1. Handle legitimate multi-line scenarios (ORA errors, error codes, parenthetical continuations)
  2. Prevent merger of arbitrary text/JSON messages

New patterns:

  • ^[A-Z]+-?\d+ — Oracle ORA errors, DB error codes (e.g., ORA-12521)
  • ^[\t ]*\( — Parenthetical continuations (e.g., CONNECTION_ID)
  • ^[\t ]+\S— Indented lines (standard stack frames)

These fire from both JavaAfterException and JavaContinuation states, allowing proper chaining through the state machine while being selective about what gets merged.

Fixes

  • LOG-9963: Independent log records with exception keywords no longer incorrectly merged (and LOG-9998)
  • Maintains LOG-9995 support: ORA errors and other error codes properly grouped via targeted patterns instead of catch-all

… (LOG-9963, LOG-9995)

Fix incorrect multiline exception detection that was merging independent log
records. Replace bounded catch-all pattern (^.+$) with 3 targeted patterns:
- ^[A-Z]+-?\d+       : Oracle ORA errors, DB error codes
- ^[\t ]*\(          : Parenthetical continuations
- ^[\t ]+\S          : Indented lines

This allows proper grouping of legitimate multi-line exceptions (stack traces,
ORA error codes, nested exceptions) while preventing merger of independent
JSON log records with exception keywords (LOG-9963).

Fixes LOG-9963, LOG-9995

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Signed-off-by: Vitalii Parfonov <vparfono@redhat.com>
@openshift-ci
openshift-ci Bot requested review from Clee2691 and jcantrill September 1, 2026 20:24
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: f8c052ce-f01f-4744-ae3c-3188869d0be2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@vparfonov

Copy link
Copy Markdown
Author

/assign @jcantrill
/cc @Clee2691

@vparfonov vparfonov changed the title fix(detect_exceptions): replace catch-all rule with targeted patterns… fix(detect_exceptions): replace catch-all rule with targeted patterns for JavaException Sep 1, 2026
@vparfonov

Copy link
Copy Markdown
Author

/retest-required

@jcantrill jcantrill added the v0.47 label Sep 2, 2026
@jcantrill

Copy link
Copy Markdown
Member

/approve
/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Sep 2, 2026
@openshift-ci

openshift-ci Bot commented Sep 2, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcantrill, vparfonov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved label Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants