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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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-13 20:26:10

Comparing candidate commit 311198d in PR branch di-virtual with baseline commit 34d1947 in branch master.

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

scenario:method instrumentation

  • 🟥 throughput [-25778.973op/s; -24695.177op/s] or [-11.391%; -10.913%]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants