Skip to content

[Feature] Use BEST_MATCHING_PATTERN_ATTRIBUTE instead of annotation based route for Spring MVC. #12890

@h0cheung

Description

@h0cheung

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

As for now, skywalking-java gets route by parsing annotations, which won't work well when a method or controller class has multiple routes. In this case, the first route in the annotation will always be used.

Spring will set BEST_MATCHING_PATTERN_ATTRIBUTE after the handler has been matched, which can be used to set the operationName.

org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter#handle is a good entry point to get the attribute. It's also used by the spring mvc plugin of OpenTelemetry.

Use case

No response

Related issues

No response

Are you willing to submit a pull request to implement this on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

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