When configuring Micrometer to use @Metertag annotation according to the documentation micrometer dependencies missing class SpelValueExpressionResolver even in spring-boot application.
- I propose to add some information into documentation that will describe that
SpelValueExpressionResolver should be implemented independently atm or should be requested in spring-boot project for spring-boot applications.
- In addition, I propose to create example of simple implementation in documentation that does not use
SPEL for cases when the application does not need to calculate the values of tags through SPEL at all.
Rationale
According to the documentation code snippet does not work cause class SpelValueExpressionResolver is missing.
ValueResolver valueResolver = parameter -> "Value from myCustomTagValueResolver [" + parameter + "]";
// Example of a ValueExpressionResolver that uses Spring Expression Language
ValueExpressionResolver valueExpressionResolver = new SpelValueExpressionResolver();
// Setting the handler on the aspect
timedAspect.setMeterTagAnnotationHandler(
new MeterTagAnnotationHandler(aClass -> valueResolver, aClass -> valueExpressionResolver));
Additional context
Im facing this issue with:
- spring-boot 3.5.0
- micrometer 1.15.0
After some research I found that private class exists SpelTagValueExpressionResolver for the spring-boot applications with a bit misspelling name:
- SpelTagValueExpressionResolver in the spring-boot
- SpelValueExpressionResolver in the micrometer documentation
Unfortunately, there is no bean for this class and single usage is here as part of SpanTagAnnotationHandler. May be this class can be created as bean for Timed and Counted aspects as additional changes in spring-boot.
When configuring Micrometer to use
@Metertagannotation according to the documentation micrometer dependencies missing classSpelValueExpressionResolvereven in spring-boot application.SpelValueExpressionResolvershould be implemented independently atm or should be requested in spring-boot project for spring-boot applications.SPELfor cases when the application does not need to calculate the values of tags throughSPELat all.Rationale
According to the documentation code snippet does not work cause class
SpelValueExpressionResolveris missing.Additional context
Im facing this issue with:
After some research I found that private class exists SpelTagValueExpressionResolver for the spring-boot applications with a bit misspelling name:
Unfortunately, there is no bean for this class and single usage is here as part of
SpanTagAnnotationHandler. May be this class can be created as bean for Timed and Counted aspects as additional changes in spring-boot.