Skip to content

Commit

Permalink
[chore][receiver/otlpjsonfile] rename rvcr import (#26308)
Browse files Browse the repository at this point in the history
Rename the receiver struct away to avoid clashing with import, matching
expected method signature.

See #26304
  • Loading branch information
atoulme authored Aug 30, 2023
1 parent be12485 commit 28fe356
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion cmd/checkapi/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ receiver/mongodbatlasreceiver
receiver/mongodbreceiver
receiver/mysqlreceiver
receiver/nsxtreceiver
receiver/otlpjsonfilereceiver
receiver/podmanreceiver
receiver/pulsarreceiver
receiver/statsdreceiver
Expand Down
30 changes: 15 additions & 15 deletions receiver/otlpjsonfilereceiver/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"
rcvr "go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/adapter"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/fileconsumer"
Expand All @@ -24,13 +24,13 @@ const (
)

// NewFactory creates a factory for file receiver
func NewFactory() rcvr.Factory {
return rcvr.NewFactory(
func NewFactory() receiver.Factory {
return receiver.NewFactory(
metadata.Type,
createDefaultConfig,
rcvr.WithMetrics(createMetricsReceiver, metadata.MetricsStability),
rcvr.WithLogs(createLogsReceiver, metadata.LogsStability),
rcvr.WithTraces(createTracesReceiver, metadata.TracesStability))
receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability),
receiver.WithLogs(createLogsReceiver, metadata.LogsStability),
receiver.WithTraces(createTracesReceiver, metadata.TracesStability))
}

type Config struct {
Expand All @@ -44,25 +44,25 @@ func createDefaultConfig() component.Config {
}
}

type receiver struct {
type otlpjsonfilereceiver struct {
input *fileconsumer.Manager
id component.ID
storageID *component.ID
}

func (f *receiver) Start(ctx context.Context, host component.Host) error {
func (f *otlpjsonfilereceiver) Start(ctx context.Context, host component.Host) error {
storageClient, err := adapter.GetStorageClient(ctx, host, f.storageID, f.id)
if err != nil {
return err
}
return f.input.Start(storageClient)
}

func (f *receiver) Shutdown(_ context.Context) error {
func (f *otlpjsonfilereceiver) Shutdown(_ context.Context) error {
return f.input.Stop()
}

func createLogsReceiver(_ context.Context, settings rcvr.CreateSettings, configuration component.Config, logs consumer.Logs) (rcvr.Logs, error) {
func createLogsReceiver(_ context.Context, settings receiver.CreateSettings, configuration component.Config, logs consumer.Logs) (receiver.Logs, error) {
logsUnmarshaler := &plog.JSONUnmarshaler{}
obsrecv, err := obsreport.NewReceiver(obsreport.ReceiverSettings{
ReceiverID: settings.ID,
Expand Down Expand Up @@ -91,10 +91,10 @@ func createLogsReceiver(_ context.Context, settings rcvr.CreateSettings, configu
return nil, err
}

return &receiver{input: input, id: settings.ID, storageID: cfg.StorageID}, nil
return &otlpjsonfilereceiver{input: input, id: settings.ID, storageID: cfg.StorageID}, nil
}

func createMetricsReceiver(_ context.Context, settings rcvr.CreateSettings, configuration component.Config, metrics consumer.Metrics) (rcvr.Metrics, error) {
func createMetricsReceiver(_ context.Context, settings receiver.CreateSettings, configuration component.Config, metrics consumer.Metrics) (receiver.Metrics, error) {
metricsUnmarshaler := &pmetric.JSONUnmarshaler{}
obsrecv, err := obsreport.NewReceiver(obsreport.ReceiverSettings{
ReceiverID: settings.ID,
Expand Down Expand Up @@ -123,10 +123,10 @@ func createMetricsReceiver(_ context.Context, settings rcvr.CreateSettings, conf
return nil, err
}

return &receiver{input: input, id: settings.ID, storageID: cfg.StorageID}, nil
return &otlpjsonfilereceiver{input: input, id: settings.ID, storageID: cfg.StorageID}, nil
}

func createTracesReceiver(_ context.Context, settings rcvr.CreateSettings, configuration component.Config, traces consumer.Traces) (rcvr.Traces, error) {
func createTracesReceiver(_ context.Context, settings receiver.CreateSettings, configuration component.Config, traces consumer.Traces) (receiver.Traces, error) {
tracesUnmarshaler := &ptrace.JSONUnmarshaler{}
obsrecv, err := obsreport.NewReceiver(obsreport.ReceiverSettings{
ReceiverID: settings.ID,
Expand Down Expand Up @@ -155,5 +155,5 @@ func createTracesReceiver(_ context.Context, settings rcvr.CreateSettings, confi
return nil, err
}

return &receiver{input: input, id: settings.ID, storageID: cfg.StorageID}, nil
return &otlpjsonfilereceiver{input: input, id: settings.ID, storageID: cfg.StorageID}, nil
}

0 comments on commit 28fe356

Please sign in to comment.