-
Notifications
You must be signed in to change notification settings - Fork 375
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
[PROF-10241] Extract profiler at_fork
monkey patch to utils
#3829
Merged
Commits on Aug 7, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 4ef6a14 - Browse repository at this point
Copy the full SHA 4ef6a14View commit details -
Configuration menu - View commit details
-
Copy full SHA for b41e2f2 - Browse repository at this point
Copy the full SHA b41e2f2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 49e9f1c - Browse repository at this point
Copy the full SHA 49e9f1cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 073ba72 - Browse repository at this point
Copy the full SHA 073ba72View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8351f66 - Browse repository at this point
Copy the full SHA 8351f66View commit details -
Configuration menu - View commit details
-
Copy full SHA for e5b4d07 - Browse repository at this point
Copy the full SHA e5b4d07View commit details -
Configuration menu - View commit details
-
Copy full SHA for f1b8b80 - Browse repository at this point
Copy the full SHA f1b8b80View commit details -
This typechecking skeleton doesn't actually work, so let's remove it until we can write a proper one.
Configuration menu - View commit details
-
Copy full SHA for 699af6b - Browse repository at this point
Copy the full SHA 699af6bView commit details -
[PROF-10241] Extract profiler
at_fork
monkey patch to utils**What does this PR do?** This PR extracts the profiler `Datadog::Profiling::Ext::Forking` monkey patch to now live under `Datadog::Core::Utils::AtForkMonkeyPatch`. It also does a clean up pass on some of the comments and specs, as well as rename some of the modules used for the actual monkey patching. **Motivation:** This monkey patch provides a `datadog_at_fork` mechanism that can be used to run code just after a process gets forked. Here's a quick example: ```ruby $ bundle exec pry [1] pry(main)> require 'datadog/core/utils/at_fork_monkey_patch' => true [2] pry(main)> Datadog::Core::Utils::AtForkMonkeyPatch.apply! => true [3] pry(main)> Process.datadog_at_fork(:child) { puts "This code is running in a child process!" } => nil [4] pry(main)> fork { puts "Hello from fork" } This code is running in a child process! Hello from fork => 447306 ``` Up until now, only the profiler needed this behavior of getting auto-started right after a process forks. Every other component of ddtrace lazily waited until it got called again (e.g. the tracing bits would not get re-initialized until you tried to call the tracer). With the introduction of the crashtracker, we also want the crashtracker to auto-start after a fork, so I'm extracing the monkey patch so we can use it on that component as well. **Additional Notes:** I'm preparing a follow-up PR to add support for `Process._fork`. It's been a long time coming, and it's not that big of a change. **How to test the change?** Our existing specs already cover this change. Also see the example above.
Configuration menu - View commit details
-
Copy full SHA for 9f1d53d - Browse repository at this point
Copy the full SHA 9f1d53dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 216bc8b - Browse repository at this point
Copy the full SHA 216bc8bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 480fcf0 - Browse repository at this point
Copy the full SHA 480fcf0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 473833b - Browse repository at this point
Copy the full SHA 473833bView commit details -
Minor: Bootstrap empty rbs file
I did not realize we had a check for this ;)
Configuration menu - View commit details
-
Copy full SHA for 4c69eb3 - Browse repository at this point
Copy the full SHA 4c69eb3View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.