Skip to content

Commit

Permalink
rename keep_entry_all_satisfied
Browse files Browse the repository at this point in the history
  • Loading branch information
jotak committed Nov 13, 2024
1 parent 1c8c864 commit 417769d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Following is the supported API format for filter transformations:
remove_entry_if_equal: removes the entry if the field value equals specified value
remove_entry_if_not_equal: removes the entry if the field value does not equal specified value
remove_entry_all_satisfied: removes the entry if all of the defined rules are satisfied
keep_entry: keeps the entry if the set of rules are all satisfied
keep_entry_all_satisfied: keeps the entry if the set of rules are all satisfied
add_field: adds (input) field to the entry; overrides previous value if present (key=input, value=value)
add_field_if_doesnt_exist: adds a field to the entry if the field does not exist
add_field_if: add output field set to assignee if input field satisfies criteria from parameters field
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/transform_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
RemoveEntryIfEqual TransformFilterEnum = "remove_entry_if_equal" // removes the entry if the field value equals specified value
RemoveEntryIfNotEqual TransformFilterEnum = "remove_entry_if_not_equal" // removes the entry if the field value does not equal specified value
RemoveEntryAllSatisfied TransformFilterEnum = "remove_entry_all_satisfied" // removes the entry if all of the defined rules are satisfied
KeepEntry TransformFilterEnum = "keep_entry" // keeps the entry if the set of rules are all satisfied
KeepEntryAllSatisfied TransformFilterEnum = "keep_entry_all_satisfied" // keeps the entry if the set of rules are all satisfied
AddField TransformFilterEnum = "add_field" // adds (input) field to the entry; overrides previous value if present (key=input, value=value)
AddFieldIfDoesntExist TransformFilterEnum = "add_field_if_doesnt_exist" // adds a field to the entry if the field does not exist
AddFieldIf TransformFilterEnum = "add_field_if" // add output field set to assignee if input field satisfies criteria from parameters field
Expand Down
4 changes: 2 additions & 2 deletions pkg/pipeline/transform/transform_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func applyRule(entry config.GenericMap, labels map[string]string, rule *api.Tran
return !isRemoveEntrySatisfied(entry, rule.RemoveEntryAllSatisfied)
case api.ConditionalSampling:
return sample(entry, rule.ConditionalSampling)
case api.KeepEntry:
case api.KeepEntryAllSatisfied:
return rollSampling(rule.KeepEntrySampling) && isKeepEntrySatisfied(entry, rule.KeepEntryAllSatisfied)
default:
tlog.Panicf("unknown type %s for transform.Filter rule: %v", rule.Type, rule)
Expand Down Expand Up @@ -250,7 +250,7 @@ func NewTransformFilter(params config.StageParam) (Transformer, error) {
return nil, err
}
for i := range params.Transform.Filter.Rules {
if params.Transform.Filter.Rules[i].Type == api.KeepEntry {
if params.Transform.Filter.Rules[i].Type == api.KeepEntryAllSatisfied {
keepRules = append(keepRules, params.Transform.Filter.Rules[i])
} else {
rules = append(rules, params.Transform.Filter.Rules[i])
Expand Down
8 changes: 4 additions & 4 deletions pkg/pipeline/transform/transform_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ func Test_Transform_KeepEntry(t *testing.T) {
newFilter := api.TransformFilter{
Rules: []api.TransformFilterRule{
{
Type: api.KeepEntry,
Type: api.KeepEntryAllSatisfied,
KeepEntryAllSatisfied: []*api.KeepEntryRule{
{
Type: api.KeepEntryIfEqual,
Expand All @@ -694,7 +694,7 @@ func Test_Transform_KeepEntry(t *testing.T) {
},
},
{
Type: api.KeepEntry,
Type: api.KeepEntryAllSatisfied,
KeepEntryAllSatisfied: []*api.KeepEntryRule{
{
Type: api.KeepEntryIfRegexMatch,
Expand Down Expand Up @@ -742,7 +742,7 @@ func Test_Transform_KeepEntrySampling(t *testing.T) {
newFilter := api.TransformFilter{
Rules: []api.TransformFilterRule{
{
Type: api.KeepEntry,
Type: api.KeepEntryAllSatisfied,
KeepEntryAllSatisfied: []*api.KeepEntryRule{
{
Type: api.KeepEntryIfEqual,
Expand All @@ -755,7 +755,7 @@ func Test_Transform_KeepEntrySampling(t *testing.T) {
KeepEntrySampling: 10,
},
{
Type: api.KeepEntry,
Type: api.KeepEntryAllSatisfied,
KeepEntryAllSatisfied: []*api.KeepEntryRule{
{
Type: api.KeepEntryIfEqual,
Expand Down

0 comments on commit 417769d

Please sign in to comment.