This is an automated email from the ASF dual-hosted git repository.

tompytel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git


The following commit(s) were added to refs/heads/master by this push:
     new a69041f  Improved ignore path regex (#210)
a69041f is described below

commit a69041f377bb3209d488815e5c5c97dbebdf01bf
Author: Tomasz Pytel <tompy...@gmail.com>
AuthorDate: Mon May 30 18:32:37 2022 -0300

    Improved ignore path regex (#210)
    
    * improved ignore path regex
    
    * update test
---
 skywalking/config.py           | 14 ++++++++------
 tests/unit/test_ant_matcher.py |  4 ++++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/skywalking/config.py b/skywalking/config.py
index 7866655..61baf82 100644
--- a/skywalking/config.py
+++ b/skywalking/config.py
@@ -104,12 +104,14 @@ def finalize():
     method = r'^' + '|'.join(s.strip() for s in http_ignore_method.split(',')) 
+ '$'
     path = '^(?:' + \
            '|'.join(  # replaces ","
-               '(?:(?:[^/]+/)*[^/]+)?'.join(  # replaces "**"
-                   '[^/]*'.join(  # replaces "*"
-                       '[^/]'.join(  # replaces "?"
-                           reesc.sub(r'\\\1', s) for s in p2.split('?')
-                       ) for p2 in p1.split('*')
-                   ) for p1 in p0.strip().split('**')
+               '/(?:[^/]*/)*'.join(  # replaces "/**/"
+                   '(?:(?:[^/]+/)*[^/]+)?'.join(  # replaces "**"
+                       '[^/]*'.join(  # replaces "*"
+                           '[^/]'.join(  # replaces "?"
+                               reesc.sub(r'\\\1', s) for s in p3.split('?')
+                           ) for p3 in p2.split('*')
+                       ) for p2 in p1.strip().split('**')
+                   ) for p1 in p0.split('/**/')
                ) for p0 in trace_ignore_path.split(',')
            ) + ')$'
 
diff --git a/tests/unit/test_ant_matcher.py b/tests/unit/test_ant_matcher.py
index 819175a..3de01ad 100644
--- a/tests/unit/test_ant_matcher.py
+++ b/tests/unit/test_ant_matcher.py
@@ -81,6 +81,10 @@ class TestFastPathMatch(unittest.TestCase):
         path = 'eureka/apps/test/list'
         self.assertTrue(fast_path_match(pattern, path))
         path = 'eureka/test/list'
+        self.assertTrue(fast_path_match(pattern, path))
+
+        pattern = 'eureka/*/**/test/**'
+        path = 'eureka/test/list'
         self.assertFalse(fast_path_match(pattern, path))
 
         pattern = '/eureka/**/b/**/*.txt'

Reply via email to