Skip to content

Commit 5497bcb

Browse files
authored
[processor/filterprocessor] reduce exposed Go API (#24845)
Unexport constants that were exposed as part of the configuration of the processor.
1 parent 061e2f9 commit 5497bcb

File tree

5 files changed

+92
-65
lines changed

5 files changed

+92
-65
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: filterprocessor
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Unexport `Strict` and `Regexp`
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [24845]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [api]

processor/filterprocessor/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type MetricFilters struct {
5050
// If both Include and Exclude are specified, Include filtering occurs first.
5151
Exclude *filterconfig.MetricMatchProperties `mapstructure:"exclude"`
5252

53-
// RegexpConfig specifies options for the Regexp match type
53+
// RegexpConfig specifies options for the regexp match type
5454
RegexpConfig *regexp.Config `mapstructure:"regexp"`
5555

5656
// MetricConditions is a list of OTTL conditions for an ottlmetric context.
@@ -100,8 +100,8 @@ type LogMatchType string
100100
// These are the MatchTypes that users can specify for filtering
101101
// `plog.Log`s.
102102
const (
103-
Strict = LogMatchType(filterset.Strict)
104-
Regexp = LogMatchType(filterset.Regexp)
103+
strictType = LogMatchType(filterset.Strict)
104+
regexpType = LogMatchType(filterset.Regexp)
105105
)
106106

107107
var severityToNumber = map[string]plog.SeverityNumber{

processor/filterprocessor/config_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func TestLoadingConfigStrict(t *testing.T) {
9999
func TestLoadingConfigStrictLogs(t *testing.T) {
100100

101101
testDataLogPropertiesInclude := &LogMatchProperties{
102-
LogMatchType: Strict,
102+
LogMatchType: strictType,
103103
ResourceAttributes: []filterconfig.Attribute{
104104
{
105105
Key: "should_include",
@@ -109,7 +109,7 @@ func TestLoadingConfigStrictLogs(t *testing.T) {
109109
}
110110

111111
testDataLogPropertiesExclude := &LogMatchProperties{
112-
LogMatchType: Strict,
112+
LogMatchType: strictType,
113113
ResourceAttributes: []filterconfig.Attribute{
114114
{
115115
Key: "should_exclude",
@@ -131,7 +131,7 @@ func TestLoadingConfigStrictLogs(t *testing.T) {
131131
ErrorMode: ottl.PropagateError,
132132
Logs: LogFilters{
133133
Include: &LogMatchProperties{
134-
LogMatchType: Strict,
134+
LogMatchType: strictType,
135135
},
136136
},
137137
},
@@ -182,12 +182,12 @@ func TestLoadingConfigStrictLogs(t *testing.T) {
182182
func TestLoadingConfigSeverityLogsStrict(t *testing.T) {
183183

184184
testDataLogPropertiesInclude := &LogMatchProperties{
185-
LogMatchType: Strict,
185+
LogMatchType: strictType,
186186
SeverityTexts: []string{"INFO"},
187187
}
188188

189189
testDataLogPropertiesExclude := &LogMatchProperties{
190-
LogMatchType: Strict,
190+
LogMatchType: strictType,
191191
SeverityTexts: []string{"DEBUG", "DEBUG2", "DEBUG3", "DEBUG4"},
192192
}
193193

@@ -244,12 +244,12 @@ func TestLoadingConfigSeverityLogsStrict(t *testing.T) {
244244
// TestLoadingConfigSeverityLogsRegexp tests loading testdata/config_logs_severity_regexp.yaml
245245
func TestLoadingConfigSeverityLogsRegexp(t *testing.T) {
246246
testDataLogPropertiesInclude := &LogMatchProperties{
247-
LogMatchType: Regexp,
247+
LogMatchType: regexpType,
248248
SeverityTexts: []string{"INFO[2-4]?"},
249249
}
250250

251251
testDataLogPropertiesExclude := &LogMatchProperties{
252-
LogMatchType: Regexp,
252+
LogMatchType: regexpType,
253253
SeverityTexts: []string{"DEBUG[2-4]?"},
254254
}
255255

@@ -307,12 +307,12 @@ func TestLoadingConfigSeverityLogsRegexp(t *testing.T) {
307307
func TestLoadingConfigBodyLogsStrict(t *testing.T) {
308308

309309
testDataLogPropertiesInclude := &LogMatchProperties{
310-
LogMatchType: Strict,
310+
LogMatchType: strictType,
311311
LogBodies: []string{"This is an important event"},
312312
}
313313

314314
testDataLogPropertiesExclude := &LogMatchProperties{
315-
LogMatchType: Strict,
315+
LogMatchType: strictType,
316316
LogBodies: []string{"This event is not important"},
317317
}
318318

@@ -370,12 +370,12 @@ func TestLoadingConfigBodyLogsStrict(t *testing.T) {
370370
func TestLoadingConfigBodyLogsRegexp(t *testing.T) {
371371

372372
testDataLogPropertiesInclude := &LogMatchProperties{
373-
LogMatchType: Regexp,
373+
LogMatchType: regexpType,
374374
LogBodies: []string{"^IMPORTANT:"},
375375
}
376376

377377
testDataLogPropertiesExclude := &LogMatchProperties{
378-
LogMatchType: Regexp,
378+
LogMatchType: regexpType,
379379
LogBodies: []string{"^MINOR:"},
380380
}
381381

0 commit comments

Comments
 (0)