Skip to content

Missing class SpelValueExpressionResolver from documentation #6465

@a-simeshin

Description

@a-simeshin

When configuring Micrometer to use @Metertag annotation according to the documentation micrometer dependencies missing class SpelValueExpressionResolver even in spring-boot application.

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    doc-updateA documentation update

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions