Skip to content

Include advice class name in instrumentation exception handler log#11457

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits into
masterfrom
andrea.marziali/logger++
Jun 4, 2026
Merged

Include advice class name in instrumentation exception handler log#11457
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits into
masterfrom
andrea.marziali/logger++

Conversation

@amarziali

Copy link
Copy Markdown
Contributor

What Does This Do

Refactors ExceptionHandlers.defaultExceptionHandler into a factory that takes the advice class FQN, and changes the bytecode it emits so the resulting log line is:

Failed to handle exception in instrumentation for com.example.InstrumentedClass (com.example.SomeAdvice)

instead of:

Failed to handle exception in instrumentation for com.example.InstrumentedClass

The existing ... for <instrumentedClass> prefix is preserved (so existing log searches / dashboards keep working);

Please note that now the stack manipulation is compound and made of two part:

  1. One little TextConstant that's allocated for each Advice when they are installed (it's small and cheap, just doing a LDC)
  2. The existing logging advice that's shared among all the installed advices

The new logging bytecode has been adapted to consume the advice name from the stack and weave it into the log message at runtime via two String.concat calls.

This is very useful to understand which advice specifically triggered the error for the telemetry. Unfortunately there is no easy way to make distinction between the OnMethodEnter/OnMethodExit but this is a nice step forward in improving the message.

Motivation

Additional Notes

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level
    • Get more information in this doc

Jira ticket: [PROJ-IDENT]

@amarziali amarziali added the type: feature Enhancements and improvements label May 26, 2026
@amarziali
amarziali requested a review from a team as a code owner May 26, 2026 12:43
@amarziali amarziali added the comp: core Tracer core label May 26, 2026
@amarziali
amarziali requested review from mcculls and mhlidd May 26, 2026 12:43
@amarziali amarziali added the tag: do not merge Do not merge changes label May 26, 2026
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 5 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-java | java-startup-parallel-check-slo-breaches   View in Datadog   GitLab

See error No scenarios found for comparison when generating Markdown threshold report.

DataDog/apm-reliability/dd-trace-java | java-startup-parallel-generate-slos   View in Datadog   GitLab

See error Script execution failed due to missing artifacts directory.

DataDog/apm-reliability/dd-trace-java | java-startup-parallel-upload-to-bp-api   View in Datadog   GitLab

See error Execution of Verify files exist failed with exit code 2.

View all 5 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: be49d93 | Docs | Datadog PR Page | Give us feedback!

@amarziali

Copy link
Copy Markdown
Contributor Author

Depends somehow on #11268 that will fix the exception that's excluded in system tests but now the text slightly changed :)

@mhlidd mhlidd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code looks good. Just some nit comments for clarity since I got confused following 😅

@amarziali
amarziali requested a review from mhlidd May 27, 2026 13:08

@mhlidd mhlidd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@amarziali
amarziali force-pushed the andrea.marziali/logger++ branch from ad3ca32 to f8fb4c1 Compare June 3, 2026 15:46
@amarziali amarziali removed the tag: do not merge Do not merge changes label Jun 4, 2026
@amarziali

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jun 4, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-06-04 13:15:38 UTC ℹ️ Start processing command /merge


2026-06-04 13:15:43 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-06-04 14:30:21 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 15dc542 into master Jun 4, 2026
571 of 573 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the andrea.marziali/logger++ branch June 4, 2026 14:30
@github-actions github-actions Bot added this to the 1.64.0 milestone Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants