Draft
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e7113c2 to
d981e16
Compare
Contributor
CI Test ResultsRun: #24504036411 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Summary: Total: 32 | Passed: 31 | Failed: 0 | Cancelled: 1 Updated: 2026-04-16 13:01:58 UTC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?:
Adds two pre-start sanity checks that gate profiler initialization (cpu, wallclock, allocation, live heap):
min(logical_cores, cgroup_cpu_quota_in_millicores / 1000). Reads cgroup v2cpu.maxwith v1cpu.cfs_quota_us/periodfallback.min(physical_RAM - 128MB, container_memory_limit)). Reads cgroup v2memory.maxwith v1memory.limit_in_bytesfallback.When either check fails, the profiler logs a WARN to stderr and returns an Error (surfaces as
IllegalStateExceptionon the Java side) containing a structured[sanity]message with full system details (cpu=ok/fail, memory=ok/fail, all metrics) for telemetry ingestion by dd-trace-java.A single
nosanityargument disables both checks. Checks run on first initialization only; the result is cached across start/stop cycles.Resolves #480
Motivation:
JIRA: PROF-13027 — Prevent the profiler from running on systems with insufficient resources, which can cause OOM kills, excessive CPU contention, or degraded application performance.
Additional Notes:
sanityCheck.h,sanityCheck.cpp— encapsulates both checksos.h,os_linux.cpp,os_macos.cpp— cgroup CPU/memory limit APIsarguments.h,arguments.cpp—nosanityflag parsingprofiler.cpp— gate inProfiler::start()with cached resultVMFlag::find()APIOS::getBasicProcessInfo()with fallback to 200[sanity] cpu=fail,memory=ok,logical_cores=4,cgroup_millicores=500,...,containerized=trueHow to test the change?:
SanityCheckTest.java: verifynosanitybypasses checks,nosanity=trueworks, and checks run only once across stop/start cycles--cpus=0.5or--memory=256mand observe WARN +IllegalStateExceptionwith structured telemetrynosanityto the profiler arguments to confirm override worksFor Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance.🤖 Generated with Claude Code via muse implement