Skip to content

Commit

Permalink
[filter] unexport CombinedFilter (open-telemetry#10348)
Browse files Browse the repository at this point in the history
#### Description
Unexport CombinedFilter, it should not be exported as it implements
Filter.
  • Loading branch information
atoulme authored Jun 7, 2024
1 parent a6ace53 commit 0d6e6bf
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .chloggen/filter.yaml
Original file line number Diff line number Diff line change
@@ -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: 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: Deprecate 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]
13 changes: 8 additions & 5 deletions filter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -32,14 +32,17 @@ 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.
// 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{
cf := &combinedFilter{
stricts: make(map[any]struct{}),
}
for _, config := range configs {
Expand All @@ -56,7 +59,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
Expand Down

0 comments on commit 0d6e6bf

Please sign in to comment.