add TaskBlock events for blocking intervals#570
add TaskBlock events for blocking intervals#570kaahos wants to merge 63 commits intomainDataDog/java-profiler:mainfrom paul.fournillon/wallclock-taskblockDataDog/java-profiler:paul.fournillon/wallclock-taskblockCopy head branch name to clipboard
Conversation
|
CI Test ResultsRun: #28245769391 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Failed Testsmusl-aarch64/debug / 25-librcaJob: View logs No detailed failure information available. Check the job logs. musl-aarch64/debug / 8-librcaJob: View logs No detailed failure information available. Check the job logs. musl-aarch64/debug / 21-librcaJob: View logs No detailed failure information available. Check the job logs. musl-aarch64/debug / 17-librcaJob: View logs No detailed failure information available. Check the job logs. musl-aarch64/debug / 11-librcaJob: View logs No detailed failure information available. Check the job logs. Summary: Total: 32 | Passed: 27 | Failed: 5 Updated: 2026-06-26 15:08:21 UTC |
bcf3c2b to
a46d368
Compare
3f2f71a to
d1e3210
Compare
|
@copilot review this PR |
Reviewed and found a flaky assertion in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d21e4936d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
2101007 to
a94677a
Compare
a94677a to
681582c
Compare
…concurrency coverage test
e760331 to
a7f38f6
Compare
68fa059 to
fdbbbe8
Compare
fdbbbe8 to
c862039
Compare
3891f63 to
bb6c93b
Compare
rkennke
left a comment
There was a problem hiding this comment.
That is a good improvement, and I only found relatively minor issues (so far) - see below.
| } | ||
| u64 t1 = TSC::ticks(); | ||
| if (NativeSocketSampler::active()) { | ||
| return NativeSocketSampler::recordHookResult(fd, ret, t0, t1, op); |
There was a problem hiding this comment.
I believe you need an ErrnoGuard around the recordHookResult() call, otherwise, otherwise we'd lose errno.
| block.endTicks, | ||
| BLOCKER_WITHOUT_STACK, | ||
| UNBLOCKING_SPAN_ID, | ||
| ROOT_SPAN_ID, |
There was a problem hiding this comment.
The order of spanId and rootSpanId is swapped. This is invisible because both constants are 0. Therefore you should probably also test spanId != rootSpanId.
| block.endTicks, | ||
| BLOCKER_WITH_STACK, | ||
| UNBLOCKING_SPAN_ID, | ||
| ROOT_SPAN_ID, |
| static const uint8_t FD_TYPE_NON_SOCKET = 4; | ||
|
|
||
| std::atomic<uint32_t> _fd_cache_gen{1}; | ||
| std::atomic<uint32_t> _fd_type_cache[FD_TYPE_CACHE_SIZE]; |
There was a problem hiding this comment.
This whole fd-type-cache looks to be the same as the one in NativeSocketSampler, could/should they be shared instead? I.e. a single cache in one place, and also used by the other? Maybe even extracted into a class of its own?
What does this PR do?:
Adds
datadog.TaskBlockJFR events for blocking intervals such asLockSupport.park,Object.wait, monitor contention, including recording APIs used bydd-trace-javafor instrumented blocking operations such asThread.sleep.Motivation:
This builds on
paul.fournillon/wallclock-suppression(#560) by preserving visibility into blocked spans as explicit duration events.Additional Notes:
This PR does not add the dd-trace-java instrumentation itself;
Thread.sleepemission depends on that side calling the new profiler APIs. Monitor callback support is HotSpot-specific, and virtual-thread carrier attribution is avoided.How to test the change?:
./.claude/commands/build-and-summarize :ddprof-test:testDebug -Ptests="*.wallclock.*TaskBlockTest"./.claude/commands/build-and-summarize :ddprof-lib:gtestDebugFor Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance.Unsure? Have a question? Request a review!