From 03ebf971a8d0cd88a47e82c1093ee488d477df1f Mon Sep 17 00:00:00 2001 From: acha1os Date: Wed, 8 May 2024 10:54:01 +0300 Subject: [PATCH] [exporter/syslogexporter] use errors.Join instead of go.uber.org/multierr (#32925) **Description:** syslogexporter: use errors.Join instead of go.uber.org/multierr **Link to tracking Issue:** [#25121](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/25121) **Testing:** **Documentation:** --- exporter/syslogexporter/config.go | 3 +-- exporter/syslogexporter/config_test.go | 2 +- exporter/syslogexporter/exporter.go | 4 ++-- exporter/syslogexporter/go.mod | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/exporter/syslogexporter/config.go b/exporter/syslogexporter/config.go index adc2606b81a5..237278ef2c79 100644 --- a/exporter/syslogexporter/config.go +++ b/exporter/syslogexporter/config.go @@ -11,7 +11,6 @@ import ( "go.opentelemetry.io/collector/config/configretry" "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/exporter/exporterhelper" - "go.uber.org/multierr" ) var ( @@ -74,7 +73,7 @@ func (cfg *Config) Validate() error { } if len(invalidFields) > 0 { - return multierr.Combine(invalidFields...) + return errors.Join(invalidFields...) } return nil diff --git a/exporter/syslogexporter/config_test.go b/exporter/syslogexporter/config_test.go index c25a0a946868..870a83b96786 100644 --- a/exporter/syslogexporter/config_test.go +++ b/exporter/syslogexporter/config_test.go @@ -24,7 +24,7 @@ func TestValidate(t *testing.T) { Protocol: "rfc542", Network: "udp", }, - err: "unsupported port: port is required, must be in the range 1-65535; " + + err: "unsupported port: port is required, must be in the range 1-65535" + "\n" + "unsupported protocol: Only rfc5424 and rfc3164 supported", }, { diff --git a/exporter/syslogexporter/exporter.go b/exporter/syslogexporter/exporter.go index de8f5e6ba455..566f2190e59b 100644 --- a/exporter/syslogexporter/exporter.go +++ b/exporter/syslogexporter/exporter.go @@ -6,6 +6,7 @@ package syslogexporter // import "github.com/open-telemetry/opentelemetry-collec import ( "context" "crypto/tls" + "errors" "fmt" "strings" @@ -14,7 +15,6 @@ import ( "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exporterhelper" "go.opentelemetry.io/collector/pdata/plog" - "go.uber.org/multierr" "go.uber.org/zap" ) @@ -142,7 +142,7 @@ func (se *syslogexporter) exportNonBatch(logs plog.Logs) error { if len(errs) > 0 { errs = deduplicateErrors(errs) - return consumererror.NewLogs(multierr.Combine(errs...), droppedLogs) + return consumererror.NewLogs(errors.Join(errs...), droppedLogs) } return nil diff --git a/exporter/syslogexporter/go.mod b/exporter/syslogexporter/go.mod index 3a7ec2401804..e7fd6f3f8df8 100644 --- a/exporter/syslogexporter/go.mod +++ b/exporter/syslogexporter/go.mod @@ -55,7 +55,7 @@ require ( go.opentelemetry.io/otel v1.26.0 // indirect go.opentelemetry.io/otel/metric v1.26.0 go.opentelemetry.io/otel/trace v1.26.0 - go.uber.org/multierr v1.11.0 + go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.24.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect