Skip to content

Add experimental config for ddprof native memory profiling - #12132

Open
jbachorik wants to merge 8 commits into
masterfrom
jb/nativemem
Open

Add experimental config for ddprof native memory profiling#12132
jbachorik wants to merge 8 commits into
masterfrom
jb/nativemem

Conversation

@jbachorik

@jbachorik jbachorik commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Adds experimental configuration to enable native memory (malloc) allocation tracking in the Datadog profiler (ddprof), and wires it into the native profiler's nativemem=<interval> start argument.

  • dd.profiling.experimental.ddprof.nativemem.enabled (default false)
  • dd.profiling.experimental.ddprof.nativemem.interval (default 524288 bytes)

A new NATIVEMEM ProfilingMode gates the feature, following the same pattern as the existing ALLOCATION/MEMLEAK modes.

Motivation

Native memory allocation tracking is a new capability in ddprof-lib. This exposes it behind an experimental, off-by-default config flag for internal testing.

Additional Notes

No new external dependencies. Feature is disabled by default.

Also fixes a CI false positive in verifyAgentJarIntegrations: the task failed the build whenever any stderr was produced, but the JVM always echoes Picked up JAVA_TOOL_OPTIONS: ... to stderr when that env var is set (e.g. GitLab CI's proxy config), unrelated to actual module load failures. That line is now filtered out before the check.

Contributor Checklist

Wires dd.profiling.experimental.ddprof.nativemem.{enabled,interval} to the
ddprof nativemem= start argument, gated behind a new NATIVEMEM ProfilingMode.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jbachorik jbachorik added type: feature Enhancements and improvements tag: no release notes Changes to exclude from release notes comp: profiling Profiling tag: ai generated Largely based on code generated by an AI or LLM labels Aug 3, 2026
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Bits has a CI fix ready

🟢 Investigated · 🟢 Fix prepared · ⚪ Validation skipped · 🟠 Ready

config-inversion-linter failed because the new ddprof native-memory helpers also accept the normalized profiling.experimental.async.nativemem.* configuration names, but only the ddprof environment variables were documented. Added the matching async configuration metadata entries.

Commit fix to this PR


View in Datadog | Reviewed commit 3f9700e · Any feedback? Reach out in #deveng-pr-agent

@datadog-datadog-prod-us1-2

This comment has been minimized.

jbachorik and others added 2 commits August 4, 2026 13:09
CI proxy config sets JAVA_TOOL_OPTIONS, which the JVM echoes to stderr
on every launch, causing a false-positive module-load-failure error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Aug 4, 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.97 s 14.00 s [-1.0%; +0.6%] (no difference)
startup:insecure-bank:tracing:Agent 12.93 s 13.03 s [-1.5%; -0.1%] (maybe better)
startup:petclinic:appsec:Agent 17.40 s 17.33 s [-0.6%; +1.4%] (no difference)
startup:petclinic:iast:Agent 17.35 s 17.09 s [-2.9%; +5.9%] (no difference)
startup:petclinic:profiling:Agent 17.42 s 16.70 s [-0.1%; +8.7%] (no difference)
startup:petclinic:sca:Agent 16.68 s 17.30 s [-7.9%; +0.7%] (no difference)
startup:petclinic:tracing:Agent 16.63 s 16.71 s [-1.5%; +0.5%] (no difference)

Commit: 6ec0de21 · 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.

@jbachorik
jbachorik marked this pull request as ready for review August 4, 2026 14:19
@jbachorik
jbachorik requested review from a team as code owners August 4, 2026 14:19
@jbachorik
jbachorik requested review from PerfectSlayer and removed request for a team August 4, 2026 14:19

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 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 new native-memory mode is isolated behind an off-by-default flag, emits the configured nativemem interval, and remains safe in the existing profiling-mode consumers. No diff-only behavioral regression was identified; full tests were blocked because the pinned build requires an unavailable Java 25 toolchain and the wrapper distribution could not be downloaded.

Was this helpful? React 👍 or 👎

Open Bits AI session

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

Comment thread dd-java-agent/build.gradle Outdated
// The JVM prints this diagnostic line to stderr whenever JAVA_TOOL_OPTIONS is set in the
// environment (e.g. CI proxy configuration) — it is not a module load failure.
def stderr = capturedError.toString().readLines()
.findAll { !it.startsWith('Picked up JAVA_TOOL_OPTIONS:') }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

❔ question: ‏How is that possible with the JAVA_TOOL_OPTIONS cleared from env few lines above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That location just removes the inherited JAVA_TOOL_OPTIONS - but it gets injected for the new process automatically in the CI runner images. There is nothing we can do not to have that env variable set 🤷

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I had claude analyze and made a reproducer. The fix from #12103 should have fixed it and raised the failure from your branch was before the merge to master. Can you check it's still needed for CI to pass?

cc @sarahchen6 as original fix author

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Trying out

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The build step passes without it :)
Okay, the rest on the CI looks like a 🎄 but… at least it shows the filter is not needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, infra does not have a good day. But yay, the workaround is not needed!

@PerfectSlayer PerfectSlayer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking good. Thanks for the follow up change related to JAVA_TOOL_OPTIONS

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

Labels

comp: profiling Profiling tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants