Matches returns true if the given span matches the policy.
(attrs []*commonv1.KeyValue)
| 20 | |
| 21 | // Matches returns true if the given span matches the policy. |
| 22 | func (p *AttributePolicyMatch) Matches(attrs []*commonv1.KeyValue) bool { |
| 23 | // If there are no filters, then the span matches. |
| 24 | if len(p.filters) == 0 { |
| 25 | return true |
| 26 | } |
| 27 | |
| 28 | // If there are no attributes, then the span does not match. |
| 29 | if len(attrs) == 0 { |
| 30 | return false |
| 31 | } |
| 32 | |
| 33 | for _, pa := range p.filters { |
| 34 | if !matchesAnyFilter(pa, attrs) { |
| 35 | return false |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | return true |
| 40 | } |
| 41 | |
| 42 | func matchesAnyFilter(pa AttributeFilter, attrs []*commonv1.KeyValue) bool { |
| 43 | for _, attr := range attrs { |