MCPcopy
hub / github.com/grafana/tempo / matchesAnyFilter

Function matchesAnyFilter

pkg/spanfilter/policymatch/attribute.go:42–62  ·  view source on GitHub ↗
(pa AttributeFilter, attrs []*commonv1.KeyValue)

Source from the content-addressed store, hash-verified

40}
41
42func matchesAnyFilter(pa AttributeFilter, attrs []*commonv1.KeyValue) bool {
43 for _, attr := range attrs {
44 // If the attribute key does not match, then it cannot match the policy.
45 if pa.key != attr.Key {
46 continue
47 }
48 switch pa.typ {
49 case StringAttributeFilter:
50 return pa.stringValue == attr.Value.GetStringValue()
51 case Int64AttributeFilter:
52 return pa.int64Value == attr.Value.GetIntValue()
53 case Float64AttributeFilter:
54 return pa.float64Value == attr.Value.GetDoubleValue()
55 case BoolAttributeFilter:
56 return pa.boolValue == attr.Value.GetBoolValue()
57 case RegexAttributeFilter:
58 return pa.regex.MatchString(attr.Value.GetStringValue())
59 }
60 }
61 return false
62}
63
64type AttributeFilterType int
65

Callers 1

MatchesMethod · 0.85

Calls 5

GetStringValueMethod · 0.80
GetIntValueMethod · 0.80
GetDoubleValueMethod · 0.80
GetBoolValueMethod · 0.80
MatchStringMethod · 0.80

Tested by

no test coverage detected