Skip to content

Commit

Permalink
[pkg/stanza] Remove syslogreceiver.CreateDefault[TCP|UDP]ConfigBase f…
Browse files Browse the repository at this point in the history
…uncs (open-telemetry#13297)

These functions were added recently and unnecessarily expand the
collector's overall API.
  • Loading branch information
djaglowski authored Aug 12, 2022
1 parent 4c35474 commit 56bd8ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
3 changes: 2 additions & 1 deletion internal/components/receivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"go.opentelemetry.io/collector/consumer/consumertest"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/adapter"
tcpop "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/input/tcp"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver"
Expand Down Expand Up @@ -307,7 +308,7 @@ func TestDefaultReceivers(t *testing.T) {
receiver: "syslog",
getConfigFn: func() config.Receiver {
cfg := rcvrFactories["syslog"].CreateDefaultConfig().(*syslogreceiver.SysLogConfig)
cfg.TCP = syslogreceiver.CreateDefaultTCPConfigBase()
cfg.TCP = &tcpop.NewConfig("tcp_input").BaseConfig
cfg.TCP.ListenAddress = "0.0.0.0:0"
cfg.Protocol = "rfc5424"
return cfg
Expand Down
12 changes: 2 additions & 10 deletions receiver/syslogreceiver/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,10 @@ func (cfg *SysLogConfig) Unmarshal(componentParser *confmap.Conf) error {
}

if componentParser.IsSet("tcp") {
cfg.TCP = CreateDefaultTCPConfigBase()
cfg.TCP = &tcp.NewConfig("tcp_input").BaseConfig
} else if componentParser.IsSet("udp") {
cfg.UDP = CreateDefaultUDPConfigBase()
cfg.UDP = &udp.NewConfig("udp_input").BaseConfig
}

return componentParser.UnmarshalExact(cfg)
}

func CreateDefaultTCPConfigBase() *tcp.BaseConfig {
return &tcp.NewConfig("tcp_input").BaseConfig
}

func CreateDefaultUDPConfigBase() *udp.BaseConfig {
return &udp.NewConfig("udp_input").BaseConfig
}

0 comments on commit 56bd8ab

Please sign in to comment.