Closed siyigao121212 closed 8 months ago
This isn't immediately helpful to you, but to record the relation – prefix glob matches #481 would also solve this particular situation, by removing the need to use regex matches at all.
I'm not sure about allowing to swap the evaluation order – it's this way, because glob matches are significantly faster; but if the performance of regex matching is sufficient for you, you can use regexes for both rules.
As for exclusions, I can see that this would be useful. I'll change the title of this issue to make it about that (since we already have one for prefix matches, and I don't want to make the priority configurable). If anyone wants it enough to contribute that, please do 😄
As a word of caution, the glob matching is a very hot code path and needs to stay efficient. We need to find a way to handle this as part of the state machine for glob matching somehow. Please include benchmarks 😄
I suspect if someone needs one exclusion, they are also likely to need multiple, like
- match: a.*.*
exclude:
- a.*.b
- a.*.c
On second thought, I think prefix matches are the solution here, and would be required to make the exclusion work in your case. Additionally, now that I think about it, a more specific glob match works as an exclusion, so the example above would be handled already by
- match: a.*.*
…
- match: a.*.b
…
- match: a.*.c
…
To make your example work, you would need
- match: a.*.*
…
- match: a.*.c_*
…
which is what #481 is about.
Thanks @matthiasr for the response. I tried with a.*.c_*
but it says as below. My statsd version is v0.24.0.
msg="error loading config" error="invalid match: a.*.c_*"
So we need to wait for the prefix matches feature?
I have two mapping rules, one is global mapping rule, another is regex mapping rule
now I have a stats, a.b.c_100, what I want is a_c{testname:b, test_count:100}, but I got a_c_100{testname:b}, it's because the global rules executed before the regex rules, how could I give priority to the regex one. I tried with change the order, but it didn't work. Another question is could we add exclusion for the global mapping rules? Then we could exclude the particular rule from the global mapping rules. Thanks.