Skip to content

Ignore AntPathMatcher Matching does not meet expectations #2688

@hlg212

Description

@hlg212

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • Bug

Bug

  • Which version of SkyWalking, OS and JRE?
    apache-skywalking-apm-6.1.0

  • What happen?
    apm-trace-ignore-plugin-6.1.0

org.apache.skywalking.apm.plugin.trace.ignore.matcher.AntPathMatcher(IgnoreAntPathMatcher)
org.springframework.util.AntPathMatcher (SpringAntPathMatcher)

IgnoreAntPathMatcher and SpringAntPathMatcher show inconsistent performance

I copied the IgnoreAntPathMatcher source code and tested it.
cod:

private static IgnoreAntPathMatcher MpathMatcher = new IgnoreAntPathMatcher();
   private static AntPathMatcher antPathMatcher = new AntPathMatcher();
   public static void main(String str[])
   {
       String operationName ="/rtp/topic/findPage";
       String pattens = "/**/svn/**";
        if (!StringUtil.isEmpty(pattens)) {
           String path = operationName;
           if (!StringUtil.isEmpty(path) && path.length() > 1 && path.endsWith("/")) {
               path = path.substring(0, path.length() - 1);
           }

           for (String pattern : pattens.split(",")) {
               if (antPathMatcher.match(pattern, path)) {  //false
                  log.info("antPathMatcher operationName : " + operationName + " Ignore tracking");
               }
           }
            for (String pattern : pattens.split(",")) {
                if (MpathMatcher.match(pattern, path)) {   // true
                    log.info("MpathMatcher operationName : " + operationName + " Ignore tracking"); // 11:30:37.189 [main] INFO IgnorePathTest - MpathMatcher operationName : /rtp/topic/findPage Ignore tracking
                }
            }
       }
   }

I think SpringAntPathMatcher meets my matching requirements better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionEnd user question and discussion.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions