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

Avoid needing compiler parameter metadata in CountedAspect #3780

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

shakuzen
Copy link
Member

@shakuzen shakuzen commented Apr 20, 2023

Info about the parameter name is not necessarily available unless we compile with -parameters. Explicitly give argNames to avoid needing to compile with -parameters.

This is technically breaking public API, but an Aspect class should generally only have its constructor(s) called by users, so I felt this shouldn't be a problem even in a patch release. Let me know if anyone disagrees.
Thanks to @sbrannen's suggestion, we can make an alternate change that maintains the API signature.

See #3776

@shakuzen shakuzen added enhancement A general enhancement module: micrometer-core An issue that is related to our core module labels Apr 20, 2023
@shakuzen shakuzen added this to the 1.10.7 milestone Apr 20, 2023
@Around("@annotation(counted)")
public Object interceptAndRecord(ProceedingJoinPoint pjp, Counted counted) throws Throwable {
@Around("@annotation(io.micrometer.core.annotation.Counted)")
public Object interceptAndRecord(ProceedingJoinPoint pjp) throws Throwable {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to keep the signature as it was without requiring -parameters, does the following meet your needs?

    @Around(value = "@annotation(counted)", argNames = "counted")
    public Object interceptAndRecord(ProceedingJoinPoint pjp, Counted counted) throws Throwable {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like it should work. Thank you for the suggestion. Let's try that.

Info about the parameter name is not necessarily available unless we compile with `-parameters`. Explicitly give `argNames` to avoid needing to compile with `-parameters`.
@shakuzen shakuzen changed the title Avoid referencing parameter name in CountedAspect Avoid needing compiler parameter metadata in CountedAspect Apr 20, 2023
@shakuzen shakuzen merged commit 725274a into micrometer-metrics:1.10.x Apr 20, 2023
1 check passed
@shakuzen shakuzen deleted the counted-named-param branch April 20, 2023 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A general enhancement module: micrometer-core An issue that is related to our core module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants