-
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-10 17:48:55 Comparing candidate commit 7a03e21 in PR branch Found 5 performance improvements and 8 performance regressions! Performance is the same for 40 metrics, 2 unstable metrics. scenario:benching deserializing traces from msgpack to their internal representation
scenario:benching serializing traces from their internal representation to msgpack
scenario:concentrator/add_spans_to_concentrator
scenario:credit_card/is_card_number/ 378282246310005
scenario:credit_card/is_card_number/378282246310005
scenario:normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000...
scenario:normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters
scenario:normalization/normalize_service/normalize_service/[empty string]
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
BaselineOmitted due to size. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1252 +/- ##
==========================================
+ Coverage 71.65% 71.79% +0.13%
==========================================
Files 355 360 +5
Lines 56317 57339 +1022
==========================================
+ Hits 40354 41165 +811
- Misses 15963 16174 +211
🚀 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
6215e87
to
a530d99
Compare
a530d99
to
7b66803
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)
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_stacks
field in theExperimental
field. If runtimes choose to emit frames one by one usingddog_RuntimeStackFrame
, theruntime_stacks
field will be nicely propagated. If they choose to dump the whole traceback string, additional parsing will have to be implemented in theReceiver
side 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-py
consuming this API in this experimental PR: DataDog/dd-trace-py#14765By triggering tests here, we can see outputted
Experimental
fields: