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

SpanAspect does not take into account proxy objects #544

Open
lex-em opened this issue Jan 19, 2024 · 5 comments
Open

SpanAspect does not take into account proxy objects #544

lex-em opened this issue Jan 19, 2024 · 5 comments

Comments

@lex-em
Copy link

lex-em commented Jan 19, 2024

Hello. I tried to use @NewSpan on spring data repositories, but it idin't work

NewSpan newSpan = method.getAnnotation(NewSpan.class);

method here is from proxy and annotation not found.

I fixed that by using org.apache.commons.lang3.reflect.MethodUtils.getAnnotation(method, NewSpan::class.java, true, true)

Please fix them in library

@marcingrzejszczak
Copy link
Contributor

Can you create a simple reproducer for this issue or a test that shows that this doesn't work?

@lex-em
Copy link
Author

lex-em commented Jan 23, 2024

@marcingrzejszczak reproducer with instructions in readme is here https://github.com/lex-em/micrometer-tracing-on-proxy
CustomSpanAspect class contains additional comments

@marcingrzejszczak
Copy link
Contributor

@shakuzen @jonatan-ivanov what is your opinion on adding a dependency to apache commons to have this functionality? I guess we would need to do the same in micrometer for those aspects

@jonatan-ivanov
Copy link
Member

I'm thinking if:

  1. We can copy that single method: getAnnotation
  2. Document that methods like these should be either wrapped or .observed(methodReference) should be used
  3. Instrument Spring Data repositories

@marcingrzejszczak
Copy link
Contributor

That's not copying of just a single method 😬

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

No branches or pull requests

3 participants