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

Instrumentation annotations inheritance is flawed #3549

Closed
JonasKunz opened this issue Mar 5, 2024 · 0 comments · Fixed by #3551
Closed

Instrumentation annotations inheritance is flawed #3549

JonasKunz opened this issue Mar 5, 2024 · 0 comments · Fixed by #3551

Comments

@JonasKunz
Copy link
Contributor

A user in the discussion forums reported broken behaviour for the @CaptureSpan inheritance feature, causing the instrumentation to break with NPEs.

This comes from the fact that for instrumenting methods, we check the entire superclass and interface hierarchy to see if the method overrides any method annotated with @CaptureSpan. When searching for the annotation values, we fail to do the same:

  • We currently only check super-classes and ignore interfaces when searching
  • We stop searching the parents when a parent does not override the method we are searching for: e.g. given the following class hierarchy, the instrumentation on C will break:
class A { @CaptureSpan void foo(){} }
class B extends A { }
class C extends B { void foo(){} }

We should fix the annotation scanning algorithm:

  • Do a breath-first search on the superclasses AND interfaces of the instrumented method
  • Only stop, when we found a method with the annotation we were searching for
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant