-
Notifications
You must be signed in to change notification settings - Fork 381
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
DEBUG-2334 dynamic instrumentation instrumenter component #4012
Conversation
This component instruments target code, meaning when target method or target line is invoked, the specified callback will be called with information about the program state at the target point (e.g. method parameters for method probe, local variables for line probe).
Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
BenchmarksBenchmark execution time: 2024-10-17 20:01:02 Comparing candidate commit f904292 in PR branch Found 0 performance improvements and 1 performance regressions! Performance is the same for 23 metrics, 2 unstable metrics. scenario:profiler - sample timeline=false
|
This PR has some |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4012 +/- ##
==========================================
- Coverage 97.82% 97.79% -0.04%
==========================================
Files 1327 1337 +10
Lines 79698 80212 +514
Branches 3952 4013 +61
==========================================
+ Hits 77968 78441 +473
- Misses 1730 1771 +41 ☔ View full report in Codecov by Sentry. |
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.
I have a few minor notes regarding code checker variable, but despite that 🟢
duration = Benchmark.realtime do # steep:ignore | ||
rv = super(*args, **kwargs) | ||
end |
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.
I'm not sure this is delegation is correct -- there may be corner cases with args/keyword args; see https://eregon.me/blog/2019/11/10/the-delegation-challenge-of-ruby27.html for details. I think this is a quite sensitive part since getting it wrong means installing a probe can break the app.
(Also @lloeki quite likes this topic so I think he's the person to ping for a quick check on this bit ;D )
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.
This is one of my items to address before initial release, but the "shortcut" is I can just mandate Ruby 3.0+ for DI if this problem is difficult to solve.
Co-authored-by: Ivo Anjo <ivo.anjo@datadoghq.com>
385e486
to
49478bc
Compare
2b6eed6
to
9cb5206
Compare
The DI code being benchmarked does not exist in master, making the baseline benchmark run fail. I will extract it into a separate PR.
9cb5206
to
8ef0a12
Compare
These contain code for line probes and method probes, only method probes are currently enabled becuase more DI code is needed to have line probes work.
* master: (25 commits) lint update method fix unix path regex add back mixed_http_and_uds fix test update tests to match this new world order use uds Fix Intel case Purge circleci cache Udpate ffi to 1.17 for gemfiles/*lock Pin version across rubies Fix labeler Pin bundler version Improve naming for persistent_data arg for appsec waf [🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/11611017851 Update libddwaf gem to v1.15.0.0.0 Add musl keys Reduce requirement to 2.27 Implement requirement.json DEBUG-2334 DI benchmarks extracted from DataDog#4012 (DataDog#4049) ...
Change log entry
None, DI is not yet customer-visible.
What does this PR do?
This component instruments target code, meaning when target method or target line is invoked, the specified callback will be called with information about the program state at the target point (e.g. method parameters for method probe, local variables for line probe).
Motivation:
Initial implementation of Ruby dynamic instrumentation.
Additional Notes:
The instrumenter itself is under 300 lines. Most of the diff is in the test suite.
How to test the change?
This PR includes unit tests, but a large part of instrumentation is dealing with code that is loaded after the instrumentation is installed (since much Ruby code is lazily loaded) and test coverage for this will be added later since it requires more DI components.
Unsure? Have a question? Request a review!