From 77de17a042b06b30398b832fe4a5c079bfcf77bb Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Wed, 5 Jun 2024 21:44:29 -0700 Subject: [PATCH 1/2] [filter] unexport CombinedFilter --- .chloggen/filter.yaml | 25 +++++++++++++++++++++++++ filter/config.go | 10 +++++----- 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 .chloggen/filter.yaml diff --git a/.chloggen/filter.yaml b/.chloggen/filter.yaml new file mode 100644 index 00000000000..07945a92013 --- /dev/null +++ b/.chloggen/filter.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: filter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Unexport the `filter.CombinedFilter` struct + +# One or more tracking issues or pull requests related to the change +issues: [10348] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [api] diff --git a/filter/config.go b/filter/config.go index e5b12c4f014..3b0a378a4ba 100644 --- a/filter/config.go +++ b/filter/config.go @@ -8,7 +8,7 @@ import ( "regexp" ) -// Config configures the matching behavior of a FilterSet. +// Config configures the matching behavior of a Filter. type Config struct { Strict string `mapstructure:"strict"` Regex string `mapstructure:"regexp"` @@ -32,14 +32,14 @@ func (c Config) Validate() error { return nil } -type CombinedFilter struct { +type combinedFilter struct { stricts map[any]struct{} regexes []*regexp.Regexp } -// CreateFilter creates a Filter from yaml config. +// CreateFilter creates a Filter out of a set of Config configuration objects. func CreateFilter(configs []Config) Filter { - cf := &CombinedFilter{ + cf := &combinedFilter{ stricts: make(map[any]struct{}), } for _, config := range configs { @@ -56,7 +56,7 @@ func CreateFilter(configs []Config) Filter { return cf } -func (cf *CombinedFilter) Matches(toMatch any) bool { +func (cf *combinedFilter) Matches(toMatch any) bool { _, ok := cf.stricts[toMatch] if ok { return ok From 6fdd0f6502a625310ea92a239de453ec9822d262 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Thu, 6 Jun 2024 16:33:31 -0700 Subject: [PATCH 2/2] deprecate, don't break --- .chloggen/filter.yaml | 4 ++-- filter/config.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.chloggen/filter.yaml b/.chloggen/filter.yaml index 07945a92013..4006aa43af1 100644 --- a/.chloggen/filter.yaml +++ b/.chloggen/filter.yaml @@ -1,13 +1,13 @@ # Use this changelog template to create an entry for release notes. # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: breaking +change_type: deprecation # The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) component: filter # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Unexport the `filter.CombinedFilter` struct +note: Deprecate the `filter.CombinedFilter` struct # One or more tracking issues or pull requests related to the change issues: [10348] diff --git a/filter/config.go b/filter/config.go index 3b0a378a4ba..0fc63c86825 100644 --- a/filter/config.go +++ b/filter/config.go @@ -37,6 +37,9 @@ type combinedFilter struct { regexes []*regexp.Regexp } +// Deprecated: [v0.103.0] This type will be removed in the future. +type CombinedFilter combinedFilter + // CreateFilter creates a Filter out of a set of Config configuration objects. func CreateFilter(configs []Config) Filter { cf := &combinedFilter{