Skip to content

Commit

Permalink
[chore] fix unintended public type settings when moved pipelines (ope…
Browse files Browse the repository at this point in the history
…n-telemetry#6697)

Signed-off-by: Bogdan Drutu <[email protected]>

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored and jaronoff97 committed Dec 14, 2022
1 parent f393e25 commit d63042b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions service/pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ func (bps *builtPipelines) HandleZPages(w http.ResponseWriter, r *http.Request)
zpages.WriteHTMLPageFooter(w)
}

// Settings holds configuration for building builtPipelines.
type Settings struct {
// pipelinesSettings holds configuration for building builtPipelines.
type pipelinesSettings struct {
Telemetry component.TelemetrySettings
BuildInfo component.BuildInfo

Expand All @@ -205,7 +205,7 @@ type Settings struct {
}

// buildPipelines builds all pipelines from config.
func buildPipelines(ctx context.Context, set Settings) (*builtPipelines, error) {
func buildPipelines(ctx context.Context, set pipelinesSettings) (*builtPipelines, error) {
exps := &builtPipelines{
telemetry: set.Telemetry,
allReceivers: make(map[component.DataType]map[component.ID]component.Component),
Expand Down
36 changes: 18 additions & 18 deletions service/pipelines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func TestBuildPipelines(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
// Build the pipeline
pipelines, err := buildPipelines(context.Background(), Settings{
pipelines, err := buildPipelines(context.Background(), pipelinesSettings{
Telemetry: componenttest.NewNopTelemetrySettings(),
BuildInfo: component.NewDefaultBuildInfo(),
ReceiverFactories: map[component.Type]component.ReceiverFactory{
Expand Down Expand Up @@ -296,11 +296,11 @@ func TestBuildErrors(t *testing.T) {

tests := []struct {
name string
settings Settings
settings pipelinesSettings
}{
{
name: "not_supported_exporter_logs",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -317,7 +317,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "not_supported_exporter_metrics",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -334,7 +334,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "not_supported_exporter_traces",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -351,7 +351,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "not_supported_processor_logs",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -372,7 +372,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "not_supported_processor_metrics",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -393,7 +393,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "not_supported_processor_traces",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -414,7 +414,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "not_supported_receiver_logs",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("bf"): badReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -431,7 +431,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "not_supported_receiver_metrics",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("bf"): badReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -448,7 +448,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "not_supported_receiver_traces",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("bf"): badReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -465,7 +465,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "unknown_exporter_config",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -482,7 +482,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "unknown_exporter_factory",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -499,7 +499,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "unknown_processor_config",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -520,7 +520,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "unknown_processor_factory",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -541,7 +541,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "unknown_receiver_config",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("nop"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand All @@ -558,7 +558,7 @@ func TestBuildErrors(t *testing.T) {
},
{
name: "unknown_receiver_factory",
settings: Settings{
settings: pipelinesSettings{
ReceiverConfigs: map[component.ID]component.Config{
component.NewID("unknown"): nopReceiverFactory.CreateDefaultConfig(),
},
Expand Down Expand Up @@ -607,7 +607,7 @@ func TestFailToStartAndShutdown(t *testing.T) {
nopProcessorFactory := componenttest.NewNopProcessorFactory()
nopExporterFactory := componenttest.NewNopExporterFactory()

set := Settings{
set := pipelinesSettings{
Telemetry: componenttest.NewNopTelemetrySettings(),
BuildInfo: component.NewDefaultBuildInfo(),
ReceiverFactories: map[component.Type]component.ReceiverFactory{
Expand Down
4 changes: 2 additions & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (srv *service) initExtensionsAndPipeline(set *settings) error {
return fmt.Errorf("failed build extensions: %w", err)
}

pipelinesSettings := Settings{
pSet := pipelinesSettings{
Telemetry: srv.telemetrySettings,
BuildInfo: srv.buildInfo,
ReceiverFactories: srv.host.factories.Receivers,
Expand All @@ -158,7 +158,7 @@ func (srv *service) initExtensionsAndPipeline(set *settings) error {
ExporterConfigs: srv.config.Exporters,
PipelineConfigs: srv.config.Service.Pipelines,
}
if srv.host.pipelines, err = buildPipelines(context.Background(), pipelinesSettings); err != nil {
if srv.host.pipelines, err = buildPipelines(context.Background(), pSet); err != nil {
return fmt.Errorf("cannot build pipelines: %w", err)
}

Expand Down

0 comments on commit d63042b

Please sign in to comment.