You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add new filters allowing FLP-based dedup
- New "remove_entry_all_satisfied" filter type: entry is removed only if
all the conditions (represented by nested rules) are satisfied. This
allows to have logical AND in filter conditions, whereas previously it
was only possible to have logical OR
- New "conditional_sampling" filter type: allows to have random sampling
based on conditions. For example, a flow matching conditions A and B
may have a sampling ratio of 1:10 whereas a flow matching condition C
has 1:100 sampling and all other flows are 1:1
- Introduced a "preprocess" function on rules; currently it's only used
to be able to cast the `Value interface{}` as an int (otherwise it
comes as a float64); but could be also used in the future for other
purpose, e.g. regex pre-compiling
- Add tests
* Fix tests
Copy file name to clipboardExpand all lines: pkg/api/transform_filter.go
+70-14Lines changed: 70 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,12 @@ type TransformFilter struct {
21
21
Rules []TransformFilterRule`yaml:"rules,omitempty" json:"rules,omitempty" doc:"list of filter rules, each includes:"`
22
22
}
23
23
24
+
func (tf*TransformFilter) Preprocess() {
25
+
fori:=rangetf.Rules {
26
+
tf.Rules[i].preprocess()
27
+
}
28
+
}
29
+
24
30
typeTransformFilterEnumstring
25
31
26
32
const (
@@ -30,32 +36,66 @@ const (
30
36
RemoveEntryIfDoesntExistTransformFilterEnum="remove_entry_if_doesnt_exist"// removes the entry if the field does not exist
31
37
RemoveEntryIfEqualTransformFilterEnum="remove_entry_if_equal"// removes the entry if the field value equals specified value
32
38
RemoveEntryIfNotEqualTransformFilterEnum="remove_entry_if_not_equal"// removes the entry if the field value does not equal specified value
39
+
RemoveEntryAllSatisfiedTransformFilterEnum="remove_entry_all_satisfied"// removes the entry if all of the defined rules are satisfied
33
40
AddFieldTransformFilterEnum="add_field"// adds (input) field to the entry; overrides previous value if present (key=input, value=value)
34
41
AddFieldIfDoesntExistTransformFilterEnum="add_field_if_doesnt_exist"// adds a field to the entry if the field does not exist
35
42
AddFieldIfTransformFilterEnum="add_field_if"// add output field set to assignee if input field satisfies criteria from parameters field
36
43
AddRegExIfTransformFilterEnum="add_regex_if"// add output field if input field satisfies regex pattern from parameters field
37
44
AddLabelTransformFilterEnum="add_label"// add (input) field to list of labels with value taken from Value field (key=input, value=value)
38
45
AddLabelIfTransformFilterEnum="add_label_if"// add output field to list of labels with value taken from assignee field if input field satisfies criteria from parameters field
0 commit comments