-
Notifications
You must be signed in to change notification settings - Fork 26
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
Handling methods annotated within an impl block #139
Comments
as we cannot access the outer |
The risk with removing the information in all cases is that it might create conflicts with metric names which would lead to wrong reporting, if you have multiple methods with the same name in the same module (but scoped for different structs), like for example in This actually also highlight the possible issues with multiple traits definining methods with the same name, but we can also choose to solve that later (Should the function name actually be |
Hello @gagbo, I am new to open-sourcing and this is my first time contributing to Autometrics. I have opened a PR which solves this issue. Please let me know if I need to make any further changes or it's ready to be merged 😊. |
The issue
There is a small inconsistency that might need to be resolved when annotating a complete
impl
block vs. annotating a method within the block:will produce metrics with
whereas
will produce metrics with
In the second case we should also have the
Fitz::
prefix but it doesn’t appear.It cannot be solved without user input
The issue in the second case here is that the proc-macro cannot access code outside of its scope to find the parent
impl Fitz
clause. I don’t think there is a way to still just have the bare#[autometrics]
annotation and work out the parent class name in the macro code.A proposal
Besides documenting this limitation and advising splitting
impl
blocks so that all autometrics functions live within an annotatedimpl
block, we could also maybe add an extra argument to the macro liketo restore the labelling for these cases. What do you think?
The text was updated successfully, but these errors were encountered: