Skip to content
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 repair instrumentation of virtual and later-defined methods #4106

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

p-datadog
Copy link
Contributor

@p-datadog p-datadog commented Nov 13, 2024

What does this PR do?

This PR changes DI instrumentation to not fail if the current definition of a method is not available, when installing method probes.

Motivation:
DI instrumentation code assumed it was able to obtain the current definition of the target method for method probes. This is not correct when 1) class is defined but the target method is not (perhaps because the method would be defined later), and 2) when the method is virtual and handled by method_missing.

Change log entry
None

Additional Notes:

For virtual and later-defined methods, the stack trace reported to backend currently would not include the method itself (since we don't have its definition to get its location from). Later if/when begin/end trace points are added to method instrumentation we should be able to obtain the actual method location at probe invocation time and fill in the top stack frame then.

How to test the change?

Unit tests are included

@p-datadog p-datadog requested a review from a team as a code owner November 13, 2024 02:48
@pr-commenter
Copy link

pr-commenter bot commented Nov 13, 2024

Benchmarks

Benchmark execution time: 2024-11-15 17:52:46

Comparing candidate commit e76966b in PR branch di-virtual with baseline commit a7c5f81 in branch master.

Found 1 performance improvements and 0 performance regressions! Performance is the same for 28 metrics, 2 unstable metrics.

scenario:tracing - Propagation - Trace Context

  • 🟩 throughput [+3169.162op/s; +3291.205op/s] or [+9.145%; +9.498%]

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.78%. Comparing base (a7c5f81) to head (e76966b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4106      +/-   ##
==========================================
- Coverage   97.78%   97.78%   -0.01%     
==========================================
  Files        1350     1350              
  Lines       81229    81263      +34     
  Branches     4106     4108       +2     
==========================================
+ Hits        79432    79462      +30     
- Misses       1797     1801       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@p-datadog p-datadog merged commit 8015804 into master Nov 15, 2024
266 checks passed
@p-datadog p-datadog deleted the di-virtual branch November 15, 2024 18:19
@github-actions github-actions bot added this to the 2.8.0 milestone Nov 15, 2024
@p-datadog p-datadog added the dev/internal Other internal work that does not need to be included in the changelog label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/internal Other internal work that does not need to be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants