Skip to content

Conversation

@ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Oct 24, 2025

What does this PR do?

This PR extends the timeline thread state categorization code to recognize two frames from the profiler.

Motivation:

These two frames quite commonly show up on application profiles, and so its useful for them to be correctly categorized.

Change log entry

Yes. Fix profiler not categorizing its own sleep/waiting in timeline

Additional Notes:

Getting a thread inside the _native_sampling_loop for testing in this case is quite awkward so I only added test coverage for the _native_idle_sampling_loop which is quite easy to trigger.

How to test the change?

This tiny test script produced samples from both of these frames that were uncategorized:

DD_PROFILING_ENABLED=true DD_SERVICE=ivoanjo-testing-categ-fix bundle exec ddprofrb exec ruby -e "end_at = Time.now + 3; while Time.now < end_at; end"

Here's how it looked before:

image image

and how it looks now:

image image

…imeline

**What does this PR do?**

This PR extends the timeline thread state categorization code to
recognize two frames from the profiler.

**Motivation:**

These two frames quite commonly show up on application profiles, and
so its useful for them to be correctly categorized.

**Additional Notes:**

Getting a thread inside the `_native_sampling_loop` for testing in
this case is quite awkward so I only added test coverage for the
`_native_idle_sampling_loop` which is quite easy to trigger.

**How to test the change?**

This tiny test script produced samples from both of these frames
that were uncategorized:

```
DD_PROFILING_ENABLED=true DD_SERVICE=ivoanjo-testing-categ-fix bundle exec ddprofrb exec ruby -e "end_at = Time.now + 3; while Time.now < end_at; end"
```
@ivoanjo ivoanjo requested review from a team as code owners October 24, 2025 10:08
@github-actions github-actions bot added the profiling Involves Datadog profiling label Oct 24, 2025
@datadog-datadog-prod-us1
Copy link
Contributor

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 100.00%
Total Coverage: 98.45% (+0.01%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 883c378 | Docs | Was this helpful? Give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Oct 24, 2025

Benchmarks

Benchmark execution time: 2025-10-24 10:35:41

Comparing candidate commit 883c378 in PR branch ivoanjo/prof-12846-incorrect-state-category with baseline commit 7e292a6 in branch master.

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

scenario:profiling - Allocations ()

  • 🟩 throughput [+371394.072op/s; +394651.168op/s] or [+12.795%; +13.596%]

@ivoanjo ivoanjo merged commit 7d06c15 into master Oct 24, 2025
558 checks passed
@ivoanjo ivoanjo deleted the ivoanjo/prof-12846-incorrect-state-category branch October 24, 2025 16:17
@github-actions github-actions bot added this to the 2.23.0 milestone Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

profiling Involves Datadog profiling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants