devkanro commented on a change in pull request #81:
URL: https://github.com/apache/skywalking-java/pull/81#discussion_r766490405
##########
File path:
apm-sniffer/optional-plugins/trace-ignore-plugin/src/main/java/org/apache/skywalking/apm/plugin/trace/ignore/matcher/FastPathMatcher.java
##########
@@ -84,6 +84,22 @@ private boolean normalMatch(String pat, int p, String str,
int s) {
private boolean wildcardMatch(String pat, int p, String str, int s) {
char pc = safeCharAt(pat, p);
+ // End of pattern, check string only has zero or one '/' at end.
Review comment:
If we get EOS(end of string) when we enter wildcard match state.
We just check the string only has zero or one '/' at end.
##########
File path:
apm-sniffer/optional-plugins/trace-ignore-plugin/src/main/java/org/apache/skywalking/apm/plugin/trace/ignore/matcher/FastPathMatcher.java
##########
@@ -122,9 +138,11 @@ private boolean wildcardMatch(String pat, int p, String
str, int s) {
}
private boolean multiWildcardMatch(String pat, int p, String str, int s) {
- // End of pattern, just check the end of string is '/' quickly.
- if (p >= pat.length() && s < str.length()) {
- return str.charAt(str.length() - 1) != '/';
+ switch (safeCharAt(pat, p)) {
+ // End of pattern, just return true quickly.
+ case 0: return true;
Review comment:
If we get EOS when we enter multi-wildcard match state, return true
quickly, because `**` mean anything
##########
File path:
apm-sniffer/optional-plugins/trace-ignore-plugin/src/main/java/org/apache/skywalking/apm/plugin/trace/ignore/matcher/FastPathMatcher.java
##########
@@ -122,9 +138,11 @@ private boolean wildcardMatch(String pat, int p, String
str, int s) {
}
private boolean multiWildcardMatch(String pat, int p, String str, int s) {
- // End of pattern, just check the end of string is '/' quickly.
- if (p >= pat.length() && s < str.length()) {
- return str.charAt(str.length() - 1) != '/';
+ switch (safeCharAt(pat, p)) {
+ // End of pattern, just return true quickly.
+ case 0: return true;
+ // Skip next '/' for pattern to match zero path part.
+ case '/': p++;
Review comment:
Add this branch to support `eureka/**/test` matches `eureka/test` (**
means zero path part)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]