Skip to content

Guard against null logback events#11960

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
andrea.marziali/logback
Jul 16, 2026
Merged

Guard against null logback events#11960
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
masterfrom
andrea.marziali/logback

Conversation

@amarziali

Copy link
Copy Markdown
Contributor

What Does This Do

Even I did not found a codepath on logback source that calls callAppenders with a null event, we surface this situation:

Error : Failed to handle exception in instrumentation for ch.qos.logback.classic.Logger - datadog.trace.instrumentation.logback.LogbackLoggerInstrumentation$CallAppendersAdvice
java.lang.NullPointerException
  at (redacted: 9 frames)
  at java.base/java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run(ThreadPerTaskExecutor.java:314)
  at java.base/java.lang.VirtualThread.run(VirtualThread.java:329)

It can also be a third party. In any case our store is not supporting null keys hence adding this guard for code hygiene.

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@amarziali amarziali requested a review from a team as a code owner July 15, 2026 12:42
@amarziali amarziali added the type: bug fix Bug fix label Jul 15, 2026
@amarziali amarziali removed the request for review from a team July 15, 2026 12:42
@amarziali amarziali added the inst: others All other instrumentations label Jul 15, 2026
@amarziali amarziali added the tag: telemetry error reported Reported by error telemetry label Jul 15, 2026
@amarziali amarziali requested review from a team and mcculls July 15, 2026 12:43

@datadog-official datadog-official Bot 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.

Datadog Autotest: PASS

More details

PR adds null-safety guards to two logback instrumentation advice methods. CallAppendersAdvice2 directly calls methods on the event without null checks (getThreadName, getLevel, etc.), so a null event would cause a NullPointerException. CallAppendersAdvice passes the event as a key to WeakMap, which doesn't support null keys. Both guards are defensive and necessary, with no behavioral side effects.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit f37d1cd · What is Autotest? · Any feedback? Reach out in #autotest

@datadog-official

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 69.73% (+12.55%)

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

@dd-octo-sts

dd-octo-sts Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.03 s 13.99 s [-0.7%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 13.03 s 12.97 s [-0.3%; +1.3%] (no difference)
startup:petclinic:appsec:Agent 16.80 s 16.72 s [-0.4%; +1.4%] (no difference)
startup:petclinic:iast:Agent 16.79 s 16.84 s [-1.0%; +0.5%] (no difference)
startup:petclinic:profiling:Agent 16.57 s 16.58 s [-1.0%; +0.9%] (no difference)
startup:petclinic:sca:Agent 16.79 s 16.36 s [-1.9%; +7.2%] (no difference)
startup:petclinic:tracing:Agent 15.62 s 16.13 s [-7.3%; +1.0%] (no difference)

Commit: f37d1cdc · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@mcculls mcculls 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.

Seems reasonable, although I too would like to know where the null events came from

@amarziali amarziali enabled auto-merge July 15, 2026 14:16
@amarziali amarziali added tag: telemetry error reported Reported by error telemetry and removed tag: telemetry error reported Reported by error telemetry labels Jul 15, 2026
@amarziali amarziali added this pull request to the merge queue Jul 15, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 15, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-15 14:16:54 UTC ℹ️ Start processing command /merge


2026-07-15 14:16:59 UTC ℹ️ MergeQueue: pull request added to the queue

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


2026-07-15 15:22:21 UTCMergeQueue: The build pipeline contains failing jobs for this merge request

Build pipeline has failing jobs for da28fd1:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.
Details

Since those jobs are not marked as being allowed to fail, the pipeline will most likely fail.
Therefore, and to allow other builds to be processed, this merge request has been rejected and the pipeline got canceled.

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 15, 2026
@amarziali

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 16, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-16 10:22:15 UTC ℹ️ Start processing command /merge


2026-07-16 10:22:21 UTC ℹ️ MergeQueue: pull request added to the queue

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


2026-07-16 11:20:14 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit dfc80be into master Jul 16, 2026
591 of 597 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the andrea.marziali/logback branch July 16, 2026 11:20
@github-actions github-actions Bot added this to the 1.65.0 milestone Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: others All other instrumentations tag: telemetry error reported Reported by error telemetry type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants