Skip to content

Commit

Permalink
Fix the ignore_traceids and use_traceids regex patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiodsf committed Oct 11, 2024
1 parent 4fdce20 commit 76cccd5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sourcespec/ssp_process_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,19 +478,25 @@ def _skip_ignored(config, st):
'.'.join((network, station, location, channel)),
]
if config.use_traceids is not None:
# - combine all ignore_traceids in a single regex
# - escape the dots, otherwise they are interpreted as any character
# - add a dot before the first asterisk, to avoid a pattern error
combined = (
"(" + ")|(".join(config.use_traceids) + ")"
).replace('.', r'\.')
).replace('.', r'\.').replace('(*', '(.*')
if not any(re.match(combined, s) for s in ss):
_skip_stream_and_raise(
st,
reason='ignored from config file',
short_reason='ignored from config'
)
if config.ignore_traceids is not None:
# - combine all ignore_traceids in a single regex
# - escape the dots, otherwise they are interpreted as any character
# - add a dot before the first asterisk, to avoid a pattern error
combined = (
"(" + ")|(".join(config.ignore_traceids) + ")"
).replace('.', r'\.')
).replace('.', r'\.').replace('(*', '(.*')
if any(re.match(combined, s) for s in ss):
_skip_stream_and_raise(
st,
Expand Down

0 comments on commit 76cccd5

Please sign in to comment.