[NO-TICKET] Improve profiling error message when another profiler is present#5375
Conversation
Introduce a new ExistingSignalHandler exception class defined under the Profiling module (Datadog::Profiling::ExistingSignalHandler) to provide better error handling when a pre-existing SIGPROF handler is detected. This allows Ruby code to rescue and handle this specific failure mode with user-friendly messaging. Here's the snippet I was using to test it: ```ruby require 'datadog' Datadog::Profiling::Collectors::CpuAndWallTimeWorker::Testing._native_install_testing_signal_handler Datadog.configure do |c| c.profiling.enabled = true end sleep 1 ```
…stingSignalHandler
The ubuntu default build of Ruby uses `libruby-3.0.so.3.0` which was breaking the spec.
|
Ooops forgot to update the type signatures, will do it tomorrow |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 2f1b386 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
BenchmarksBenchmark execution time: 2026-02-18 12:54:30 Comparing candidate commit 2f1b386 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 2 unstable metrics. |
Typing analysisNote: Ignored files are excluded from the next sections. Untyped methodsThis PR introduces 1 partially typed method, and clears 1 partially typed method. Partially typed methods (+1-1)❌ Introduced:If you believe a method or an attribute is rightfully untyped or partially typed, you can add |
|
(I'm holding off on merging this until after the next release, to avoid any more delays) |
What does this PR do?
This PR replaces the previously not-very-user-friendly message customers saw when they had a conflicting profiler running:
with a much nicer:
Motivation:
As I was trying to fix issues that cause the
CpuAndWallTimeWorkerto fail with a "thread error", this is one of the situations, so we can both improve the message as well as remove it from the list of things that are being reported as thread errors.Change log entry
Yes. Improve profiling error message when another profiler is present
Additional Notes:
N/A
How to test the change?
I've updated the specs to match. Also, here's my small reproducer that can trigger this easily: