Skip to content

Auto configuration doesn't set CountedMeterTagAnnotationHandler #46964

@etrandafir93

Description

@etrandafir93

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions