Created strongly typed PolicyMatch struct from policy config to match values - #3025
Conversation
joe-elliott
left a comment
There was a problem hiding this comment.
thx for the improvements!
as far as i can tell there should be no change to a user's config correct? the old config will parse and work just fine?
this seems like it would result in some nice perf improvements. dropping the reflection and only doing the regex once. if you had time for benchmarks that would be cool, but no worries if you're busy.
i have one suggestion regarding the interface. i think it would help me see the structure of code better. do you think it makes sense?
zalegrala
left a comment
There was a problem hiding this comment.
This looks like a nice change to me, good work. Thanks for the PR.
|
@joe-elliott |
joe-elliott
left a comment
There was a problem hiding this comment.
It's looking good. I think the code in attribute.go/intrinsic.go is much more straightforward with your changes.
Looking for some cleanup in splitpolicy.go. Other than that I think this is good to go. Given how we much we rely on this feature I will run it in some on some of our internal clusters after the next round of changes. If everything is looking good then I think this will be ready.
Yup, this times out |
joe-elliott
left a comment
There was a problem hiding this comment.
You've gotten this PR into a really nice spot. Code is clear and I love the benchmarks.
I'm going to approve, but not merge just yet to give some maintainers with more experience in this area a chance to review.
|
Thanks for the contribution! I think everyone will enjoy the more performant filters. |
… values (grafana#3025) * policy match attr struct * optimizations * optimizations * separate policy matches for intrinsics & attributes * CHANGELOG * comment on benchmarks * linter fixes * building split policy intrinsic filters by attr.Intrinsic value * revert pointer * AttributeFilter do not match by status/kind, just string * errors for default filter construction cases * newSplitPolicy tests * constructor NewStrictIntrinsicFilter * safe casts * removed unnecessary intrinsic filter ctor value type checks * splitpolicy scoped attributes tests * invalid regexp tests
What this PR does:
Introduced
AttributePolicyMatch&IntrinsicPolicyMatchstructures to match span attributes based on strongly typed values & precompiled regex which are used to match span attribute values.Which issue(s) this PR fixes:
Fixes #3015
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]