As far as i can see here from MetricsAspectsAutoConfiguration , whenever we define a MeterTagAnnotationHandler it will be set on the TimedAspect.

However, this is not the case for CountedMeterTagAnnotationHandler and CountedAspect respectively:

public class MetricsAspectsAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    CountedAspect countedAspect(MeterRegistry registry) {
        return new CountedAspect(registry); // <--- can we have the same here?
    }

    @Bean
    @ConditionalOnMissingBean
    TimedAspect timedAspect(MeterRegistry registry,
            ObjectProvider<MeterTagAnnotationHandler> meterTagAnnotationHandler) {
        TimedAspect timedAspect = new TimedAspect(registry);
        meterTagAnnotationHandler.ifAvailable(timedAspect::setMeterTagAnnotationHandler);
        return timedAspect;
    }

}

Consequently, I need to configure the 2 aspects differently to achieve the same result.

Should we add an equivalent version for CountedAspect/ CountedMeterTagAnnotationHandler?

Comment From: wilkinsona

Duplicates https://github.com/spring-projects/spring-boot/pull/46007.