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

Allow tagsBasedOnJoinPoint to override extraTags with CountedAspect #2461

Closed
kinddevil opened this issue Feb 20, 2021 · 2 comments · Fixed by #2462
Closed

Allow tagsBasedOnJoinPoint to override extraTags with CountedAspect #2461

kinddevil opened this issue Feb 20, 2021 · 2 comments · Fixed by #2462
Assignees
Labels
enhancement A general enhancement module: micrometer-core An issue that is related to our core module
Milestone

Comments

@kinddevil
Copy link
Contributor

When overwriting the extraTags in Aspect, the behavior is different - extraTags can be replaced in the TimedAspect but in CountedAspect as below.

I have a function with extra tags like

@Timed(extraTags = {"extra", "A"})
@Counted(extraTags = {"extra", "B"})
public void recordMetrics() {
...
}

When I overwrite the extra tag in TimedAspect

@Bean
  public TimedAspect timedAspect(MeterRegistry registry) {
    return new TimedAspect(registry, p -> Arrays.asList(Tag.of("extra", "AA"));
  }

The extra changed to AA successfully.
But when I use some similar code in CountedAspect it failed.

  @Bean
  public CountedAspect countedAspect(MeterRegistry registry) {
    return new CountedAspect(registry,  p -> Arrays.asList(Tag.of("extra", "BB"));
  }

The value is still B.

It is because of the different orders when applying the ProceedingJoinPoint tags

and .

Can we make them in the same order?

@kinddevil
Copy link
Contributor Author

There is a fix for the issue #2462, can someone take a look? Thank you!

@kinddevil kinddevil changed the title Divergency between TimedAspect and CountedAspect during overwriting extraTags Divergence between TimedAspect and CountedAspect during overwriting extraTags Feb 20, 2021
@kinddevil
Copy link
Contributor Author

Hi @shakuzen, do you have any suggestions for this issue?

@marcingrzejszczak marcingrzejszczak added enhancement A general enhancement and removed waiting-for-triage labels Dec 22, 2023
@shakuzen shakuzen added this to the 1.x milestone Oct 11, 2024
@shakuzen shakuzen added the module: micrometer-core An issue that is related to our core module label Oct 11, 2024
@shakuzen shakuzen modified the milestones: 1.x, 1.14.0-RC1 Oct 11, 2024
@shakuzen shakuzen changed the title Divergence between TimedAspect and CountedAspect during overwriting extraTags Align TimedAspect and CountedAspect precedence of extraTags and tagsBasedOnJoinPoint Oct 11, 2024
@jonatan-ivanov jonatan-ivanov changed the title Align TimedAspect and CountedAspect precedence of extraTags and tagsBasedOnJoinPoint Fix divergency of extra tags between TimedAspect and CountedAspect Oct 11, 2024
@shakuzen shakuzen changed the title Fix divergency of extra tags between TimedAspect and CountedAspect Allow tagsBasedOnJoinPoint to override extraTags with CountedAspect Oct 12, 2024
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 a pull request may close this issue.

4 participants