Skip to content

Commit

Permalink
[chore] Remove unnecessary Host implementation funcs (open-telemetry#…
Browse files Browse the repository at this point in the history
…35773)

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Oct 14, 2024
1 parent 0a6bb8a commit 9b944d6
Show file tree
Hide file tree
Showing 23 changed files with 9 additions and 156 deletions.
2 changes: 1 addition & 1 deletion exporter/awss3exporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
go.opentelemetry.io/collector/exporter v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/otelcol/otelcoltest v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.0
Expand Down Expand Up @@ -80,6 +79,7 @@ require (
go.opentelemetry.io/collector/otelcol v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata/testdata v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/processor v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae // indirect
Expand Down
17 changes: 0 additions & 17 deletions exporter/awss3exporter/marshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/pipeline"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -51,28 +50,12 @@ type hostWithExtensions struct {
encoding encodingExtension
}

func (h hostWithExtensions) Start(context.Context, component.Host) error {
panic("unsupported")
}

func (h hostWithExtensions) Shutdown(context.Context) error {
panic("unsupported")
}

func (h hostWithExtensions) GetFactory(component.Kind, component.Type) component.Factory {
panic("unsupported")
}

func (h hostWithExtensions) GetExtensions() map[component.ID]component.Component {
return map[component.ID]component.Component{
component.MustNewID("foo"): h.encoding,
}
}

func (h hostWithExtensions) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
panic("unsupported")
}

type encodingExtension struct {
}

Expand Down
9 changes: 0 additions & 9 deletions exporter/elasticsearchexporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/pipeline"
)

func TestExporterLogs(t *testing.T) {
Expand Down Expand Up @@ -1600,18 +1599,10 @@ type mockHost struct {
extensions map[component.ID]component.Component
}

func (h *mockHost) GetFactory(kind component.Kind, typ component.Type) component.Factory {
panic(fmt.Errorf("expected call to GetFactory(%v, %v)", kind, typ))
}

func (h *mockHost) GetExtensions() map[component.ID]component.Component {
return h.extensions
}

func (h *mockHost) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
panic(fmt.Errorf("expected call to GetExporters"))
}

type roundTripperFunc func(*http.Request) (*http.Response, error)

func (f roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) {
Expand Down
2 changes: 1 addition & 1 deletion exporter/elasticsearchexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ require (
go.opentelemetry.io/collector/exporter v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/extension/auth v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/semconv v0.111.1-0.20241008154146-ea48c09c31ae
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
Expand Down Expand Up @@ -74,6 +73,7 @@ require (
go.opentelemetry.io/collector/extension/experimental/storage v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver/receiverprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
Expand Down
9 changes: 0 additions & 9 deletions exporter/fileexporter/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/pipeline"

"github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding/otlpencodingextension"
)
Expand All @@ -28,18 +27,10 @@ type hostWithEncoding struct {
encodings map[component.ID]component.Component
}

func (h hostWithEncoding) GetFactory(_ component.Kind, _ component.Type) component.Factory {
panic("unsupported")
}

func (h hostWithEncoding) GetExtensions() map[component.ID]component.Component {
return h.encodings
}

func (h hostWithEncoding) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
panic("unsupported")
}

func TestEncoding(t *testing.T) {
f := NewFactory()
cfg := f.CreateDefaultConfig().(*Config)
Expand Down
2 changes: 1 addition & 1 deletion exporter/fileexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
go.opentelemetry.io/collector/exporter v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/extension v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
Expand Down Expand Up @@ -48,6 +47,7 @@ require (
go.opentelemetry.io/collector/extension/experimental/storage v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver/receiverprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion exporter/rabbitmqexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
go.opentelemetry.io/collector/consumer v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/exporter v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
)
Expand Down Expand Up @@ -81,6 +80,7 @@ require (
go.opentelemetry.io/collector/extension/experimental/storage v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver/receiverprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
Expand Down
9 changes: 0 additions & 9 deletions exporter/rabbitmqexporter/marshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/pipeline"
)

func TestMarshalUsingEncodingExtension(t *testing.T) {
Expand All @@ -40,14 +39,6 @@ type mockEncodingExtension struct {
mock.Mock
}

func (h *mockHostWithEncodings) GetFactory(component.Kind, component.Type) component.Factory {
return nil
}

func (h *mockHostWithEncodings) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
return nil
}

func (h *mockHostWithEncodings) GetExtensions() map[component.ID]component.Component {
args := h.Called()
return args.Get(0).(map[component.ID]component.Component)
Expand Down
9 changes: 0 additions & 9 deletions extension/awsproxy/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/extension/extensiontest"
"go.opentelemetry.io/collector/pipeline"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil"
Expand Down Expand Up @@ -101,18 +100,10 @@ type nopHost struct {
reportFunc func(event *componentstatus.Event)
}

func (nh *nopHost) GetFactory(component.Kind, component.Type) component.Factory {
return nil
}

func (nh *nopHost) GetExtensions() map[component.ID]component.Component {
return nil
}

func (nh *nopHost) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
return nil
}

func (nh *nopHost) Report(event *componentstatus.Event) {
nh.reportFunc(event)
}
2 changes: 1 addition & 1 deletion extension/awsproxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
go.opentelemetry.io/collector/config/configtls v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/extension v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae
go.uber.org/zap v1.27.0
)

Expand All @@ -38,6 +37,7 @@ require (
go.opentelemetry.io/collector/featuregate v1.17.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/sdk v1.30.0 // indirect
Expand Down
9 changes: 0 additions & 9 deletions extension/observer/ecsobserver/extension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"go.opentelemetry.io/collector/component/componentstatus"
"go.opentelemetry.io/collector/extension"
"go.opentelemetry.io/collector/extension/extensiontest"
"go.opentelemetry.io/collector/pipeline"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/ecsobserver/internal/ecsmock"
Expand Down Expand Up @@ -82,18 +81,10 @@ type nopHost struct {
reportFunc func(event *componentstatus.Event)
}

func (nh *nopHost) GetFactory(component.Kind, component.Type) component.Factory {
return nil
}

func (nh *nopHost) GetExtensions() map[component.ID]component.Component {
return nil
}

func (nh *nopHost) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
return nil
}

func (nh *nopHost) Report(event *componentstatus.Event) {
nh.reportFunc(event)
}
2 changes: 1 addition & 1 deletion extension/observer/ecsobserver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
go.opentelemetry.io/collector/component/componentstatus v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/confmap v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/extension v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.0
Expand All @@ -34,6 +33,7 @@ require (
go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/sdk v1.30.0 // indirect
Expand Down
9 changes: 0 additions & 9 deletions processor/k8sattributesprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/processortest"
conventions "go.opentelemetry.io/collector/semconv/v1.8.0"
Expand Down Expand Up @@ -1570,18 +1569,10 @@ type nopHost struct {
reportFunc func(event *componentstatus.Event)
}

func (nh *nopHost) GetFactory(component.Kind, component.Type) component.Factory {
return nil
}

func (nh *nopHost) GetExtensions() map[component.ID]component.Component {
return nil
}

func (nh *nopHost) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
return nil
}

func (nh *nopHost) Report(event *componentstatus.Event) {
nh.reportFunc(event)
}
2 changes: 1 addition & 1 deletion receiver/awss3receiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
go.opentelemetry.io/collector/consumer v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/consumer/consumertest v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/semconv v0.111.1-0.20241008154146-ea48c09c31ae
go.uber.org/goleak v1.3.0
Expand Down Expand Up @@ -59,6 +58,7 @@ require (
go.opentelemetry.io/collector/consumer/consumerprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver/receiverprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
Expand Down
17 changes: 0 additions & 17 deletions receiver/awss3receiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/receiver/receiverhelper"
"go.opentelemetry.io/collector/receiver/receivertest"
conventions "go.opentelemetry.io/collector/semconv/v1.22.0"
Expand Down Expand Up @@ -68,26 +67,10 @@ type hostWithExtensions struct {
extensions map[component.ID]component.Component
}

func (h hostWithExtensions) Start(context.Context, component.Host) error {
panic("unsupported")
}

func (h hostWithExtensions) Shutdown(context.Context) error {
panic("unsupported")
}

func (h hostWithExtensions) GetFactory(component.Kind, component.Type) component.Factory {
panic("unsupported")
}

func (h hostWithExtensions) GetExtensions() map[component.ID]component.Component {
return h.extensions
}

func (h hostWithExtensions) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
panic("unsupported")
}

type nonEncodingExtension struct{}

func (e nonEncodingExtension) Start(_ context.Context, _ component.Host) error {
Expand Down
2 changes: 1 addition & 1 deletion receiver/carbonreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
go.opentelemetry.io/collector/consumer v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/consumer/consumertest v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/collector/receiver v0.111.1-0.20241008154146-ea48c09c31ae
go.opentelemetry.io/otel/sdk v1.30.0
go.opentelemetry.io/otel/trace v1.30.0
Expand Down Expand Up @@ -43,6 +42,7 @@ require (
go.opentelemetry.io/collector/featuregate v1.17.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/collector/receiver/receiverprofiles v0.111.1-0.20241008154146-ea48c09c31ae // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
Expand Down
9 changes: 0 additions & 9 deletions receiver/carbonreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/receiver/receivertest"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
Expand Down Expand Up @@ -248,18 +247,10 @@ type nopHost struct {
reportFunc func(event *componentstatus.Event)
}

func (nh *nopHost) GetFactory(component.Kind, component.Type) component.Factory {
return nil
}

func (nh *nopHost) GetExtensions() map[component.ID]component.Component {
return nil
}

func (nh *nopHost) GetExportersWithSignal() map[pipeline.Signal]map[component.ID]component.Component {
return nil
}

func (nh *nopHost) Report(event *componentstatus.Event) {
nh.reportFunc(event)
}
Loading

0 comments on commit 9b944d6

Please sign in to comment.