-
Notifications
You must be signed in to change notification settings - Fork 15
[crashtracking] Allow runtimes to register runtime stack collection callbacks #1252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
BenchmarksComparisonBenchmark execution time: 2025-10-24 14:10:55 Comparing candidate commit bc09cd5 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 55 metrics, 2 unstable metrics. CandidateCandidate benchmark detailsGroup 1
Group 2
Group 3
Group 4
Group 5
Group 6
Group 7
Group 8
Group 9
Group 10
Group 11
Group 12
Group 13
Group 14
Group 15
Group 16
Group 17
BaselineOmitted due to size. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1252 +/- ##
==========================================
- Coverage 71.80% 71.72% -0.09%
==========================================
Files 368 372 +4
Lines 57967 58586 +619
==========================================
+ Hits 41626 42021 +395
- Misses 16341 16565 +224
🚀 New features to boost your workflow:
|
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
aa11ce8 to
3ee9ed8
Compare
2846753 to
5fad559
Compare
| if is_runtime_callback_registered() { | ||
| emit_runtime_stack(pipe)?; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point to send it once we've done every thing else (in case the callback is not signal-safe and block the thread)
When the feature is available, we would encourage libraries to add a flag so this feature is disable if an issue occurs (avoiding releasing a new version)
9f05ba9 to
bc09cd5
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |

What does this PR do?
This PR allows runtimes to register a callback to extract runtime stack. They can choose either to emit frames frame by frame, or to dump a whole stacktrace string. The important contract is that the logic to retrieve the runtime stack is happening within a fork of the crashing process, from a signal handler, so it must be async-signal-safe.
Currently, we add runtime stacks as a new
runtime_stacksfield in theExperimentalfield. If runtimes choose to emit frames one by one usingddog_RuntimeStackFrame, theruntime_stacksfield will be nicely propagated. If they choose to dump the whole traceback string, additional parsing will have to be implemented in theReceiverside appropriate for each different runtime's style/syntax of tracebacks.Motivation
Current crash tracking captures only native stack traces, which are insufficient for applications using interpreted languages. When a Python/Ruby/PHP application crashes, developers need visibility into both:
Without runtime stack traces, debugging crashes in interpreted languages is significantly hampered as the native stack only shows interpreter internals and native extension modules, not the actual application code execution path.
Additional Notes
Anything else we should know when reviewing?
How to test the change?
Unit tests.
There is a very dummy implementation of
dd-trace-pyconsuming this API in this experimental PR: DataDog/dd-trace-py#14765By triggering a crash with the tracer and agent attached, we can see outputted
Experimentalfields: