Skip to content

Commit cad9385

Browse files
authored
[sumologicprocessor] unexport NestingProcessor (open-telemetry#41069)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description As part of open-telemetry#40641, we should unexport NestingProcessor as it is not intended to be API surface. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#40660 --------- Signed-off-by: Eric Chlebek <[email protected]>
1 parent 65c4a22 commit cad9385

File tree

3 files changed

+43
-16
lines changed

3 files changed

+43
-16
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: sumologicprocessor
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: 'Types that do not contribute to intended API surface will be unexported'
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: [40660]
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: 'https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/40641'
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/sumologicprocessor/fuzz_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func FuzzProcessTraces(f *testing.F) {
2626
proc := &cloudNamespaceProcessor{}
2727
_ = proc.processTraces(traces)
2828
case 2:
29-
proc := &NestingProcessor{}
29+
proc := &nestingProcessor{}
3030
_ = proc.processTraces(traces)
3131
case 3:
3232
proc := &translateAttributesProcessor{}
@@ -50,7 +50,7 @@ func FuzzProcessLogs(f *testing.F) {
5050
proc := &cloudNamespaceProcessor{}
5151
_ = proc.processLogs(logs)
5252
case 2:
53-
proc := &NestingProcessor{}
53+
proc := &nestingProcessor{}
5454
_ = proc.processLogs(logs)
5555
case 3:
5656
proc := &translateAttributesProcessor{}
@@ -74,7 +74,7 @@ func FuzzProcessMetrics(f *testing.F) {
7474
proc := &cloudNamespaceProcessor{}
7575
_ = proc.processMetrics(metrics)
7676
case 2:
77-
proc := &NestingProcessor{}
77+
proc := &nestingProcessor{}
7878
_ = proc.processMetrics(metrics)
7979
case 3:
8080
proc := &translateAttributesProcessor{}

processor/sumologicprocessor/nesting_processor.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ type NestingProcessorConfig struct {
2020
SquashSingleValues bool `mapstructure:"squash_single_values"`
2121
}
2222

23-
type NestingProcessor struct {
23+
type nestingProcessor struct {
2424
separator string
2525
enabled bool
2626
allowlist []string
2727
denylist []string
2828
squashSingleValues bool
2929
}
3030

31-
func newNestingProcessor(config *NestingProcessorConfig) *NestingProcessor {
32-
proc := &NestingProcessor{
31+
func newNestingProcessor(config *NestingProcessorConfig) *nestingProcessor {
32+
proc := &nestingProcessor{
3333
separator: config.Separator,
3434
enabled: config.Enabled,
3535
allowlist: config.Include,
@@ -40,7 +40,7 @@ func newNestingProcessor(config *NestingProcessorConfig) *NestingProcessor {
4040
return proc
4141
}
4242

43-
func (proc *NestingProcessor) processLogs(logs plog.Logs) error {
43+
func (proc *nestingProcessor) processLogs(logs plog.Logs) error {
4444
if !proc.enabled {
4545
return nil
4646
}
@@ -66,7 +66,7 @@ func (proc *NestingProcessor) processLogs(logs plog.Logs) error {
6666
return nil
6767
}
6868

69-
func (proc *NestingProcessor) processMetrics(metrics pmetric.Metrics) error {
69+
func (proc *nestingProcessor) processMetrics(metrics pmetric.Metrics) error {
7070
if !proc.enabled {
7171
return nil
7272
}
@@ -92,7 +92,7 @@ func (proc *NestingProcessor) processMetrics(metrics pmetric.Metrics) error {
9292
return nil
9393
}
9494

95-
func (proc *NestingProcessor) processTraces(traces ptrace.Traces) error {
95+
func (proc *nestingProcessor) processTraces(traces ptrace.Traces) error {
9696
if !proc.enabled {
9797
return nil
9898
}
@@ -118,7 +118,7 @@ func (proc *NestingProcessor) processTraces(traces ptrace.Traces) error {
118118
return nil
119119
}
120120

121-
func (proc *NestingProcessor) processAttributes(attributes pcommon.Map) error {
121+
func (proc *nestingProcessor) processAttributes(attributes pcommon.Map) error {
122122
newMap := pcommon.NewMap()
123123

124124
for k, v := range attributes.All() {
@@ -194,7 +194,7 @@ func (proc *NestingProcessor) processAttributes(attributes pcommon.Map) error {
194194
// Checks if given key fulfills the following conditions:
195195
// - has a prefix that exists in the allowlist (if it's not empty)
196196
// - does not have a prefix that exists in the denylist
197-
func (proc *NestingProcessor) shouldTranslateKey(k string) bool {
197+
func (proc *nestingProcessor) shouldTranslateKey(k string) bool {
198198
if len(proc.allowlist) > 0 {
199199
isOk := false
200200
for i := 0; i < len(proc.allowlist); i++ {
@@ -221,7 +221,7 @@ func (proc *NestingProcessor) shouldTranslateKey(k string) bool {
221221

222222
// Squashes maps that have single values, eg. map {"a": {"b": {"c": "C", "d": "D"}}}}
223223
// gets squashes into {"a.b": {"c": "C", "d": "D"}}}
224-
func (proc *NestingProcessor) squash(attributes pcommon.Map) pcommon.Map {
224+
func (proc *nestingProcessor) squash(attributes pcommon.Map) pcommon.Map {
225225
newMap := pcommon.NewValueMap()
226226
attributes.CopyTo(newMap.Map())
227227
key := proc.squashAttribute(newMap)
@@ -242,7 +242,7 @@ func (proc *NestingProcessor) squash(attributes pcommon.Map) pcommon.Map {
242242
// and the key gets replaced if needed, "" is returned.
243243
//
244244
// Else, nothing happens and "" is returned.
245-
func (proc *NestingProcessor) squashAttribute(value pcommon.Value) string {
245+
func (proc *nestingProcessor) squashAttribute(value pcommon.Value) string {
246246
if value.Type() != pcommon.ValueTypeMap {
247247
return ""
248248
}
@@ -279,17 +279,17 @@ func (proc *NestingProcessor) squashAttribute(value pcommon.Value) string {
279279
return ""
280280
}
281281

282-
func (proc *NestingProcessor) squashKey(key string, keySuffix string) string {
282+
func (proc *nestingProcessor) squashKey(key string, keySuffix string) string {
283283
if keySuffix == "" {
284284
return key
285285
}
286286
return key + proc.separator + keySuffix
287287
}
288288

289-
func (proc *NestingProcessor) isEnabled() bool {
289+
func (proc *nestingProcessor) isEnabled() bool {
290290
return proc.enabled
291291
}
292292

293-
func (*NestingProcessor) ConfigPropertyName() string {
293+
func (*nestingProcessor) ConfigPropertyName() string {
294294
return "nest_attributes"
295295
}

0 commit comments

Comments
 (0)