Skip to content

🍒 12007 - Fix NoSuchElementException from unchecked Optional.get() in Kafka consumer instrumentation#12066

Open
PerfectSlayer wants to merge 2 commits into
release/v1.64.xfrom
bruce.bujon/backport-pr-12007
Open

🍒 12007 - Fix NoSuchElementException from unchecked Optional.get() in Kafka consumer instrumentation#12066
PerfectSlayer wants to merge 2 commits into
release/v1.64.xfrom
bruce.bujon/backport-pr-12007

Conversation

@PerfectSlayer

Copy link
Copy Markdown
Contributor

Backport #12007 to release/v1.64.x

piochelepiotr and others added 2 commits July 24, 2026 15:14
…sumer instrumentation

extractGroup, extractClusterId, and extractBootstrapServers called
Optional.get() without checking isPresent()/using orElse(), which threw
NoSuchElementException when the underlying consumer group, metadata, or
bootstrap servers were not captured. Introduced in 1.64 and observed in
production error telemetry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit e20ee61)
Covers the null/empty-Optional cases for extractGroup, extractClusterId,
and extractBootstrapServers to prevent regressions of the previously
fixed NoSuchElementException.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 6291883)
@PerfectSlayer
PerfectSlayer requested a review from a team as a code owner July 24, 2026 13:14
@PerfectSlayer PerfectSlayer added inst: kafka Kafka instrumentation tag: ai generated Largely based on code generated by an AI or LLM labels Jul 24, 2026
@PerfectSlayer
PerfectSlayer requested a review from a team as a code owner July 24, 2026 13:14
@PerfectSlayer
PerfectSlayer requested review from ValentinZakharov and removed request for a team July 24, 2026 13:14

@datadog-prod-us1-5 datadog-prod-us1-5 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

The helper now safely maps absent consumer-group, metadata, and bootstrap-server optionals to null while preserving present values, and the callback path already uses the same safe behavior. No diff-only behavioral regression was identified; local execution was blocked before compilation by the unavailable Java 25 toolchain.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 220be5d · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@datadog-prod-us1-5

Copy link
Copy Markdown
Contributor

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

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

@dd-octo-sts

dd-octo-sts Bot commented Jul 24, 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 13.92 s 13.98 s [-1.2%; +0.4%] (no difference)
startup:insecure-bank:tracing:Agent 12.87 s 13.00 s [-1.7%; -0.3%] (maybe better)
startup:petclinic:appsec:Agent 16.81 s 16.78 s [-0.9%; +1.2%] (no difference)
startup:petclinic:iast:Agent 16.91 s 16.94 s [-0.9%; +0.6%] (no difference)
startup:petclinic:profiling:Agent 16.19 s 16.89 s [-8.3%; +0.1%] (no difference)
startup:petclinic:sca:Agent 16.91 s 16.72 s [+0.1%; +2.1%] (maybe worse)
startup:petclinic:tracing:Agent 15.67 s 16.10 s [-6.9%; +1.6%] (no difference)

Commit: 220be5dc · 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.

@pr-commenter

pr-commenter Bot commented Jul 24, 2026

Copy link
Copy Markdown

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch release/v1.64.x bruce.bujon/backport-pr-12007
git_commit_date 1784129122 1784898858
git_commit_sha 5b36a52 220be5d
See matching parameters
Baseline Candidate
ci_job_date 1784899897 1784899897
ci_job_id 1890977779 1890977779
ci_pipeline_id 126780277 126780277
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.25 11.0.25
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/producer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/producer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.25+9-post-Ubuntu-1ubuntu122.04 11.0.25+9-post-Ubuntu-1ubuntu122.04

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaProduceBenchmark.benchProduce same

@pr-commenter

pr-commenter Bot commented Jul 24, 2026

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch release/v1.64.x bruce.bujon/backport-pr-12007
git_commit_date 1784129122 1784898858
git_commit_sha 5b36a52 220be5d
See matching parameters
Baseline Candidate
ci_job_date 1784899938 1784899938
ci_job_id 1890977781 1890977781
ci_pipeline_id 126780277 126780277
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.25 11.0.25
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/consumer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/go/src/github.com/DataDog/apm-reliability/dd-trace-java/platform/src/consumer-benchmark/build/tmp/jmh -Duser.country=US -Duser.language=en -Duser.variant
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.25+9-post-Ubuntu-1ubuntu122.04 11.0.25+9-post-Ubuntu-1ubuntu122.04

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsume unsure
[-19926.623op/s; -1452.894op/s] or [-6.396%; -0.466%]
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsume same

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

Labels

inst: kafka Kafka instrumentation tag: ai generated Largely based on code generated by an AI or LLM type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants