Skip to content

Allow tagsBasedOnJoinPoint to override extraTags with CountedAspect #2461

Closed

Description

@kinddevil

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?

Activity

  1. kinddevil commented on Feb 20, 2021

    @kinddevil
    ContributorAuthor

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

  2. changed the title [-]Divergency between TimedAspect and CountedAspect during overwriting extraTags[/-] [+]Divergence between TimedAspect and CountedAspect during overwriting extraTags[/+] on Feb 20, 2021
  3. kinddevil commented on Feb 24, 2021

    @kinddevil
    ContributorAuthor

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

  4. added this to the 1.x milestone on Oct 11, 2024
  5. modified the milestones: 1.x, 1.14.0-RC1 on Oct 11, 2024
  6. changed the title [-]Divergence between TimedAspect and CountedAspect during overwriting extraTags[/-] [+]Align TimedAspect and CountedAspect precedence of extraTags and tagsBasedOnJoinPoint[/+] on Oct 11, 2024
  7. changed the title [-]Align TimedAspect and CountedAspect precedence of extraTags and tagsBasedOnJoinPoint[/-] [+]Fix divergency of extra tags between TimedAspect and CountedAspect[/+] on Oct 11, 2024
  8. changed the title [-]Fix divergency of extra tags between TimedAspect and CountedAspect[/-] [+]Allow tagsBasedOnJoinPoint to override extraTags with CountedAspect[/+] on Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions