diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b06b63722a..c77fcd83382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1383,8 +1383,8 @@ and hope to make a v1.0.0 release soon. - `config`: Deprecate multiple types and funcs in `config` package (#6422) - config.ComponentID => component.ID - config.Type => component.Type - - config.DataType => component.DataType - - config.[Traces|Metrics|Logs]DataType => component.DataType[Traces|Metrics|Logs] + - config.DataType => component.Signal + - config.[Traces|Metrics|Logs]DataType => component.Signal[Traces|Metrics|Logs] - config.Receiver => component.ReceiverConfig - config.UnmarshalReceiver => component.UnmarshalReceiverConfig - config.Processor => component.ProcessorConfig diff --git a/cmd/mdatagen/templates/component_test.go.tmpl b/cmd/mdatagen/templates/component_test.go.tmpl index be75cb1bae9..a0f12ae84c5 100644 --- a/cmd/mdatagen/templates/component_test.go.tmpl +++ b/cmd/mdatagen/templates/component_test.go.tmpl @@ -372,7 +372,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs_to_logs", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()}) + router := connector.NewLogsRouter(map[component.PipelineID]consumer.Logs{component.NewPipelineID(component.SignalLogs): consumertest.NewNop()}) return factory.CreateLogsToLogs(ctx, set, cfg, router) }, }, @@ -381,7 +381,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs_to_metrics", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()}) + router := connector.NewMetricsRouter(map[component.PipelineID]consumer.Metrics{component.NewPipelineID(component.SignalMetrics): consumertest.NewNop()}) return factory.CreateLogsToMetrics(ctx, set, cfg, router) }, }, @@ -390,7 +390,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs_to_traces", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()}) + router := connector.NewTracesRouter(map[component.PipelineID]consumer.Traces{component.NewPipelineID(component.SignalTraces): consumertest.NewNop()}) return factory.CreateLogsToTraces(ctx, set, cfg, router) }, }, @@ -399,7 +399,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "metrics_to_logs", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()}) + router := connector.NewLogsRouter(map[component.PipelineID]consumer.Logs{component.NewPipelineID(component.SignalLogs): consumertest.NewNop()}) return factory.CreateMetricsToLogs(ctx, set, cfg, router) }, }, @@ -408,7 +408,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "metrics_to_metrics", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()}) + router := connector.NewMetricsRouter(map[component.PipelineID]consumer.Metrics{component.NewPipelineID(component.SignalMetrics): consumertest.NewNop()}) return factory.CreateMetricsToMetrics(ctx, set, cfg, router) }, }, @@ -417,7 +417,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "metrics_to_traces", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()}) + router := connector.NewTracesRouter(map[component.PipelineID]consumer.Traces{component.NewPipelineID(component.SignalTraces): consumertest.NewNop()}) return factory.CreateMetricsToTraces(ctx, set, cfg, router) }, }, @@ -426,7 +426,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "traces_to_logs", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()}) + router := connector.NewLogsRouter(map[component.PipelineID]consumer.Logs{component.NewPipelineID(component.SignalLogs): consumertest.NewNop()}) return factory.CreateTracesToLogs(ctx, set, cfg, router) }, }, @@ -435,7 +435,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "traces_to_metrics", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()}) + router := connector.NewMetricsRouter(map[component.PipelineID]consumer.Metrics{component.NewPipelineID(component.SignalMetrics): consumertest.NewNop()}) return factory.CreateTracesToMetrics(ctx, set, cfg, router) }, }, @@ -444,7 +444,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "traces_to_traces", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()}) + router := connector.NewTracesRouter(map[component.PipelineID]consumer.Traces{component.NewPipelineID(component.SignalTraces): consumertest.NewNop()}) return factory.CreateTracesToTraces(ctx, set, cfg, router) }, }, diff --git a/component/componentprofiles/config.go b/component/componentprofiles/config.go index 85b4e90ca80..372903de285 100644 --- a/component/componentprofiles/config.go +++ b/component/componentprofiles/config.go @@ -5,11 +5,6 @@ package componentprofiles // import "go.opentelemetry.io/collector/component/com import "go.opentelemetry.io/collector/component" -func mustNewDataType(strType string) component.DataType { - return component.MustNewType(strType) -} - -var ( - // DataTypeProfiles is the data type tag for profiles. - DataTypeProfiles = mustNewDataType("profiles") +const ( + SignalProfiles = component.Signal("profiles") ) diff --git a/component/componentstatus/instance.go b/component/componentstatus/instance.go index 71668b6d351..343cad81bcc 100644 --- a/component/componentstatus/instance.go +++ b/component/componentstatus/instance.go @@ -26,7 +26,7 @@ type InstanceID struct { } // NewInstanceID returns an ID that uniquely identifies a component. -func NewInstanceID(componentID component.ID, kind component.Kind, pipelineIDs ...component.ID) *InstanceID { +func NewInstanceID(componentID component.ID, kind component.Kind, pipelineIDs ...component.PipelineID) *InstanceID { instanceID := &InstanceID{ componentID: componentID, kind: kind, @@ -47,14 +47,14 @@ func (id *InstanceID) Kind() component.Kind { // AllPipelineIDs calls f for each pipeline this instance is associated with. If // f returns false it will stop iteration. -func (id *InstanceID) AllPipelineIDs(f func(component.ID) bool) { +func (id *InstanceID) AllPipelineIDs(f func(component.PipelineID) bool) { var bs []byte for _, b := range []byte(id.pipelineIDs) { if b != pipelineDelim { bs = append(bs, b) continue } - pipelineID := component.ID{} + pipelineID := component.PipelineID{} err := pipelineID.UnmarshalText(bs) bs = bs[:0] if err != nil { @@ -68,7 +68,7 @@ func (id *InstanceID) AllPipelineIDs(f func(component.ID) bool) { // WithPipelines returns a new InstanceID updated to include the given // pipelineIDs. -func (id *InstanceID) WithPipelines(pipelineIDs ...component.ID) *InstanceID { +func (id *InstanceID) WithPipelines(pipelineIDs ...component.PipelineID) *InstanceID { instanceID := &InstanceID{ componentID: id.componentID, kind: id.kind, @@ -78,7 +78,7 @@ func (id *InstanceID) WithPipelines(pipelineIDs ...component.ID) *InstanceID { return instanceID } -func (id *InstanceID) addPipelines(pipelineIDs []component.ID) { +func (id *InstanceID) addPipelines(pipelineIDs []component.PipelineID) { delim := string(pipelineDelim) strIDs := strings.Split(id.pipelineIDs, delim) for _, pID := range pipelineIDs { diff --git a/component/componentstatus/instance_test.go b/component/componentstatus/instance_test.go index 486607ae8dd..9dc5dd9a8bb 100644 --- a/component/componentstatus/instance_test.go +++ b/component/componentstatus/instance_test.go @@ -13,17 +13,17 @@ import ( func TestInstanceID(t *testing.T) { traces := component.MustNewID("traces") - tracesA := component.MustNewIDWithName("traces", "a") - tracesB := component.MustNewIDWithName("traces", "b") - tracesC := component.MustNewIDWithName("traces", "c") + tracesA := component.NewPipelineIDWithName("traces", "a") + tracesB := component.NewPipelineIDWithName("traces", "b") + tracesC := component.NewPipelineIDWithName("traces", "c") idTracesA := NewInstanceID(traces, component.KindReceiver, tracesA) idTracesAll := NewInstanceID(traces, component.KindReceiver, tracesA, tracesB, tracesC) assert.NotEqual(t, idTracesA, idTracesAll) - assertHasPipelines := func(t *testing.T, instanceID *InstanceID, expectedPipelineIDs []component.ID) { - var pipelineIDs []component.ID - instanceID.AllPipelineIDs(func(id component.ID) bool { + assertHasPipelines := func(t *testing.T, instanceID *InstanceID, expectedPipelineIDs []component.PipelineID) { + var pipelineIDs []component.PipelineID + instanceID.AllPipelineIDs(func(id component.PipelineID) bool { pipelineIDs = append(pipelineIDs, id) return true }) @@ -34,31 +34,31 @@ func TestInstanceID(t *testing.T) { name string id1 *InstanceID id2 *InstanceID - pipelineIDs []component.ID + pipelineIDs []component.PipelineID }{ { name: "equal instances", id1: idTracesA, id2: NewInstanceID(traces, component.KindReceiver, tracesA), - pipelineIDs: []component.ID{tracesA}, + pipelineIDs: []component.PipelineID{tracesA}, }, { name: "equal instances - out of order", id1: idTracesAll, id2: NewInstanceID(traces, component.KindReceiver, tracesC, tracesB, tracesA), - pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + pipelineIDs: []component.PipelineID{tracesA, tracesB, tracesC}, }, { name: "with pipelines", id1: idTracesAll, id2: idTracesA.WithPipelines(tracesB, tracesC), - pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + pipelineIDs: []component.PipelineID{tracesA, tracesB, tracesC}, }, { name: "with pipelines - out of order", id1: idTracesAll, id2: idTracesA.WithPipelines(tracesC, tracesB), - pipelineIDs: []component.ID{tracesA, tracesB, tracesC}, + pipelineIDs: []component.PipelineID{tracesA, tracesB, tracesC}, }, } { t.Run(tc.name, func(t *testing.T) { @@ -73,20 +73,20 @@ func TestAllPipelineIDs(t *testing.T) { instanceID := NewInstanceID( component.MustNewID("traces"), component.KindReceiver, - component.MustNewIDWithName("traces", "a"), - component.MustNewIDWithName("traces", "b"), - component.MustNewIDWithName("traces", "c"), + component.NewPipelineIDWithName("traces", "a"), + component.NewPipelineIDWithName("traces", "b"), + component.NewPipelineIDWithName("traces", "c"), ) count := 0 - instanceID.AllPipelineIDs(func(component.ID) bool { + instanceID.AllPipelineIDs(func(component.PipelineID) bool { count++ return true }) assert.Equal(t, 3, count) count = 0 - instanceID.AllPipelineIDs(func(component.ID) bool { + instanceID.AllPipelineIDs(func(component.PipelineID) bool { count++ return false }) diff --git a/component/config.go b/component/config.go index 8eadee0c1f5..3319b20f802 100644 --- a/component/config.go +++ b/component/config.go @@ -4,6 +4,7 @@ package component // import "go.opentelemetry.io/collector/component" import ( + "errors" "fmt" "reflect" "regexp" @@ -147,6 +148,8 @@ func MustNewType(strType string) Type { // DataType is a special Type that represents the data types supported by the collector. We currently support // collecting metrics, traces and logs, this can expand in the future. +// +// Deprecated: [v0.108.0] Use Signal instead type DataType = Type func mustNewDataType(strType string) DataType { @@ -156,12 +159,18 @@ func mustNewDataType(strType string) DataType { // Currently supported data types. Add new data types here when new types are supported in the future. var ( // DataTypeTraces is the data type tag for traces. + // + // Deprecated: [v0.108.0] Use SignalTraces instead DataTypeTraces = mustNewDataType("traces") // DataTypeMetrics is the data type tag for metrics. + // + // Deprecated: [v0.108.0] Use SignalMetrics instead DataTypeMetrics = mustNewDataType("metrics") // DataTypeLogs is the data type tag for logs. + // + // Deprecated: [v0.108.0] Use SignalLogs instead DataTypeLogs = mustNewDataType("logs") ) @@ -179,3 +188,39 @@ func validateName(nameStr string) error { } return nil } + +type Signal string + +const ( + SignalTraces Signal = "traces" + SignalMetrics Signal = "metrics" + SignalLogs Signal = "logs" +) + +func (s Signal) String() string { + return string(s) +} + +func (s Signal) MarshalText() (text []byte, err error) { + return []byte(s), nil +} + +func (s *Signal) UnmarshalText(text []byte) error { + if len(text) == 0 { + return errors.New("id must not be empty") + } + strText := string(text) + switch strText { + case "traces": + *s = SignalTraces + return nil + case "metrics": + *s = SignalMetrics + return nil + case "logs": + *s = SignalLogs + return nil + default: + return fmt.Errorf("invalid signal %q", strText) + } +} diff --git a/component/identifiable.go b/component/identifiable.go index 9a930d2070c..d8a13e8acf0 100644 --- a/component/identifiable.go +++ b/component/identifiable.go @@ -104,3 +104,74 @@ func (id ID) String() string { return id.typeVal.String() + typeAndNameSeparator + id.nameVal } + +type PipelineID struct { + signal Signal `mapstructure:"-"` + nameVal string `mapstructure:"-"` +} + +func NewPipelineID(signal Signal) PipelineID { + return PipelineID{signal: signal} +} + +func NewPipelineIDWithName(signal Signal, nameVal string) PipelineID { + return PipelineID{signal: signal, nameVal: nameVal} +} + +func (p PipelineID) Signal() Signal { + return p.signal +} + +func (p PipelineID) Name() string { + return p.nameVal +} + +func (p PipelineID) MarshalText() (text []byte, err error) { + return []byte(p.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +func (p *PipelineID) UnmarshalText(text []byte) error { + pipelineStr := string(text) + items := strings.SplitN(pipelineStr, typeAndNameSeparator, 2) + var signalStr, nameStr string + if len(items) >= 1 { + signalStr = strings.TrimSpace(items[0]) + } + + if len(items) == 1 && signalStr == "" { + return errors.New("id must not be empty") + } + + if signalStr == "" { + return fmt.Errorf("in %q id: the part before %s should not be empty", pipelineStr, typeAndNameSeparator) + } + + err := p.signal.UnmarshalText([]byte(signalStr)) + if err != nil { + return err + } + + if len(items) > 1 { + // "name" part is present. + nameStr = strings.TrimSpace(items[1]) + if nameStr == "" { + return fmt.Errorf("in %q id: the part after %s should not be empty", pipelineStr, typeAndNameSeparator) + } + if err := validateName(nameStr); err != nil { + return fmt.Errorf("in %q id: %w", nameStr, err) + } + } + p.nameVal = nameStr + + return nil +} + +// String returns the ID string representation as "type[/name]" format. +func (p PipelineID) String() string { + if p.nameVal == "" { + return p.signal.String() + } + + return p.signal.String() + typeAndNameSeparator + p.nameVal +} diff --git a/connector/connector_test.go b/connector/connector_test.go index 08337f78568..b96565532e3 100644 --- a/connector/connector_test.go +++ b/connector/connector_test.go @@ -27,25 +27,25 @@ func TestNewFactoryNoOptions(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) _, err := factory.CreateTracesToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalTraces, component.SignalTraces)) _, err = factory.CreateTracesToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalTraces, component.SignalMetrics)) _, err = factory.CreateTracesToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalTraces, component.SignalLogs)) _, err = factory.CreateMetricsToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalMetrics, component.SignalTraces)) _, err = factory.CreateMetricsToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalMetrics, component.SignalMetrics)) _, err = factory.CreateMetricsToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalMetrics, component.SignalLogs)) _, err = factory.CreateLogsToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalLogs, component.SignalTraces)) _, err = factory.CreateLogsToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalLogs, component.SignalMetrics)) _, err = factory.CreateLogsToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalLogs, component.SignalLogs)) } func TestNewFactoryWithSameTypes(t *testing.T) { @@ -70,19 +70,19 @@ func TestNewFactoryWithSameTypes(t *testing.T) { assert.NoError(t, err) _, err = factory.CreateTracesToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalTraces, component.SignalMetrics)) _, err = factory.CreateTracesToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalTraces, component.SignalLogs)) _, err = factory.CreateMetricsToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalMetrics, component.SignalTraces)) _, err = factory.CreateMetricsToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalMetrics, component.SignalLogs)) _, err = factory.CreateLogsToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalLogs, component.SignalTraces)) _, err = factory.CreateLogsToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalLogs, component.SignalMetrics)) } func TestNewFactoryWithTranslateTypes(t *testing.T) { @@ -98,11 +98,11 @@ func TestNewFactoryWithTranslateTypes(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) _, err := factory.CreateTracesToTraces(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalTraces, component.SignalTraces)) _, err = factory.CreateMetricsToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalMetrics, component.SignalMetrics)) _, err = factory.CreateLogsToLogs(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalLogs, component.SignalLogs)) assert.Equal(t, component.StabilityLevelDevelopment, factory.TracesToMetricsStability()) _, err = factory.CreateTracesToMetrics(context.Background(), Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) diff --git a/connector/connectorprofiles/connector_test.go b/connector/connectorprofiles/connector_test.go index adb360be028..8f42f03b20a 100644 --- a/connector/connectorprofiles/connector_test.go +++ b/connector/connectorprofiles/connector_test.go @@ -30,18 +30,18 @@ func TestNewFactoryNoOptions(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) _, err := factory.CreateTracesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeTraces, componentprofiles.DataTypeProfiles)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalTraces, componentprofiles.SignalProfiles)) _, err = factory.CreateMetricsToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeMetrics, componentprofiles.DataTypeProfiles)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalMetrics, componentprofiles.SignalProfiles)) _, err = factory.CreateLogsToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, component.DataTypeLogs, componentprofiles.DataTypeProfiles)) + assert.Equal(t, err, internal.ErrDataTypes(testID, component.SignalLogs, componentprofiles.SignalProfiles)) _, err = factory.CreateProfilesToTraces(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, component.SignalTraces)) _, err = factory.CreateProfilesToMetrics(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, component.SignalMetrics)) _, err = factory.CreateProfilesToLogs(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, component.SignalLogs)) } func TestNewFactoryWithSameTypes(t *testing.T) { @@ -57,11 +57,11 @@ func TestNewFactoryWithSameTypes(t *testing.T) { assert.NoError(t, err) _, err = factory.CreateProfilesToTraces(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeTraces)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, component.SignalTraces)) _, err = factory.CreateProfilesToMetrics(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, component.SignalMetrics)) _, err = factory.CreateProfilesToLogs(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, component.DataTypeLogs)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, component.SignalLogs)) } func TestNewFactoryWithTranslateTypes(t *testing.T) { @@ -79,7 +79,7 @@ func TestNewFactoryWithTranslateTypes(t *testing.T) { assert.EqualValues(t, &defaultCfg, factory.CreateDefaultConfig()) _, err := factory.CreateProfilesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) - assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.DataTypeProfiles, componentprofiles.DataTypeProfiles)) + assert.Equal(t, err, internal.ErrDataTypes(testID, componentprofiles.SignalProfiles, componentprofiles.SignalProfiles)) assert.Equal(t, component.StabilityLevelBeta, factory.TracesToProfilesStability()) _, err = factory.CreateTracesToProfiles(context.Background(), connector.Settings{ID: testID}, &defaultCfg, consumertest.NewNop()) diff --git a/connector/connectorprofiles/profiles_router.go b/connector/connectorprofiles/profiles_router.go index 73e427f1d52..53c614967a8 100644 --- a/connector/connectorprofiles/profiles_router.go +++ b/connector/connectorprofiles/profiles_router.go @@ -13,8 +13,8 @@ import ( // ProfilesRouterAndConsumer feeds the first consumerprofiles.Profiles in each of the specified pipelines. type ProfilesRouterAndConsumer interface { consumerprofiles.Profiles - Consumer(...component.ID) (consumerprofiles.Profiles, error) - PipelineIDs() []component.ID + Consumer(...component.PipelineID) (consumerprofiles.Profiles, error) + PipelineIDs() []component.PipelineID privateFunc() } @@ -23,7 +23,7 @@ type profilesRouter struct { internal.BaseRouter[consumerprofiles.Profiles] } -func NewProfilesRouter(cm map[component.ID]consumerprofiles.Profiles) ProfilesRouterAndConsumer { +func NewProfilesRouter(cm map[component.PipelineID]consumerprofiles.Profiles) ProfilesRouterAndConsumer { consumers := make([]consumerprofiles.Profiles, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) diff --git a/connector/connectorprofiles/profiles_router_test.go b/connector/connectorprofiles/profiles_router_test.go index fcec379dfba..bdb3325ea59 100644 --- a/connector/connectorprofiles/profiles_router_test.go +++ b/connector/connectorprofiles/profiles_router_test.go @@ -43,13 +43,13 @@ func TestProfilesRouterMultiplexing(t *testing.T) { func fuzzProfiles(numIDs, numCons, numProfiles int) func(*testing.T) { return func(t *testing.T) { - allIDs := make([]component.ID, 0, numCons) + allIDs := make([]component.PipelineID, 0, numCons) allCons := make([]consumerprofiles.Profiles, 0, numCons) - allConsMap := make(map[component.ID]consumerprofiles.Profiles) + allConsMap := make(map[component.PipelineID]consumerprofiles.Profiles) // If any consumer is mutating, the router must report mutating for i := 0; i < numCons; i++ { - allIDs = append(allIDs, component.MustNewIDWithName("sink", strconv.Itoa(numCons))) + allIDs = append(allIDs, component.NewPipelineIDWithName("sink", strconv.Itoa(numCons))) // Random chance for each consumer to be mutating if (numCons+numProfiles+i)%4 == 0 { allCons = append(allCons, &mutatingProfilesSink{ProfilesSink: new(consumertest.ProfilesSink)}) @@ -64,11 +64,11 @@ func fuzzProfiles(numIDs, numCons, numProfiles int) func(*testing.T) { // Keep track of how many logs each consumer should receive. // This will be validated after every call to RouteProfiles. - expected := make(map[component.ID]int, numCons) + expected := make(map[component.PipelineID]int, numCons) for i := 0; i < numProfiles; i++ { // Build a random set of ids (no duplicates) - randCons := make(map[component.ID]bool, numIDs) + randCons := make(map[component.PipelineID]bool, numIDs) for j := 0; j < numIDs; j++ { // This number should be pretty random and less than numCons conNum := (numCons + numIDs + i + j) % numCons @@ -76,7 +76,7 @@ func fuzzProfiles(numIDs, numCons, numProfiles int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]component.PipelineID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -109,16 +109,16 @@ func TestProfilessRouterConsumer(t *testing.T) { ctx := context.Background() td := testdata.GenerateProfiles(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := component.NewPipelineID("foo") + barID := component.NewPipelineID("bar") foo := new(consumertest.ProfilesSink) bar := new(consumertest.ProfilesSink) - r := NewProfilesRouter(map[component.ID]consumerprofiles.Profiles{fooID: foo, barID: bar}) + r := NewProfilesRouter(map[component.PipelineID]consumerprofiles.Profiles{fooID: foo, barID: bar}) rcs := r.PipelineIDs() assert.Len(t, rcs, 2) - assert.ElementsMatch(t, []component.ID{fooID, barID}, rcs) + assert.ElementsMatch(t, []component.PipelineID{fooID, barID}, rcs) assert.Len(t, foo.AllProfiles(), 0) assert.Len(t, bar.AllProfiles(), 0) @@ -151,7 +151,7 @@ func TestProfilessRouterConsumer(t *testing.T) { assert.Nil(t, none) assert.Error(t, err) - fake, err := r.Consumer(component.MustNewID("fake")) + fake, err := r.Consumer(component.NewPipelineID("fake")) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/connector/forwardconnector/generated_component_test.go b/connector/forwardconnector/generated_component_test.go index ec49a1d505d..271cd0d3fc0 100644 --- a/connector/forwardconnector/generated_component_test.go +++ b/connector/forwardconnector/generated_component_test.go @@ -36,7 +36,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "logs_to_logs", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewLogsRouter(map[component.ID]consumer.Logs{component.NewID(component.DataTypeLogs): consumertest.NewNop()}) + router := connector.NewLogsRouter(map[component.PipelineID]consumer.Logs{component.NewPipelineID(component.SignalLogs): consumertest.NewNop()}) return factory.CreateLogsToLogs(ctx, set, cfg, router) }, }, @@ -44,7 +44,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "metrics_to_metrics", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewMetricsRouter(map[component.ID]consumer.Metrics{component.NewID(component.DataTypeMetrics): consumertest.NewNop()}) + router := connector.NewMetricsRouter(map[component.PipelineID]consumer.Metrics{component.NewPipelineID(component.SignalMetrics): consumertest.NewNop()}) return factory.CreateMetricsToMetrics(ctx, set, cfg, router) }, }, @@ -52,7 +52,7 @@ func TestComponentLifecycle(t *testing.T) { { name: "traces_to_traces", createFn: func(ctx context.Context, set connector.Settings, cfg component.Config) (component.Component, error) { - router := connector.NewTracesRouter(map[component.ID]consumer.Traces{component.NewID(component.DataTypeTraces): consumertest.NewNop()}) + router := connector.NewTracesRouter(map[component.PipelineID]consumer.Traces{component.NewPipelineID(component.SignalTraces): consumertest.NewNop()}) return factory.CreateTracesToTraces(ctx, set, cfg, router) }, }, diff --git a/connector/internal/factory.go b/connector/internal/factory.go index 09f6c2ddbf5..d5c48194f4f 100644 --- a/connector/internal/factory.go +++ b/connector/internal/factory.go @@ -143,7 +143,7 @@ func (f CreateTracesToTracesFunc) CreateTracesToTraces( cfg component.Config, nextConsumer consumer.Traces) (Traces, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeTraces, component.DataTypeTraces) + return nil, ErrDataTypes(set.ID, component.SignalTraces, component.SignalTraces) } return f(ctx, set, cfg, nextConsumer) } @@ -159,7 +159,7 @@ func (f CreateTracesToMetricsFunc) CreateTracesToMetrics( nextConsumer consumer.Metrics, ) (Traces, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeTraces, component.DataTypeMetrics) + return nil, ErrDataTypes(set.ID, component.SignalTraces, component.SignalMetrics) } return f(ctx, set, cfg, nextConsumer) } @@ -175,7 +175,7 @@ func (f CreateTracesToLogsFunc) CreateTracesToLogs( nextConsumer consumer.Logs, ) (Traces, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeTraces, component.DataTypeLogs) + return nil, ErrDataTypes(set.ID, component.SignalTraces, component.SignalLogs) } return f(ctx, set, cfg, nextConsumer) } @@ -191,7 +191,7 @@ func (f CreateTracesToProfilesFunc) CreateTracesToProfiles( nextConsumer consumerprofiles.Profiles, ) (Traces, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeTraces, componentprofiles.DataTypeProfiles) + return nil, ErrDataTypes(set.ID, component.SignalTraces, componentprofiles.SignalProfiles) } return f(ctx, set, cfg, nextConsumer) } @@ -207,7 +207,7 @@ func (f CreateMetricsToTracesFunc) CreateMetricsToTraces( nextConsumer consumer.Traces, ) (Metrics, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, component.DataTypeTraces) + return nil, ErrDataTypes(set.ID, component.SignalMetrics, component.SignalTraces) } return f(ctx, set, cfg, nextConsumer) } @@ -223,7 +223,7 @@ func (f CreateMetricsToMetricsFunc) CreateMetricsToMetrics( nextConsumer consumer.Metrics, ) (Metrics, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, component.DataTypeMetrics) + return nil, ErrDataTypes(set.ID, component.SignalMetrics, component.SignalMetrics) } return f(ctx, set, cfg, nextConsumer) } @@ -239,7 +239,7 @@ func (f CreateMetricsToLogsFunc) CreateMetricsToLogs( nextConsumer consumer.Logs, ) (Metrics, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, component.DataTypeLogs) + return nil, ErrDataTypes(set.ID, component.SignalMetrics, component.SignalLogs) } return f(ctx, set, cfg, nextConsumer) } @@ -255,7 +255,7 @@ func (f CreateMetricsToProfilesFunc) CreateMetricsToProfiles( nextConsumer consumerprofiles.Profiles, ) (Metrics, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeMetrics, componentprofiles.DataTypeProfiles) + return nil, ErrDataTypes(set.ID, component.SignalMetrics, componentprofiles.SignalProfiles) } return f(ctx, set, cfg, nextConsumer) } @@ -271,7 +271,7 @@ func (f CreateLogsToTracesFunc) CreateLogsToTraces( nextConsumer consumer.Traces, ) (Logs, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeLogs, component.DataTypeTraces) + return nil, ErrDataTypes(set.ID, component.SignalLogs, component.SignalTraces) } return f(ctx, set, cfg, nextConsumer) } @@ -287,7 +287,7 @@ func (f CreateLogsToMetricsFunc) CreateLogsToMetrics( nextConsumer consumer.Metrics, ) (Logs, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeLogs, component.DataTypeMetrics) + return nil, ErrDataTypes(set.ID, component.SignalLogs, component.SignalMetrics) } return f(ctx, set, cfg, nextConsumer) } @@ -303,7 +303,7 @@ func (f CreateLogsToLogsFunc) CreateLogsToLogs( nextConsumer consumer.Logs, ) (Logs, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeLogs, component.DataTypeLogs) + return nil, ErrDataTypes(set.ID, component.SignalLogs, component.SignalLogs) } return f(ctx, set, cfg, nextConsumer) } @@ -319,7 +319,7 @@ func (f CreateLogsToProfilesFunc) CreateLogsToProfiles( nextConsumer consumerprofiles.Profiles, ) (Logs, error) { if f == nil { - return nil, ErrDataTypes(set.ID, component.DataTypeLogs, componentprofiles.DataTypeProfiles) + return nil, ErrDataTypes(set.ID, component.SignalLogs, componentprofiles.SignalProfiles) } return f(ctx, set, cfg, nextConsumer) } @@ -335,7 +335,7 @@ func (f CreateProfilesToProfilesFunc) CreateProfilesToProfiles( nextConsumer consumerprofiles.Profiles, ) (Profiles, error) { if f == nil { - return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, componentprofiles.DataTypeProfiles) + return nil, ErrDataTypes(set.ID, componentprofiles.SignalProfiles, componentprofiles.SignalProfiles) } return f(ctx, set, cfg, nextConsumer) } @@ -351,7 +351,7 @@ func (f CreateProfilesToTracesFunc) CreateProfilesToTraces( nextConsumer consumer.Traces, ) (Profiles, error) { if f == nil { - return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeTraces) + return nil, ErrDataTypes(set.ID, componentprofiles.SignalProfiles, component.SignalTraces) } return f(ctx, set, cfg, nextConsumer) } @@ -367,7 +367,7 @@ func (f CreateProfilesToMetricsFunc) CreateProfilesToMetrics( nextConsumer consumer.Metrics, ) (Profiles, error) { if f == nil { - return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeMetrics) + return nil, ErrDataTypes(set.ID, componentprofiles.SignalProfiles, component.SignalMetrics) } return f(ctx, set, cfg, nextConsumer) } @@ -383,7 +383,7 @@ func (f CreateProfilesToLogsFunc) CreateProfilesToLogs( nextConsumer consumer.Logs, ) (Profiles, error) { if f == nil { - return nil, ErrDataTypes(set.ID, componentprofiles.DataTypeProfiles, component.DataTypeLogs) + return nil, ErrDataTypes(set.ID, componentprofiles.SignalProfiles, component.SignalLogs) } return f(ctx, set, cfg, nextConsumer) } @@ -599,6 +599,6 @@ func WithProfilesToLogs(createProfilesToLogs CreateProfilesToLogsFunc, sl compon }) } -func ErrDataTypes(id component.ID, from, to component.DataType) error { +func ErrDataTypes(id component.ID, from, to component.Signal) error { return fmt.Errorf("connector %q cannot connect from %s to %s: %w", id, from, to, component.ErrDataTypeIsNotSupported) } diff --git a/connector/internal/router.go b/connector/internal/router.go index 18c684807cb..7efaade8cb3 100644 --- a/connector/internal/router.go +++ b/connector/internal/router.go @@ -13,26 +13,26 @@ import ( type BaseRouter[T any] struct { fanout func([]T) T - Consumers map[component.ID]T + Consumers map[component.PipelineID]T } -func NewBaseRouter[T any](fanout func([]T) T, cm map[component.ID]T) BaseRouter[T] { - consumers := make(map[component.ID]T, len(cm)) +func NewBaseRouter[T any](fanout func([]T) T, cm map[component.PipelineID]T) BaseRouter[T] { + consumers := make(map[component.PipelineID]T, len(cm)) for k, v := range cm { consumers[k] = v } return BaseRouter[T]{fanout: fanout, Consumers: consumers} } -func (r *BaseRouter[T]) PipelineIDs() []component.ID { - ids := make([]component.ID, 0, len(r.Consumers)) +func (r *BaseRouter[T]) PipelineIDs() []component.PipelineID { + ids := make([]component.PipelineID, 0, len(r.Consumers)) for id := range r.Consumers { ids = append(ids, id) } return ids } -func (r *BaseRouter[T]) Consumer(pipelineIDs ...component.ID) (T, error) { +func (r *BaseRouter[T]) Consumer(pipelineIDs ...component.PipelineID) (T, error) { var ret T if len(pipelineIDs) == 0 { return ret, fmt.Errorf("missing consumers") diff --git a/connector/logs_router.go b/connector/logs_router.go index 37a3831038e..f99af452720 100644 --- a/connector/logs_router.go +++ b/connector/logs_router.go @@ -17,8 +17,8 @@ import ( // LogsRouterAndConsumer feeds the first consumer.Logs in each of the specified pipelines. type LogsRouterAndConsumer interface { consumer.Logs - Consumer(...component.ID) (consumer.Logs, error) - PipelineIDs() []component.ID + Consumer(...component.PipelineID) (consumer.Logs, error) + PipelineIDs() []component.PipelineID privateFunc() } @@ -27,7 +27,7 @@ type logsRouter struct { internal.BaseRouter[consumer.Logs] } -func NewLogsRouter(cm map[component.ID]consumer.Logs) LogsRouterAndConsumer { +func NewLogsRouter(cm map[component.PipelineID]consumer.Logs) LogsRouterAndConsumer { consumers := make([]consumer.Logs, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) @@ -38,15 +38,15 @@ func NewLogsRouter(cm map[component.ID]consumer.Logs) LogsRouterAndConsumer { } } -func (r *logsRouter) PipelineIDs() []component.ID { - ids := make([]component.ID, 0, len(r.Consumers)) +func (r *logsRouter) PipelineIDs() []component.PipelineID { + ids := make([]component.PipelineID, 0, len(r.Consumers)) for id := range r.Consumers { ids = append(ids, id) } return ids } -func (r *logsRouter) Consumer(pipelineIDs ...component.ID) (consumer.Logs, error) { +func (r *logsRouter) Consumer(pipelineIDs ...component.PipelineID) (consumer.Logs, error) { if len(pipelineIDs) == 0 { return nil, fmt.Errorf("missing consumers") } diff --git a/connector/logs_router_test.go b/connector/logs_router_test.go index a4074762ac1..462cb003de9 100644 --- a/connector/logs_router_test.go +++ b/connector/logs_router_test.go @@ -42,13 +42,13 @@ func TestLogsRouterMultiplexing(t *testing.T) { func fuzzLogs(numIDs, numCons, numLogs int) func(*testing.T) { return func(t *testing.T) { - allIDs := make([]component.ID, 0, numCons) + allIDs := make([]component.PipelineID, 0, numCons) allCons := make([]consumer.Logs, 0, numCons) - allConsMap := make(map[component.ID]consumer.Logs) + allConsMap := make(map[component.PipelineID]consumer.Logs) // If any consumer is mutating, the router must report mutating for i := 0; i < numCons; i++ { - allIDs = append(allIDs, component.MustNewIDWithName("sink", strconv.Itoa(numCons))) + allIDs = append(allIDs, component.NewPipelineIDWithName("sink", strconv.Itoa(numCons))) // Random chance for each consumer to be mutating if (numCons+numLogs+i)%4 == 0 { allCons = append(allCons, &mutatingLogsSink{LogsSink: new(consumertest.LogsSink)}) @@ -63,11 +63,11 @@ func fuzzLogs(numIDs, numCons, numLogs int) func(*testing.T) { // Keep track of how many logs each consumer should receive. // This will be validated after every call to RouteLogs. - expected := make(map[component.ID]int, numCons) + expected := make(map[component.PipelineID]int, numCons) for i := 0; i < numLogs; i++ { // Build a random set of ids (no duplicates) - randCons := make(map[component.ID]bool, numIDs) + randCons := make(map[component.PipelineID]bool, numIDs) for j := 0; j < numIDs; j++ { // This number should be pretty random and less than numCons conNum := (numCons + numIDs + i + j) % numCons @@ -75,7 +75,7 @@ func fuzzLogs(numIDs, numCons, numLogs int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]component.PipelineID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -108,16 +108,16 @@ func TestLogsRouterConsumers(t *testing.T) { ctx := context.Background() ld := testdata.GenerateLogs(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := component.NewPipelineID("foo") + barID := component.NewPipelineID("bar") foo := new(consumertest.LogsSink) bar := new(consumertest.LogsSink) - r := NewLogsRouter(map[component.ID]consumer.Logs{fooID: foo, barID: bar}) + r := NewLogsRouter(map[component.PipelineID]consumer.Logs{fooID: foo, barID: bar}) rcs := r.PipelineIDs() assert.Len(t, rcs, 2) - assert.ElementsMatch(t, []component.ID{fooID, barID}, rcs) + assert.ElementsMatch(t, []component.PipelineID{fooID, barID}, rcs) assert.Len(t, foo.AllLogs(), 0) assert.Len(t, bar.AllLogs(), 0) @@ -150,7 +150,7 @@ func TestLogsRouterConsumers(t *testing.T) { assert.Nil(t, none) assert.Error(t, err) - fake, err := r.Consumer(component.MustNewID("fake")) + fake, err := r.Consumer(component.NewPipelineID("fake")) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/connector/metrics_router.go b/connector/metrics_router.go index 67ba27f86a0..2db0ad82f2b 100644 --- a/connector/metrics_router.go +++ b/connector/metrics_router.go @@ -13,8 +13,8 @@ import ( // MetricsRouterAndConsumer feeds the first consumer.Metrics in each of the specified pipelines. type MetricsRouterAndConsumer interface { consumer.Metrics - Consumer(...component.ID) (consumer.Metrics, error) - PipelineIDs() []component.ID + Consumer(...component.PipelineID) (consumer.Metrics, error) + PipelineIDs() []component.PipelineID privateFunc() } @@ -23,7 +23,7 @@ type metricsRouter struct { internal.BaseRouter[consumer.Metrics] } -func NewMetricsRouter(cm map[component.ID]consumer.Metrics) MetricsRouterAndConsumer { +func NewMetricsRouter(cm map[component.PipelineID]consumer.Metrics) MetricsRouterAndConsumer { consumers := make([]consumer.Metrics, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) diff --git a/connector/metrics_router_test.go b/connector/metrics_router_test.go index c3fe824992a..4eea1fb899d 100644 --- a/connector/metrics_router_test.go +++ b/connector/metrics_router_test.go @@ -42,13 +42,13 @@ func TestMetricsRouterMultiplexing(t *testing.T) { func fuzzMetrics(numIDs, numCons, numMetrics int) func(*testing.T) { return func(t *testing.T) { - allIDs := make([]component.ID, 0, numCons) + allIDs := make([]component.PipelineID, 0, numCons) allCons := make([]consumer.Metrics, 0, numCons) - allConsMap := make(map[component.ID]consumer.Metrics) + allConsMap := make(map[component.PipelineID]consumer.Metrics) // If any consumer is mutating, the router must report mutating for i := 0; i < numCons; i++ { - allIDs = append(allIDs, component.MustNewIDWithName("sink", strconv.Itoa(numCons))) + allIDs = append(allIDs, component.NewPipelineIDWithName("sink", strconv.Itoa(numCons))) // Random chance for each consumer to be mutating if (numCons+numMetrics+i)%4 == 0 { allCons = append(allCons, &mutatingMetricsSink{MetricsSink: new(consumertest.MetricsSink)}) @@ -63,11 +63,11 @@ func fuzzMetrics(numIDs, numCons, numMetrics int) func(*testing.T) { // Keep track of how many logs each consumer should receive. // This will be validated after every call to RouteMetrics. - expected := make(map[component.ID]int, numCons) + expected := make(map[component.PipelineID]int, numCons) for i := 0; i < numMetrics; i++ { // Build a random set of ids (no duplicates) - randCons := make(map[component.ID]bool, numIDs) + randCons := make(map[component.PipelineID]bool, numIDs) for j := 0; j < numIDs; j++ { // This number should be pretty random and less than numCons conNum := (numCons + numIDs + i + j) % numCons @@ -75,7 +75,7 @@ func fuzzMetrics(numIDs, numCons, numMetrics int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]component.PipelineID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -108,16 +108,16 @@ func TestMetricsRouterConsumers(t *testing.T) { ctx := context.Background() md := testdata.GenerateMetrics(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := component.NewPipelineID("foo") + barID := component.NewPipelineID("bar") foo := new(consumertest.MetricsSink) bar := new(consumertest.MetricsSink) - r := NewMetricsRouter(map[component.ID]consumer.Metrics{fooID: foo, barID: bar}) + r := NewMetricsRouter(map[component.PipelineID]consumer.Metrics{fooID: foo, barID: bar}) rcs := r.PipelineIDs() assert.Len(t, rcs, 2) - assert.ElementsMatch(t, []component.ID{fooID, barID}, rcs) + assert.ElementsMatch(t, []component.PipelineID{fooID, barID}, rcs) assert.Len(t, foo.AllMetrics(), 0) assert.Len(t, bar.AllMetrics(), 0) @@ -150,7 +150,7 @@ func TestMetricsRouterConsumers(t *testing.T) { assert.Nil(t, none) assert.Error(t, err) - fake, err := r.Consumer(component.MustNewID("fake")) + fake, err := r.Consumer(component.NewPipelineID("fake")) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/connector/traces_router.go b/connector/traces_router.go index 40cfbdd18a0..20aaef279f8 100644 --- a/connector/traces_router.go +++ b/connector/traces_router.go @@ -13,8 +13,8 @@ import ( // TracesRouterAndConsumer feeds the first consumer.Traces in each of the specified pipelines. type TracesRouterAndConsumer interface { consumer.Traces - Consumer(...component.ID) (consumer.Traces, error) - PipelineIDs() []component.ID + Consumer(...component.PipelineID) (consumer.Traces, error) + PipelineIDs() []component.PipelineID privateFunc() } @@ -23,7 +23,7 @@ type tracesRouter struct { internal.BaseRouter[consumer.Traces] } -func NewTracesRouter(cm map[component.ID]consumer.Traces) TracesRouterAndConsumer { +func NewTracesRouter(cm map[component.PipelineID]consumer.Traces) TracesRouterAndConsumer { consumers := make([]consumer.Traces, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) diff --git a/connector/traces_router_test.go b/connector/traces_router_test.go index 8c93b10528a..adc75f526a7 100644 --- a/connector/traces_router_test.go +++ b/connector/traces_router_test.go @@ -42,13 +42,13 @@ func TestTracesRouterMultiplexing(t *testing.T) { func fuzzTraces(numIDs, numCons, numTraces int) func(*testing.T) { return func(t *testing.T) { - allIDs := make([]component.ID, 0, numCons) + allIDs := make([]component.PipelineID, 0, numCons) allCons := make([]consumer.Traces, 0, numCons) - allConsMap := make(map[component.ID]consumer.Traces) + allConsMap := make(map[component.PipelineID]consumer.Traces) // If any consumer is mutating, the router must report mutating for i := 0; i < numCons; i++ { - allIDs = append(allIDs, component.MustNewIDWithName("sink", strconv.Itoa(numCons))) + allIDs = append(allIDs, component.NewPipelineIDWithName("sink", strconv.Itoa(numCons))) // Random chance for each consumer to be mutating if (numCons+numTraces+i)%4 == 0 { allCons = append(allCons, &mutatingTracesSink{TracesSink: new(consumertest.TracesSink)}) @@ -63,11 +63,11 @@ func fuzzTraces(numIDs, numCons, numTraces int) func(*testing.T) { // Keep track of how many logs each consumer should receive. // This will be validated after every call to RouteTraces. - expected := make(map[component.ID]int, numCons) + expected := make(map[component.PipelineID]int, numCons) for i := 0; i < numTraces; i++ { // Build a random set of ids (no duplicates) - randCons := make(map[component.ID]bool, numIDs) + randCons := make(map[component.PipelineID]bool, numIDs) for j := 0; j < numIDs; j++ { // This number should be pretty random and less than numCons conNum := (numCons + numIDs + i + j) % numCons @@ -75,7 +75,7 @@ func fuzzTraces(numIDs, numCons, numTraces int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]component.PipelineID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -108,16 +108,16 @@ func TestTracesRouterConsumer(t *testing.T) { ctx := context.Background() td := testdata.GenerateTraces(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := component.NewPipelineID("foo") + barID := component.NewPipelineID("bar") foo := new(consumertest.TracesSink) bar := new(consumertest.TracesSink) - r := NewTracesRouter(map[component.ID]consumer.Traces{fooID: foo, barID: bar}) + r := NewTracesRouter(map[component.PipelineID]consumer.Traces{fooID: foo, barID: bar}) rcs := r.PipelineIDs() assert.Len(t, rcs, 2) - assert.ElementsMatch(t, []component.ID{fooID, barID}, rcs) + assert.ElementsMatch(t, []component.PipelineID{fooID, barID}, rcs) assert.Len(t, foo.AllTraces(), 0) assert.Len(t, bar.AllTraces(), 0) @@ -150,7 +150,7 @@ func TestTracesRouterConsumer(t *testing.T) { assert.Nil(t, none) assert.Error(t, err) - fake, err := r.Consumer(component.MustNewID("fake")) + fake, err := r.Consumer(component.NewPipelineID("fake")) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/exporter/exporterhelper/common.go b/exporter/exporterhelper/common.go index e33205f4317..6f08c5b4c40 100644 --- a/exporter/exporterhelper/common.go +++ b/exporter/exporterhelper/common.go @@ -208,7 +208,7 @@ type baseExporter struct { component.StartFunc component.ShutdownFunc - signal component.DataType + signal component.Signal batchMergeFunc exporterbatcher.BatchMergeFunc[Request] batchMergeSplitfunc exporterbatcher.BatchMergeSplitFunc[Request] @@ -239,7 +239,7 @@ type baseExporter struct { batcherOpts []BatcherOption } -func newBaseExporter(set exporter.Settings, signal component.DataType, osf obsrepSenderFactory, options ...Option) (*baseExporter, error) { +func newBaseExporter(set exporter.Settings, signal component.Signal, osf obsrepSenderFactory, options ...Option) (*baseExporter, error) { obsReport, err := newExporter(obsReportSettings{exporterID: set.ID, exporterCreateSettings: set, dataType: signal}) if err != nil { return nil, err diff --git a/exporter/exporterhelper/common_test.go b/exporter/exporterhelper/common_test.go index 9e014929761..d2e056c2da4 100644 --- a/exporter/exporterhelper/common_test.go +++ b/exporter/exporterhelper/common_test.go @@ -24,7 +24,7 @@ import ( var ( defaultType = component.MustNewType("test") - defaultDataType = component.DataTypeMetrics + defaultDataType = component.SignalMetrics defaultID = component.NewID(defaultType) defaultSettings = func() exporter.Settings { set := exportertest.NewNopSettings() diff --git a/exporter/exporterhelper/logs.go b/exporter/exporterhelper/logs.go index 790ba188657..663715dd918 100644 --- a/exporter/exporterhelper/logs.go +++ b/exporter/exporterhelper/logs.go @@ -118,7 +118,7 @@ func NewLogsRequestExporter( return nil, errNilLogsConverter } - be, err := newBaseExporter(set, component.DataTypeLogs, newLogsExporterWithObservability, options...) + be, err := newBaseExporter(set, component.SignalLogs, newLogsExporterWithObservability, options...) if err != nil { return nil, err } @@ -133,7 +133,7 @@ func NewLogsRequestExporter( } sErr := be.send(ctx, req) if errors.Is(sErr, queue.ErrQueueIsFull) { - be.obsrep.recordEnqueueFailure(ctx, component.DataTypeLogs, int64(req.ItemsCount())) + be.obsrep.recordEnqueueFailure(ctx, component.SignalLogs, int64(req.ItemsCount())) } return sErr }, be.consumerOptions...) diff --git a/exporter/exporterhelper/metrics.go b/exporter/exporterhelper/metrics.go index 382c9b9ce8a..9544dd72aec 100644 --- a/exporter/exporterhelper/metrics.go +++ b/exporter/exporterhelper/metrics.go @@ -118,7 +118,7 @@ func NewMetricsRequestExporter( return nil, errNilMetricsConverter } - be, err := newBaseExporter(set, component.DataTypeMetrics, newMetricsSenderWithObservability, options...) + be, err := newBaseExporter(set, component.SignalMetrics, newMetricsSenderWithObservability, options...) if err != nil { return nil, err } @@ -133,7 +133,7 @@ func NewMetricsRequestExporter( } sErr := be.send(ctx, req) if errors.Is(sErr, queue.ErrQueueIsFull) { - be.obsrep.recordEnqueueFailure(ctx, component.DataTypeMetrics, int64(req.ItemsCount())) + be.obsrep.recordEnqueueFailure(ctx, component.SignalMetrics, int64(req.ItemsCount())) } return sErr }, be.consumerOptions...) diff --git a/exporter/exporterhelper/obsexporter.go b/exporter/exporterhelper/obsexporter.go index 751aaf1aac5..820e0c3abf6 100644 --- a/exporter/exporterhelper/obsexporter.go +++ b/exporter/exporterhelper/obsexporter.go @@ -21,7 +21,7 @@ import ( type obsReport struct { spanNamePrefix string tracer trace.Tracer - dataType component.DataType + dataType component.Signal otelAttrs []attribute.KeyValue telemetryBuilder *metadata.TelemetryBuilder @@ -31,7 +31,7 @@ type obsReport struct { type obsReportSettings struct { exporterID component.ID exporterCreateSettings exporter.Settings - dataType component.DataType + dataType component.Signal } func newExporter(cfg obsReportSettings) (*obsReport, error) { @@ -61,7 +61,7 @@ func (or *obsReport) startTracesOp(ctx context.Context) context.Context { // endTracesOp completes the export operation that was started with startTracesOp. func (or *obsReport) endTracesOp(ctx context.Context, numSpans int, err error) { numSent, numFailedToSend := toNumItems(numSpans, err) - or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeTraces, numSent, numFailedToSend) + or.recordMetrics(context.WithoutCancel(ctx), component.SignalTraces, numSent, numFailedToSend) endSpan(ctx, err, numSent, numFailedToSend, obsmetrics.SentSpansKey, obsmetrics.FailedToSendSpansKey) } @@ -78,7 +78,7 @@ func (or *obsReport) startMetricsOp(ctx context.Context) context.Context { // If needed, report your use case in https://github.com/open-telemetry/opentelemetry-collector/issues/10592. func (or *obsReport) endMetricsOp(ctx context.Context, numMetricPoints int, err error) { numSent, numFailedToSend := toNumItems(numMetricPoints, err) - or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeMetrics, numSent, numFailedToSend) + or.recordMetrics(context.WithoutCancel(ctx), component.SignalMetrics, numSent, numFailedToSend) endSpan(ctx, err, numSent, numFailedToSend, obsmetrics.SentMetricPointsKey, obsmetrics.FailedToSendMetricPointsKey) } @@ -92,7 +92,7 @@ func (or *obsReport) startLogsOp(ctx context.Context) context.Context { // endLogsOp completes the export operation that was started with startLogsOp. func (or *obsReport) endLogsOp(ctx context.Context, numLogRecords int, err error) { numSent, numFailedToSend := toNumItems(numLogRecords, err) - or.recordMetrics(context.WithoutCancel(ctx), component.DataTypeLogs, numSent, numFailedToSend) + or.recordMetrics(context.WithoutCancel(ctx), component.SignalLogs, numSent, numFailedToSend) endSpan(ctx, err, numSent, numFailedToSend, obsmetrics.SentLogRecordsKey, obsmetrics.FailedToSendLogRecordsKey) } @@ -104,16 +104,16 @@ func (or *obsReport) startOp(ctx context.Context, operationSuffix string) contex return ctx } -func (or *obsReport) recordMetrics(ctx context.Context, dataType component.DataType, sent, failed int64) { +func (or *obsReport) recordMetrics(ctx context.Context, dataType component.Signal, sent, failed int64) { var sentMeasure, failedMeasure metric.Int64Counter switch dataType { - case component.DataTypeTraces: + case component.SignalTraces: sentMeasure = or.telemetryBuilder.ExporterSentSpans failedMeasure = or.telemetryBuilder.ExporterSendFailedSpans - case component.DataTypeMetrics: + case component.SignalMetrics: sentMeasure = or.telemetryBuilder.ExporterSentMetricPoints failedMeasure = or.telemetryBuilder.ExporterSendFailedMetricPoints - case component.DataTypeLogs: + case component.SignalLogs: sentMeasure = or.telemetryBuilder.ExporterSentLogRecords failedMeasure = or.telemetryBuilder.ExporterSendFailedLogRecords } @@ -144,14 +144,14 @@ func toNumItems(numExportedItems int, err error) (int64, int64) { return int64(numExportedItems), 0 } -func (or *obsReport) recordEnqueueFailure(ctx context.Context, dataType component.DataType, failed int64) { +func (or *obsReport) recordEnqueueFailure(ctx context.Context, dataType component.Signal, failed int64) { var enqueueFailedMeasure metric.Int64Counter switch dataType { - case component.DataTypeTraces: + case component.SignalTraces: enqueueFailedMeasure = or.telemetryBuilder.ExporterEnqueueFailedSpans - case component.DataTypeMetrics: + case component.SignalMetrics: enqueueFailedMeasure = or.telemetryBuilder.ExporterEnqueueFailedMetricPoints - case component.DataTypeLogs: + case component.SignalLogs: enqueueFailedMeasure = or.telemetryBuilder.ExporterEnqueueFailedLogRecords } diff --git a/exporter/exporterhelper/obsreport_test.go b/exporter/exporterhelper/obsreport_test.go index f8ab9aed1c8..6410235072b 100644 --- a/exporter/exporterhelper/obsreport_test.go +++ b/exporter/exporterhelper/obsreport_test.go @@ -26,14 +26,14 @@ func TestExportEnqueueFailure(t *testing.T) { require.NoError(t, err) logRecords := int64(7) - obsrep.recordEnqueueFailure(context.Background(), component.DataTypeLogs, logRecords) + obsrep.recordEnqueueFailure(context.Background(), component.SignalLogs, logRecords) require.NoError(t, tt.CheckExporterEnqueueFailedLogs(logRecords)) spans := int64(12) - obsrep.recordEnqueueFailure(context.Background(), component.DataTypeTraces, spans) + obsrep.recordEnqueueFailure(context.Background(), component.SignalTraces, spans) require.NoError(t, tt.CheckExporterEnqueueFailedTraces(spans)) metricPoints := int64(21) - obsrep.recordEnqueueFailure(context.Background(), component.DataTypeMetrics, metricPoints) + obsrep.recordEnqueueFailure(context.Background(), component.SignalMetrics, metricPoints) require.NoError(t, tt.CheckExporterEnqueueFailedMetrics(metricPoints)) } diff --git a/exporter/exporterhelper/queue_sender_test.go b/exporter/exporterhelper/queue_sender_test.go index 6fab17da4bb..0c729412641 100644 --- a/exporter/exporterhelper/queue_sender_test.go +++ b/exporter/exporterhelper/queue_sender_test.go @@ -205,7 +205,7 @@ func TestQueuedRetryHappyPath(t *testing.T) { } func TestQueuedRetry_QueueMetricsReported(t *testing.T) { - dataTypes := []component.DataType{component.DataTypeLogs, component.DataTypeTraces, component.DataTypeMetrics} + dataTypes := []component.Signal{component.SignalLogs, component.SignalTraces, component.SignalMetrics} for _, dataType := range dataTypes { tt, err := componenttest.SetupTelemetry(defaultID) require.NoError(t, err) @@ -299,7 +299,7 @@ func TestQueueRetryWithDisabledQueue(t *testing.T) { set := exportertest.NewNopSettings() logger, observed := observer.New(zap.ErrorLevel) set.Logger = zap.New(logger) - be, err := newBaseExporter(set, component.DataTypeLogs, newObservabilityConsumerSender, tt.queueOptions...) + be, err := newBaseExporter(set, component.SignalLogs, newObservabilityConsumerSender, tt.queueOptions...) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) ocs := be.obsrepSender.(*observabilityConsumerSender) @@ -323,7 +323,7 @@ func TestQueueFailedRequestDropped(t *testing.T) { set := exportertest.NewNopSettings() logger, observed := observer.New(zap.ErrorLevel) set.Logger = zap.New(logger) - be, err := newBaseExporter(set, component.DataTypeLogs, newNoopObsrepSender, + be, err := newBaseExporter(set, component.SignalLogs, newNoopObsrepSender, WithRequestQueue(exporterqueue.NewDefaultConfig(), exporterqueue.NewMemoryQueueFactory[Request]())) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) diff --git a/exporter/exporterhelper/retry_sender_test.go b/exporter/exporterhelper/retry_sender_test.go index e4de2a7a764..45b7f29cdea 100644 --- a/exporter/exporterhelper/retry_sender_test.go +++ b/exporter/exporterhelper/retry_sender_test.go @@ -229,7 +229,7 @@ func TestQueuedRetry_RetryOnError(t *testing.T) { func TestQueueRetryWithNoQueue(t *testing.T) { rCfg := configretry.NewDefaultBackOffConfig() rCfg.MaxElapsedTime = time.Nanosecond // fail fast - be, err := newBaseExporter(exportertest.NewNopSettings(), component.DataTypeLogs, newObservabilityConsumerSender, WithRetry(rCfg)) + be, err := newBaseExporter(exportertest.NewNopSettings(), component.SignalLogs, newObservabilityConsumerSender, WithRetry(rCfg)) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) ocs := be.obsrepSender.(*observabilityConsumerSender) @@ -250,7 +250,7 @@ func TestQueueRetryWithDisabledRetires(t *testing.T) { set := exportertest.NewNopSettings() logger, observed := observer.New(zap.ErrorLevel) set.Logger = zap.New(logger) - be, err := newBaseExporter(set, component.DataTypeLogs, newObservabilityConsumerSender, WithRetry(rCfg)) + be, err := newBaseExporter(set, component.SignalLogs, newObservabilityConsumerSender, WithRetry(rCfg)) require.NoError(t, err) require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) ocs := be.obsrepSender.(*observabilityConsumerSender) diff --git a/exporter/exporterhelper/traces.go b/exporter/exporterhelper/traces.go index 075db219d6a..0c82aba8ee6 100644 --- a/exporter/exporterhelper/traces.go +++ b/exporter/exporterhelper/traces.go @@ -118,7 +118,7 @@ func NewTracesRequestExporter( return nil, errNilTracesConverter } - be, err := newBaseExporter(set, component.DataTypeTraces, newTracesExporterWithObservability, options...) + be, err := newBaseExporter(set, component.SignalTraces, newTracesExporterWithObservability, options...) if err != nil { return nil, err } @@ -133,7 +133,7 @@ func NewTracesRequestExporter( } sErr := be.send(ctx, req) if errors.Is(sErr, queue.ErrQueueIsFull) { - be.obsrep.recordEnqueueFailure(ctx, component.DataTypeTraces, int64(req.ItemsCount())) + be.obsrep.recordEnqueueFailure(ctx, component.SignalTraces, int64(req.ItemsCount())) } return sErr }, be.consumerOptions...) diff --git a/exporter/exporterqueue/queue.go b/exporter/exporterqueue/queue.go index f47196ba124..fb9971bfcb3 100644 --- a/exporter/exporterqueue/queue.go +++ b/exporter/exporterqueue/queue.go @@ -24,7 +24,7 @@ type Queue[T any] queue.Queue[T] // Settings defines settings for creating a queue. type Settings struct { - DataType component.DataType + DataType component.Signal ExporterSettings exporter.Settings } diff --git a/exporter/exportertest/contract_checker.go b/exporter/exportertest/contract_checker.go index 0ae8f6b5c9a..2e39262e0c1 100644 --- a/exporter/exportertest/contract_checker.go +++ b/exporter/exportertest/contract_checker.go @@ -33,7 +33,7 @@ type CheckConsumeContractParams struct { T *testing.T NumberOfTestElements int // DataType to test for. - DataType component.DataType + DataType component.Signal // ExporterFactory to create an exporter to be tested. ExporterFactory exporter.Factory ExporterConfig component.Config @@ -85,17 +85,17 @@ func CheckConsumeContract(params CheckConsumeContractParams) { func checkConsumeContractScenario(t *testing.T, params CheckConsumeContractParams, decisionFunc func() error, checkIfTestPassed func(*testing.T, int, requestCounter)) { mockConsumerInstance := newMockConsumer(decisionFunc) switch params.DataType { - case component.DataTypeLogs: + case component.SignalLogs: r, err := params.ReceiverFactory.CreateLogsReceiver(context.Background(), receivertest.NewNopSettings(), params.ReceiverConfig, &mockConsumerInstance) require.NoError(t, err) require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost())) checkLogs(t, params, r, &mockConsumerInstance, checkIfTestPassed) - case component.DataTypeTraces: + case component.SignalTraces: r, err := params.ReceiverFactory.CreateTracesReceiver(context.Background(), receivertest.NewNopSettings(), params.ReceiverConfig, &mockConsumerInstance) require.NoError(t, err) require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost())) checkTraces(t, params, r, &mockConsumerInstance, checkIfTestPassed) - case component.DataTypeMetrics: + case component.SignalMetrics: r, err := params.ReceiverFactory.CreateMetricsReceiver(context.Background(), receivertest.NewNopSettings(), params.ReceiverConfig, &mockConsumerInstance) require.NoError(t, err) require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost())) diff --git a/exporter/exportertest/contract_checker_test.go b/exporter/exportertest/contract_checker_test.go index 652f6bc5ac9..27525e8f852 100644 --- a/exporter/exportertest/contract_checker_test.go +++ b/exporter/exportertest/contract_checker_test.go @@ -109,7 +109,7 @@ func TestCheckConsumeContractLogs(t *testing.T) { params := CheckConsumeContractParams{ T: t, ExporterFactory: newMockExporterFactory(mr), - DataType: component.DataTypeLogs, + DataType: component.SignalLogs, ExporterConfig: nopConfig{}, NumberOfTestElements: 10, ReceiverFactory: newMockReceiverFactory(mr), @@ -123,7 +123,7 @@ func TestCheckConsumeContractMetrics(t *testing.T) { CheckConsumeContract(CheckConsumeContractParams{ T: t, ExporterFactory: newMockExporterFactory(mr), - DataType: component.DataTypeMetrics, // Change to the appropriate data type + DataType: component.SignalMetrics, // Change to the appropriate data type ExporterConfig: nopConfig{}, NumberOfTestElements: 10, ReceiverFactory: newMockReceiverFactory(mr), @@ -135,7 +135,7 @@ func TestCheckConsumeContractTraces(t *testing.T) { CheckConsumeContract(CheckConsumeContractParams{ T: t, ExporterFactory: newMockExporterFactory(mr), - DataType: component.DataTypeTraces, + DataType: component.SignalTraces, ExporterConfig: nopConfig{}, NumberOfTestElements: 10, ReceiverFactory: newMockReceiverFactory(mr), diff --git a/exporter/internal/queue/persistent_queue.go b/exporter/internal/queue/persistent_queue.go index 7dd646c6ef3..b9819949080 100644 --- a/exporter/internal/queue/persistent_queue.go +++ b/exporter/internal/queue/persistent_queue.go @@ -85,7 +85,7 @@ var ( type PersistentQueueSettings[T any] struct { Sizer Sizer[T] Capacity int64 - DataType component.DataType + DataType component.Signal StorageID component.ID Marshaler func(req T) ([]byte, error) Unmarshaler func([]byte) (T, error) @@ -485,7 +485,7 @@ func (pq *persistentQueue[T]) itemDispatchingFinish(ctx context.Context, index u return nil } -func toStorageClient(ctx context.Context, storageID component.ID, host component.Host, ownerID component.ID, signal component.DataType) (storage.Client, error) { +func toStorageClient(ctx context.Context, storageID component.ID, host component.Host, ownerID component.ID, signal component.Signal) (storage.Client, error) { ext, found := host.GetExtensions()[storageID] if !found { return nil, errNoStorageClient diff --git a/exporter/internal/queue/persistent_queue_test.go b/exporter/internal/queue/persistent_queue_test.go index a6a7b8b974e..f0f9db0e03d 100644 --- a/exporter/internal/queue/persistent_queue_test.go +++ b/exporter/internal/queue/persistent_queue_test.go @@ -60,7 +60,7 @@ func createAndStartTestPersistentQueue(t *testing.T, sizer Sizer[tracesRequest], pq := NewPersistentQueue[tracesRequest](PersistentQueueSettings[tracesRequest]{ Sizer: sizer, Capacity: capacity, - DataType: component.DataTypeTraces, + DataType: component.SignalTraces, StorageID: component.ID{}, Marshaler: marshalTracesRequest, Unmarshaler: unmarshalTracesRequest, @@ -81,7 +81,7 @@ func createTestPersistentQueueWithClient(client storage.Client) *persistentQueue pq := NewPersistentQueue[tracesRequest](PersistentQueueSettings[tracesRequest]{ Sizer: &RequestSizer[tracesRequest]{}, Capacity: 1000, - DataType: component.DataTypeTraces, + DataType: component.SignalTraces, StorageID: component.ID{}, Marshaler: marshalTracesRequest, Unmarshaler: unmarshalTracesRequest, @@ -104,7 +104,7 @@ func createTestPersistentQueueWithCapacityLimiter(t testing.TB, ext storage.Exte pq := NewPersistentQueue[tracesRequest](PersistentQueueSettings[tracesRequest]{ Sizer: sizer, Capacity: capacity, - DataType: component.DataTypeTraces, + DataType: component.SignalTraces, StorageID: component.ID{}, Marshaler: marshalTracesRequest, Unmarshaler: unmarshalTracesRequest, @@ -305,7 +305,7 @@ func TestToStorageClient(t *testing.T) { ownerID := component.MustNewID("foo_exporter") // execute - client, err := toStorageClient(context.Background(), storageID, host, ownerID, component.DataTypeTraces) + client, err := toStorageClient(context.Background(), storageID, host, ownerID, component.SignalTraces) // verify if tC.expectedError != nil { @@ -335,7 +335,7 @@ func TestInvalidStorageExtensionType(t *testing.T) { ownerID := component.MustNewID("foo_exporter") // execute - client, err := toStorageClient(context.Background(), storageID, host, ownerID, component.DataTypeTraces) + client, err := toStorageClient(context.Background(), storageID, host, ownerID, component.SignalTraces) // we should get an error about the extension type assert.ErrorIs(t, err, errWrongExtensionType) diff --git a/internal/e2e/consume_contract_test.go b/internal/e2e/consume_contract_test.go index efda43101f3..33ee6c2c139 100644 --- a/internal/e2e/consume_contract_test.go +++ b/internal/e2e/consume_contract_test.go @@ -48,7 +48,7 @@ func TestConsumeContractOtlpLogs(t *testing.T) { T: t, NumberOfTestElements: 10, ExporterFactory: otlpexporter.NewFactory(), - DataType: component.DataTypeLogs, + DataType: component.SignalLogs, ExporterConfig: testExporterConfig(addr), ReceiverFactory: otlpreceiver.NewFactory(), ReceiverConfig: testReceiverConfig(addr), @@ -60,7 +60,7 @@ func TestConsumeContractOtlpTraces(t *testing.T) { exportertest.CheckConsumeContract(exportertest.CheckConsumeContractParams{ T: t, NumberOfTestElements: 10, - DataType: component.DataTypeTraces, + DataType: component.SignalTraces, ExporterFactory: otlpexporter.NewFactory(), ExporterConfig: testExporterConfig(addr), ReceiverFactory: otlpreceiver.NewFactory(), @@ -74,7 +74,7 @@ func TestConsumeContractOtlpMetrics(t *testing.T) { T: t, NumberOfTestElements: 10, ExporterFactory: otlpexporter.NewFactory(), - DataType: component.DataTypeMetrics, + DataType: component.SignalMetrics, ExporterConfig: testExporterConfig(addr), ReceiverFactory: otlpreceiver.NewFactory(), ReceiverConfig: testReceiverConfig(addr), diff --git a/internal/e2e/status_test.go b/internal/e2e/status_test.go index 67ac0721b13..2521f19407a 100644 --- a/internal/e2e/status_test.go +++ b/internal/e2e/status_test.go @@ -99,11 +99,11 @@ func Test_ComponentStatusReporting_SharedInstance(t *testing.T) { }, }, Pipelines: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.NewID(component.MustNewType("test"))}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.NewID(component.MustNewType("test"))}, Exporters: []component.ID{component.NewID(nopType)}, }, @@ -125,7 +125,7 @@ func Test_ComponentStatusReporting_SharedInstance(t *testing.T) { for instanceID, events := range eventsReceived { pipelineIDs := "" - instanceID.AllPipelineIDs(func(id component.ID) bool { + instanceID.AllPipelineIDs(func(id component.PipelineID) bool { pipelineIDs += id.String() + "," return true }) diff --git a/otelcol/config.go b/otelcol/config.go index e622617721b..33975957282 100644 --- a/otelcol/config.go +++ b/otelcol/config.go @@ -130,14 +130,14 @@ func (cfg *Config) Validate() error { if _, ok := cfg.Connectors[ref]; ok { continue } - return fmt.Errorf("service::pipelines::%s: references receiver %q which is not configured", pipelineID, ref) + return fmt.Errorf("service::pipelines::%s: references receiver %q which is not configured", pipelineID.String(), ref) } // Validate pipeline processor name references. for _, ref := range pipeline.Processors { // Check that the name referenced in the pipeline's processors exists in the top-level processors. if cfg.Processors[ref] == nil { - return fmt.Errorf("service::pipelines::%s: references processor %q which is not configured", pipelineID, ref) + return fmt.Errorf("service::pipelines::%s: references processor %q which is not configured", pipelineID.String(), ref) } } @@ -150,7 +150,7 @@ func (cfg *Config) Validate() error { if _, ok := cfg.Connectors[ref]; ok { continue } - return fmt.Errorf("service::pipelines::%s: references exporter %q which is not configured", pipelineID, ref) + return fmt.Errorf("service::pipelines::%s: references exporter %q which is not configured", pipelineID.String(), ref) } } return nil diff --git a/otelcol/config_test.go b/otelcol/config_test.go index c1677c07220..fe27d0eb8d6 100644 --- a/otelcol/config_test.go +++ b/otelcol/config_test.go @@ -98,7 +98,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-receiver-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.Pipelines[component.NewPipelineID("traces")] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -108,7 +108,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-processor-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.Pipelines[component.NewPipelineID("traces")] pipe.Processors = append(pipe.Processors, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -118,7 +118,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-exporter-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.Pipelines[component.NewPipelineID("traces")] pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -185,7 +185,7 @@ func TestConfigValidate(t *testing.T) { cfg := generateConfig() cfg.Receivers[component.MustNewID("nop2")] = &errConfig{} cfg.Connectors[component.MustNewID("nop2")] = &errConfig{} - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.Pipelines[component.NewPipelineID("traces")] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg @@ -198,7 +198,7 @@ func TestConfigValidate(t *testing.T) { cfg := generateConfig() cfg.Exporters[component.MustNewID("nop2")] = &errConfig{} cfg.Connectors[component.MustNewID("nop2")] = &errConfig{} - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.Pipelines[component.NewPipelineID("traces")] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg @@ -209,7 +209,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-connector-reference-as-receiver", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.Pipelines[component.NewPipelineID("traces")] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "conn2")) return cfg }, @@ -219,7 +219,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-connector-reference-as-receiver", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Service.Pipelines[component.MustNewID("traces")] + pipe := cfg.Service.Pipelines[component.NewPipelineID("traces")] pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "conn2")) return cfg }, @@ -280,7 +280,7 @@ func generateConfig() *Config { }, Extensions: []component.ID{component.MustNewID("nop")}, Pipelines: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, diff --git a/otelcol/factories_test.go b/otelcol/factories_test.go index 19d6fe6accc..2ba684c67ce 100644 --- a/otelcol/factories_test.go +++ b/otelcol/factories_test.go @@ -37,7 +37,7 @@ func nopFactories() (Factories, error) { factories.ExtensionModules[ext.Type()] = "go.opentelemetry.io/collector/extension/extensiontest v1.2.3" } - if factories.Receivers, err = receiver.MakeFactoryMap(receivertest.NewNopFactory(), receivertest.NewNopFactoryForType(component.DataTypeLogs)); err != nil { + if factories.Receivers, err = receiver.MakeFactoryMap(receivertest.NewNopFactory(), receivertest.NewNopFactoryForType(component.SignalLogs)); err != nil { return Factories{}, err } factories.ReceiverModules = make(map[component.Type]string, len(factories.Receivers)) diff --git a/otelcol/otelcoltest/config_test.go b/otelcol/otelcoltest/config_test.go index 71502de536e..144d3ce96c6 100644 --- a/otelcol/otelcoltest/config_test.go +++ b/otelcol/otelcoltest/config_test.go @@ -55,7 +55,7 @@ func TestLoadConfig(t *testing.T) { Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - cfg.Service.Pipelines[component.MustNewID("traces")], + cfg.Service.Pipelines[component.NewPipelineID("traces")], "Did not load pipeline config correctly") } diff --git a/processor/processorhelper/obsreport.go b/processor/processorhelper/obsreport.go index c69f601cf3d..118e0b41fe3 100644 --- a/processor/processorhelper/obsreport.go +++ b/processor/processorhelper/obsreport.go @@ -60,16 +60,16 @@ func newObsReport(cfg ObsReportSettings) (*ObsReport, error) { }, nil } -func (or *ObsReport) recordInOut(ctx context.Context, dataType component.DataType, incoming, outgoing int) { +func (or *ObsReport) recordInOut(ctx context.Context, dataType component.Signal, incoming, outgoing int) { var incomingCount, outgoingCount metric.Int64Counter switch dataType { - case component.DataTypeTraces: + case component.SignalTraces: incomingCount = or.telemetryBuilder.ProcessorIncomingSpans outgoingCount = or.telemetryBuilder.ProcessorOutgoingSpans - case component.DataTypeMetrics: + case component.SignalMetrics: incomingCount = or.telemetryBuilder.ProcessorIncomingMetricPoints outgoingCount = or.telemetryBuilder.ProcessorOutgoingMetricPoints - case component.DataTypeLogs: + case component.SignalLogs: incomingCount = or.telemetryBuilder.ProcessorIncomingLogRecords outgoingCount = or.telemetryBuilder.ProcessorOutgoingLogRecords } @@ -78,20 +78,20 @@ func (or *ObsReport) recordInOut(ctx context.Context, dataType component.DataTyp outgoingCount.Add(ctx, int64(outgoing), metric.WithAttributes(or.otelAttrs...)) } -func (or *ObsReport) recordData(ctx context.Context, dataType component.DataType, accepted, refused, dropped, inserted int64) { +func (or *ObsReport) recordData(ctx context.Context, dataType component.Signal, accepted, refused, dropped, inserted int64) { var acceptedCount, refusedCount, droppedCount, insertedCount metric.Int64Counter switch dataType { - case component.DataTypeTraces: + case component.SignalTraces: acceptedCount = or.telemetryBuilder.ProcessorAcceptedSpans refusedCount = or.telemetryBuilder.ProcessorRefusedSpans droppedCount = or.telemetryBuilder.ProcessorDroppedSpans insertedCount = or.telemetryBuilder.ProcessorInsertedSpans - case component.DataTypeMetrics: + case component.SignalMetrics: acceptedCount = or.telemetryBuilder.ProcessorAcceptedMetricPoints refusedCount = or.telemetryBuilder.ProcessorRefusedMetricPoints droppedCount = or.telemetryBuilder.ProcessorDroppedMetricPoints insertedCount = or.telemetryBuilder.ProcessorInsertedMetricPoints - case component.DataTypeLogs: + case component.SignalLogs: acceptedCount = or.telemetryBuilder.ProcessorAcceptedLogRecords refusedCount = or.telemetryBuilder.ProcessorRefusedLogRecords droppedCount = or.telemetryBuilder.ProcessorDroppedLogRecords @@ -106,60 +106,60 @@ func (or *ObsReport) recordData(ctx context.Context, dataType component.DataType // TracesAccepted reports that the trace data was accepted. func (or *ObsReport) TracesAccepted(ctx context.Context, numSpans int) { - or.recordData(ctx, component.DataTypeTraces, int64(numSpans), int64(0), int64(0), int64(0)) + or.recordData(ctx, component.SignalTraces, int64(numSpans), int64(0), int64(0), int64(0)) } // TracesRefused reports that the trace data was refused. func (or *ObsReport) TracesRefused(ctx context.Context, numSpans int) { - or.recordData(ctx, component.DataTypeTraces, int64(0), int64(numSpans), int64(0), int64(0)) + or.recordData(ctx, component.SignalTraces, int64(0), int64(numSpans), int64(0), int64(0)) } // TracesDropped reports that the trace data was dropped. func (or *ObsReport) TracesDropped(ctx context.Context, numSpans int) { - or.recordData(ctx, component.DataTypeTraces, int64(0), int64(0), int64(numSpans), int64(0)) + or.recordData(ctx, component.SignalTraces, int64(0), int64(0), int64(numSpans), int64(0)) } // TracesInserted reports that the trace data was inserted. func (or *ObsReport) TracesInserted(ctx context.Context, numSpans int) { - or.recordData(ctx, component.DataTypeTraces, int64(0), int64(0), int64(0), int64(numSpans)) + or.recordData(ctx, component.SignalTraces, int64(0), int64(0), int64(0), int64(numSpans)) } // MetricsAccepted reports that the metrics were accepted. func (or *ObsReport) MetricsAccepted(ctx context.Context, numPoints int) { - or.recordData(ctx, component.DataTypeMetrics, int64(numPoints), int64(0), int64(0), int64(0)) + or.recordData(ctx, component.SignalMetrics, int64(numPoints), int64(0), int64(0), int64(0)) } // MetricsRefused reports that the metrics were refused. func (or *ObsReport) MetricsRefused(ctx context.Context, numPoints int) { - or.recordData(ctx, component.DataTypeMetrics, int64(0), int64(numPoints), int64(0), int64(0)) + or.recordData(ctx, component.SignalMetrics, int64(0), int64(numPoints), int64(0), int64(0)) } // MetricsDropped reports that the metrics were dropped. func (or *ObsReport) MetricsDropped(ctx context.Context, numPoints int) { - or.recordData(ctx, component.DataTypeMetrics, int64(0), int64(0), int64(numPoints), int64(0)) + or.recordData(ctx, component.SignalMetrics, int64(0), int64(0), int64(numPoints), int64(0)) } // MetricsInserted reports that the metrics were inserted. func (or *ObsReport) MetricsInserted(ctx context.Context, numPoints int) { - or.recordData(ctx, component.DataTypeMetrics, int64(0), int64(0), int64(0), int64(numPoints)) + or.recordData(ctx, component.SignalMetrics, int64(0), int64(0), int64(0), int64(numPoints)) } // LogsAccepted reports that the logs were accepted. func (or *ObsReport) LogsAccepted(ctx context.Context, numRecords int) { - or.recordData(ctx, component.DataTypeLogs, int64(numRecords), int64(0), int64(0), int64(0)) + or.recordData(ctx, component.SignalLogs, int64(numRecords), int64(0), int64(0), int64(0)) } // LogsRefused reports that the logs were refused. func (or *ObsReport) LogsRefused(ctx context.Context, numRecords int) { - or.recordData(ctx, component.DataTypeLogs, int64(0), int64(numRecords), int64(0), int64(0)) + or.recordData(ctx, component.SignalLogs, int64(0), int64(numRecords), int64(0), int64(0)) } // LogsDropped reports that the logs were dropped. func (or *ObsReport) LogsDropped(ctx context.Context, numRecords int) { - or.recordData(ctx, component.DataTypeLogs, int64(0), int64(0), int64(numRecords), int64(0)) + or.recordData(ctx, component.SignalLogs, int64(0), int64(0), int64(numRecords), int64(0)) } // LogsInserted reports that the logs were inserted. func (or *ObsReport) LogsInserted(ctx context.Context, numRecords int) { - or.recordData(ctx, component.DataTypeLogs, int64(0), int64(0), int64(0), int64(numRecords)) + or.recordData(ctx, component.SignalLogs, int64(0), int64(0), int64(0), int64(numRecords)) } diff --git a/receiver/receiverhelper/obsreport.go b/receiver/receiverhelper/obsreport.go index b998a315062..39a5d92f584 100644 --- a/receiver/receiverhelper/obsreport.go +++ b/receiver/receiverhelper/obsreport.go @@ -82,7 +82,7 @@ func (rec *ObsReport) EndTracesOp( numReceivedSpans int, err error, ) { - rec.endOp(receiverCtx, format, numReceivedSpans, err, component.DataTypeTraces) + rec.endOp(receiverCtx, format, numReceivedSpans, err, component.SignalTraces) } // StartLogsOp is called when a request is received from a client. @@ -100,7 +100,7 @@ func (rec *ObsReport) EndLogsOp( numReceivedLogRecords int, err error, ) { - rec.endOp(receiverCtx, format, numReceivedLogRecords, err, component.DataTypeLogs) + rec.endOp(receiverCtx, format, numReceivedLogRecords, err, component.SignalLogs) } // StartMetricsOp is called when a request is received from a client. @@ -118,7 +118,7 @@ func (rec *ObsReport) EndMetricsOp( numReceivedPoints int, err error, ) { - rec.endOp(receiverCtx, format, numReceivedPoints, err, component.DataTypeMetrics) + rec.endOp(receiverCtx, format, numReceivedPoints, err, component.SignalMetrics) } // startOp creates the span used to trace the operation. Returning @@ -152,7 +152,7 @@ func (rec *ObsReport) endOp( format string, numReceivedItems int, err error, - dataType component.DataType, + dataType component.Signal, ) { numAccepted := numReceivedItems numRefused := 0 @@ -169,13 +169,13 @@ func (rec *ObsReport) endOp( if span.IsRecording() { var acceptedItemsKey, refusedItemsKey string switch dataType { - case component.DataTypeTraces: + case component.SignalTraces: acceptedItemsKey = obsmetrics.AcceptedSpansKey refusedItemsKey = obsmetrics.RefusedSpansKey - case component.DataTypeMetrics: + case component.SignalMetrics: acceptedItemsKey = obsmetrics.AcceptedMetricPointsKey refusedItemsKey = obsmetrics.RefusedMetricPointsKey - case component.DataTypeLogs: + case component.SignalLogs: acceptedItemsKey = obsmetrics.AcceptedLogRecordsKey refusedItemsKey = obsmetrics.RefusedLogRecordsKey } @@ -192,16 +192,16 @@ func (rec *ObsReport) endOp( span.End() } -func (rec *ObsReport) recordMetrics(receiverCtx context.Context, dataType component.DataType, numAccepted, numRefused int) { +func (rec *ObsReport) recordMetrics(receiverCtx context.Context, dataType component.Signal, numAccepted, numRefused int) { var acceptedMeasure, refusedMeasure metric.Int64Counter switch dataType { - case component.DataTypeTraces: + case component.SignalTraces: acceptedMeasure = rec.telemetryBuilder.ReceiverAcceptedSpans refusedMeasure = rec.telemetryBuilder.ReceiverRefusedSpans - case component.DataTypeMetrics: + case component.SignalMetrics: acceptedMeasure = rec.telemetryBuilder.ReceiverAcceptedMetricPoints refusedMeasure = rec.telemetryBuilder.ReceiverRefusedMetricPoints - case component.DataTypeLogs: + case component.SignalLogs: acceptedMeasure = rec.telemetryBuilder.ReceiverAcceptedLogRecords refusedMeasure = rec.telemetryBuilder.ReceiverRefusedLogRecords } diff --git a/receiver/receivertest/contract_checker.go b/receiver/receivertest/contract_checker.go index 32e5681bfdc..bfe0bf56fa5 100644 --- a/receiver/receivertest/contract_checker.go +++ b/receiver/receivertest/contract_checker.go @@ -55,7 +55,7 @@ type CheckConsumeContractParams struct { // Factory that allows to create a receiver. Factory receiver.Factory // DataType to test for. - DataType component.DataType + DataType component.Signal // Config of the receiver to use. Config component.Config // Generator that can send data to the receiver. @@ -112,11 +112,11 @@ func checkConsumeContractScenario(params CheckConsumeContractParams, decisionFun var receiver component.Component var err error switch params.DataType { - case component.DataTypeLogs: + case component.SignalLogs: receiver, err = params.Factory.CreateLogsReceiver(ctx, NewNopSettings(), params.Config, consumer) - case component.DataTypeTraces: + case component.SignalTraces: receiver, err = params.Factory.CreateTracesReceiver(ctx, NewNopSettings(), params.Config, consumer) - case component.DataTypeMetrics: + case component.SignalMetrics: receiver, err = params.Factory.CreateMetricsReceiver(ctx, NewNopSettings(), params.Config, consumer) default: require.FailNow(params.T, "must specify a valid DataType to test for") diff --git a/receiver/receivertest/contract_checker_test.go b/receiver/receivertest/contract_checker_test.go index 9a646dde06f..aba74d8e44b 100644 --- a/receiver/receivertest/contract_checker_test.go +++ b/receiver/receivertest/contract_checker_test.go @@ -239,7 +239,7 @@ func TestConsumeContract(t *testing.T) { params := CheckConsumeContractParams{ T: t, Factory: newExampleFactory(), - DataType: component.DataTypeLogs, + DataType: component.SignalLogs, Config: cfg, Generator: generator, GenerateCount: logsPerTest, @@ -262,7 +262,7 @@ func TestConsumeMetricsContract(t *testing.T) { params := CheckConsumeContractParams{ T: t, Factory: newExampleFactory(), - DataType: component.DataTypeMetrics, + DataType: component.SignalMetrics, Config: cfg, Generator: generator, GenerateCount: metricsPerTest, @@ -285,7 +285,7 @@ func TestConsumeTracesContract(t *testing.T) { params := CheckConsumeContractParams{ T: t, Factory: newExampleFactory(), - DataType: component.DataTypeTraces, + DataType: component.SignalTraces, Config: cfg, Generator: generator, GenerateCount: spansPerTest, diff --git a/receiver/receivertest/nop_receiver.go b/receiver/receivertest/nop_receiver.go index 2e7e8e7210b..18bbee63c3a 100644 --- a/receiver/receivertest/nop_receiver.go +++ b/receiver/receivertest/nop_receiver.go @@ -41,14 +41,14 @@ func NewNopFactory() receiver.Factory { // NewNopFactoryForType returns a receiver.Factory that constructs nop receivers supporting only the // given data type. -func NewNopFactoryForType(dataType component.DataType) receiver.Factory { +func NewNopFactoryForType(dataType component.Signal) receiver.Factory { var factoryOpt receiver.FactoryOption switch dataType { - case component.DataTypeTraces: + case component.SignalTraces: factoryOpt = receiver.WithTraces(createTraces, component.StabilityLevelStable) - case component.DataTypeMetrics: + case component.SignalMetrics: factoryOpt = receiver.WithMetrics(createMetrics, component.StabilityLevelStable) - case component.DataTypeLogs: + case component.SignalLogs: factoryOpt = receiver.WithLogs(createLogs, component.StabilityLevelStable) default: panic("unsupported data type for creating nop receiver factory: " + dataType.String()) diff --git a/receiver/scraperhelper/obsreport.go b/receiver/scraperhelper/obsreport.go index 271551c80db..e8fcf3db512 100644 --- a/receiver/scraperhelper/obsreport.go +++ b/receiver/scraperhelper/obsreport.go @@ -99,7 +99,7 @@ func (s *ObsReport) EndMetricsOp( // end span according to errors if span.IsRecording() { span.SetAttributes( - attribute.String(obsmetrics.FormatKey, component.DataTypeMetrics.String()), + attribute.String(obsmetrics.FormatKey, string(component.SignalMetrics)), attribute.Int64(obsmetrics.ScrapedMetricPointsKey, int64(numScrapedMetrics)), attribute.Int64(obsmetrics.ErroredMetricPointsKey, int64(numErroredMetrics)), ) diff --git a/service/config_test.go b/service/config_test.go index 6ac9d6e625a..f4b37fecce3 100644 --- a/service/config_test.go +++ b/service/config_test.go @@ -42,7 +42,7 @@ func TestConfigValidate(t *testing.T) { name: "duplicate-processor-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Pipelines[component.MustNewID("traces")] + pipe := cfg.Pipelines[component.NewPipelineID(component.SignalTraces)] pipe.Processors = append(pipe.Processors, pipe.Processors...) return cfg }, @@ -52,7 +52,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-service-pipeline-type", cfgFn: func() *Config { cfg := generateConfig() - cfg.Pipelines[component.MustNewID("wrongtype")] = &pipelines.PipelineConfig{ + cfg.Pipelines[component.NewPipelineID("wrongtype")] = &pipelines.PipelineConfig{ Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -101,7 +101,7 @@ func generateConfig() *Config { }, Extensions: extensions.Config{component.MustNewID("nop")}, Pipelines: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID(component.SignalTraces): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, diff --git a/service/internal/builders/connector_test.go b/service/internal/builders/connector_test.go index 081ad3fe07e..b1edde0eaf0 100644 --- a/service/internal/builders/connector_test.go +++ b/service/internal/builders/connector_test.go @@ -52,7 +52,7 @@ func TestConnectorBuilder(t *testing.T) { testCases := []struct { name string id component.ID - err func(component.DataType, component.DataType) string + err func(component.Signal, component.Signal) string nextTraces consumer.Traces nextLogs consumer.Logs nextMetrics consumer.Metrics @@ -61,7 +61,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "unknown", id: component.MustNewID("unknown"), - err: func(component.DataType, component.DataType) string { + err: func(component.Signal, component.Signal) string { return "connector factory not available for: \"unknown\"" }, nextTraces: consumertest.NewNop(), @@ -72,7 +72,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "err", id: component.MustNewID("err"), - err: func(expType, rcvType component.DataType) string { + err: func(expType, rcvType component.Signal) string { return fmt.Sprintf("connector \"err\" cannot connect from %s to %s: telemetry type is not supported", expType, rcvType) }, nextTraces: consumertest.NewNop(), @@ -83,7 +83,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "all", id: component.MustNewID("all"), - err: func(component.DataType, component.DataType) string { + err: func(component.Signal, component.Signal) string { return "" }, nextTraces: consumertest.NewNop(), @@ -94,7 +94,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "all/named", id: component.MustNewIDWithName("all", "named"), - err: func(component.DataType, component.DataType) string { + err: func(component.Signal, component.Signal) string { return "" }, nextTraces: consumertest.NewNop(), @@ -105,7 +105,7 @@ func TestConnectorBuilder(t *testing.T) { { name: "no next consumer", id: component.MustNewID("unknown"), - err: func(_, _ component.DataType) string { + err: func(_, _ component.Signal) string { return "nil next Consumer" }, nextTraces: nil, @@ -121,7 +121,7 @@ func TestConnectorBuilder(t *testing.T) { b := NewConnector(cfgs, factories) t2t, err := b.CreateTracesToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) - if expectedErr := tt.err(component.DataTypeTraces, component.DataTypeTraces); expectedErr != "" { + if expectedErr := tt.err(component.SignalTraces, component.SignalTraces); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, t2t) } else { @@ -129,7 +129,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, t2t) } t2m, err := b.CreateTracesToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) - if expectedErr := tt.err(component.DataTypeTraces, component.DataTypeMetrics); expectedErr != "" { + if expectedErr := tt.err(component.SignalTraces, component.SignalMetrics); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, t2m) } else { @@ -137,7 +137,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, t2m) } t2l, err := b.CreateTracesToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) - if expectedErr := tt.err(component.DataTypeTraces, component.DataTypeLogs); expectedErr != "" { + if expectedErr := tt.err(component.SignalTraces, component.SignalLogs); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, t2l) } else { @@ -145,7 +145,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, t2l) } t2p, err := b.CreateTracesToProfiles(context.Background(), createConnectorSettings(tt.id), tt.nextProfiles) - if expectedErr := tt.err(component.DataTypeTraces, componentprofiles.DataTypeProfiles); expectedErr != "" { + if expectedErr := tt.err(component.SignalTraces, componentprofiles.SignalProfiles); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, t2p) } else { @@ -154,7 +154,7 @@ func TestConnectorBuilder(t *testing.T) { } m2t, err := b.CreateMetricsToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) - if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeTraces); expectedErr != "" { + if expectedErr := tt.err(component.SignalMetrics, component.SignalTraces); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, m2t) } else { @@ -163,7 +163,7 @@ func TestConnectorBuilder(t *testing.T) { } m2m, err := b.CreateMetricsToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) - if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeMetrics); expectedErr != "" { + if expectedErr := tt.err(component.SignalMetrics, component.SignalMetrics); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, m2m) } else { @@ -172,7 +172,7 @@ func TestConnectorBuilder(t *testing.T) { } m2l, err := b.CreateMetricsToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) - if expectedErr := tt.err(component.DataTypeMetrics, component.DataTypeLogs); expectedErr != "" { + if expectedErr := tt.err(component.SignalMetrics, component.SignalLogs); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, m2l) } else { @@ -180,7 +180,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, m2l) } m2p, err := b.CreateMetricsToProfiles(context.Background(), createConnectorSettings(tt.id), tt.nextProfiles) - if expectedErr := tt.err(component.DataTypeMetrics, componentprofiles.DataTypeProfiles); expectedErr != "" { + if expectedErr := tt.err(component.SignalMetrics, componentprofiles.SignalProfiles); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, m2p) } else { @@ -189,7 +189,7 @@ func TestConnectorBuilder(t *testing.T) { } l2t, err := b.CreateLogsToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) - if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeTraces); expectedErr != "" { + if expectedErr := tt.err(component.SignalLogs, component.SignalTraces); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, l2t) } else { @@ -198,7 +198,7 @@ func TestConnectorBuilder(t *testing.T) { } l2m, err := b.CreateLogsToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) - if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeMetrics); expectedErr != "" { + if expectedErr := tt.err(component.SignalLogs, component.SignalMetrics); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, l2m) } else { @@ -207,7 +207,7 @@ func TestConnectorBuilder(t *testing.T) { } l2l, err := b.CreateLogsToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) - if expectedErr := tt.err(component.DataTypeLogs, component.DataTypeLogs); expectedErr != "" { + if expectedErr := tt.err(component.SignalLogs, component.SignalLogs); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, l2l) } else { @@ -215,7 +215,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, l2l) } l2p, err := b.CreateLogsToProfiles(context.Background(), createConnectorSettings(tt.id), tt.nextProfiles) - if expectedErr := tt.err(component.DataTypeLogs, componentprofiles.DataTypeProfiles); expectedErr != "" { + if expectedErr := tt.err(component.SignalLogs, componentprofiles.SignalProfiles); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, l2p) } else { @@ -224,7 +224,7 @@ func TestConnectorBuilder(t *testing.T) { } p2t, err := b.CreateProfilesToTraces(context.Background(), createConnectorSettings(tt.id), tt.nextTraces) - if expectedErr := tt.err(componentprofiles.DataTypeProfiles, component.DataTypeTraces); expectedErr != "" { + if expectedErr := tt.err(componentprofiles.SignalProfiles, component.SignalTraces); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, p2t) } else { @@ -232,7 +232,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, p2t) } p2m, err := b.CreateProfilesToMetrics(context.Background(), createConnectorSettings(tt.id), tt.nextMetrics) - if expectedErr := tt.err(componentprofiles.DataTypeProfiles, component.DataTypeMetrics); expectedErr != "" { + if expectedErr := tt.err(componentprofiles.SignalProfiles, component.SignalMetrics); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, p2m) } else { @@ -240,7 +240,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, p2m) } p2l, err := b.CreateProfilesToLogs(context.Background(), createConnectorSettings(tt.id), tt.nextLogs) - if expectedErr := tt.err(componentprofiles.DataTypeProfiles, component.DataTypeLogs); expectedErr != "" { + if expectedErr := tt.err(componentprofiles.SignalProfiles, component.SignalLogs); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, p2l) } else { @@ -248,7 +248,7 @@ func TestConnectorBuilder(t *testing.T) { assert.Equal(t, nopConnectorInstance, p2l) } p2p, err := b.CreateProfilesToProfiles(context.Background(), createConnectorSettings(tt.id), tt.nextProfiles) - if expectedErr := tt.err(componentprofiles.DataTypeProfiles, componentprofiles.DataTypeProfiles); expectedErr != "" { + if expectedErr := tt.err(componentprofiles.SignalProfiles, componentprofiles.SignalProfiles); expectedErr != "" { assert.EqualError(t, err, expectedErr) assert.Nil(t, p2p) } else { diff --git a/service/internal/components/loggers.go b/service/internal/components/loggers.go index f4178977b2d..b6895a6c8fa 100644 --- a/service/internal/components/loggers.go +++ b/service/internal/components/loggers.go @@ -21,21 +21,21 @@ const ( zapReceiverInPipeline = "receiver_in_pipeline" ) -func ReceiverLogger(logger *zap.Logger, id component.ID, dt component.DataType) *zap.Logger { +func ReceiverLogger(logger *zap.Logger, id component.ID, dt component.Signal) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindReceiver.String())), zap.String(zapNameKey, id.String()), zap.String(zapDataTypeKey, dt.String())) } -func ProcessorLogger(logger *zap.Logger, id component.ID, pipelineID component.ID) *zap.Logger { +func ProcessorLogger(logger *zap.Logger, id component.ID, pipelineID component.PipelineID) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindProcessor.String())), zap.String(zapNameKey, id.String()), zap.String(zapPipelineKey, pipelineID.String())) } -func ExporterLogger(logger *zap.Logger, id component.ID, dt component.DataType) *zap.Logger { +func ExporterLogger(logger *zap.Logger, id component.ID, dt component.Signal) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindExporter.String())), zap.String(zapDataTypeKey, dt.String()), @@ -48,7 +48,7 @@ func ExtensionLogger(logger *zap.Logger, id component.ID) *zap.Logger { zap.String(zapNameKey, id.String())) } -func ConnectorLogger(logger *zap.Logger, id component.ID, expDT, rcvDT component.DataType) *zap.Logger { +func ConnectorLogger(logger *zap.Logger, id component.ID, expDT, rcvDT component.Signal) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindConnector.String())), zap.String(zapNameKey, id.String()), diff --git a/service/internal/graph/graph.go b/service/internal/graph/graph.go index 3adc1c568a2..4a847e68318 100644 --- a/service/internal/graph/graph.go +++ b/service/internal/graph/graph.go @@ -58,7 +58,7 @@ type Graph struct { componentGraph *simple.DirectedGraph // Keep track of how nodes relate to pipelines, so we can declare edges in the graph. - pipelines map[component.ID]*pipelineNodes + pipelines map[component.PipelineID]*pipelineNodes // Keep track of status source per node instanceIDs map[int64]*componentstatus.InstanceID @@ -71,7 +71,7 @@ type Graph struct { func Build(ctx context.Context, set Settings) (*Graph, error) { pipelines := &Graph{ componentGraph: simple.NewDirectedGraph(), - pipelines: make(map[component.ID]*pipelineNodes, len(set.PipelineConfigs)), + pipelines: make(map[component.PipelineID]*pipelineNodes, len(set.PipelineConfigs)), instanceIDs: make(map[int64]*componentstatus.InstanceID), telemetry: set.Telemetry, } @@ -95,8 +95,8 @@ func (g *Graph) createNodes(set Settings) error { connectors := make(map[component.ID]struct{}) // Keep track of connectors and where they are used. (map[connectorID][]pipelineID). - connectorsAsExporter := make(map[component.ID][]component.ID) - connectorsAsReceiver := make(map[component.ID][]component.ID) + connectorsAsExporter := make(map[component.ID][]component.PipelineID) + connectorsAsReceiver := make(map[component.ID][]component.PipelineID) // Build each pipelineNodes struct for each pipeline by parsing the pipelineCfg. // Also populates the connectors, connectorsAsExporter and connectorsAsReceiver maps. @@ -140,19 +140,19 @@ func (g *Graph) createNodes(set Settings) error { } connFactory := factory.(connector.Factory) - expTypes := make(map[component.DataType]bool) + expTypes := make(map[component.Signal]bool) for _, pipelineID := range connectorsAsExporter[connID] { // The presence of each key indicates how the connector is used as an exporter. // The value is initially set to false. Later we will set the value to true *if* we // confirm that there is a supported corresponding use as a receiver. - expTypes[pipelineID.Type()] = false + expTypes[pipelineID.Signal()] = false } - recTypes := make(map[component.DataType]bool) + recTypes := make(map[component.Signal]bool) for _, pipelineID := range connectorsAsReceiver[connID] { // The presence of each key indicates how the connector is used as a receiver. // The value is initially set to false. Later we will set the value to true *if* we // confirm that there is a supported corresponding use as an exporter. - recTypes[pipelineID.Type()] = false + recTypes[pipelineID.Signal()] = false } for expType := range expTypes { @@ -180,7 +180,7 @@ func (g *Graph) createNodes(set Settings) error { for _, eID := range connectorsAsExporter[connID] { for _, rID := range connectorsAsReceiver[connID] { - if connectorStability(connFactory, eID.Type(), rID.Type()) == component.StabilityLevelUndefined { + if connectorStability(connFactory, eID.Signal(), rID.Signal()) == component.StabilityLevelUndefined { // Connector is not supported for this combination, but we know it is used correctly elsewhere continue } @@ -194,8 +194,8 @@ func (g *Graph) createNodes(set Settings) error { return nil } -func (g *Graph) createReceiver(pipelineID, recvID component.ID) *receiverNode { - rcvrNode := newReceiverNode(pipelineID.Type(), recvID) +func (g *Graph) createReceiver(pipelineID component.PipelineID, recvID component.ID) *receiverNode { + rcvrNode := newReceiverNode(pipelineID.Signal(), recvID) if node := g.componentGraph.Node(rcvrNode.ID()); node != nil { instanceID := g.instanceIDs[node.ID()] g.instanceIDs[node.ID()] = instanceID.WithPipelines(pipelineID) @@ -208,7 +208,7 @@ func (g *Graph) createReceiver(pipelineID, recvID component.ID) *receiverNode { return rcvrNode } -func (g *Graph) createProcessor(pipelineID, procID component.ID) *processorNode { +func (g *Graph) createProcessor(pipelineID component.PipelineID, procID component.ID) *processorNode { procNode := newProcessorNode(pipelineID, procID) g.componentGraph.AddNode(procNode) g.instanceIDs[procNode.ID()] = componentstatus.NewInstanceID( @@ -217,8 +217,8 @@ func (g *Graph) createProcessor(pipelineID, procID component.ID) *processorNode return procNode } -func (g *Graph) createExporter(pipelineID, exprID component.ID) *exporterNode { - expNode := newExporterNode(pipelineID.Type(), exprID) +func (g *Graph) createExporter(pipelineID component.PipelineID, exprID component.ID) *exporterNode { + expNode := newExporterNode(pipelineID.Signal(), exprID) if node := g.componentGraph.Node(expNode.ID()); node != nil { instanceID := g.instanceIDs[expNode.ID()] g.instanceIDs[expNode.ID()] = instanceID.WithPipelines(pipelineID) @@ -231,8 +231,8 @@ func (g *Graph) createExporter(pipelineID, exprID component.ID) *exporterNode { return expNode } -func (g *Graph) createConnector(exprPipelineID, rcvrPipelineID, connID component.ID) *connectorNode { - connNode := newConnectorNode(exprPipelineID.Type(), rcvrPipelineID.Type(), connID) +func (g *Graph) createConnector(exprPipelineID component.PipelineID, rcvrPipelineID component.PipelineID, connID component.ID) *connectorNode { + connNode := newConnectorNode(exprPipelineID.Signal(), rcvrPipelineID.Signal(), connID) if node := g.componentGraph.Node(connNode.ID()); node != nil { instanceID := g.instanceIDs[connNode.ID()] g.instanceIDs[connNode.ID()] = instanceID.WithPipelines(exprPipelineID, rcvrPipelineID) @@ -303,46 +303,46 @@ func (g *Graph) buildComponents(ctx context.Context, set Settings) error { capability.MutatesData = capability.MutatesData || proc.getConsumer().Capabilities().MutatesData } next := g.nextConsumers(n.ID())[0] - switch n.pipelineID.Type() { - case component.DataTypeTraces: + switch n.pipelineID.Signal() { + case component.SignalTraces: cc := capabilityconsumer.NewTraces(next.(consumer.Traces), capability) n.baseConsumer = cc n.ConsumeTracesFunc = cc.ConsumeTraces - case component.DataTypeMetrics: + case component.SignalMetrics: cc := capabilityconsumer.NewMetrics(next.(consumer.Metrics), capability) n.baseConsumer = cc n.ConsumeMetricsFunc = cc.ConsumeMetrics - case component.DataTypeLogs: + case component.SignalLogs: cc := capabilityconsumer.NewLogs(next.(consumer.Logs), capability) n.baseConsumer = cc n.ConsumeLogsFunc = cc.ConsumeLogs - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: cc := capabilityconsumer.NewProfiles(next.(consumerprofiles.Profiles), capability) n.baseConsumer = cc n.ConsumeProfilesFunc = cc.ConsumeProfiles } case *fanOutNode: nexts := g.nextConsumers(n.ID()) - switch n.pipelineID.Type() { - case component.DataTypeTraces: + switch n.pipelineID.Signal() { + case component.SignalTraces: consumers := make([]consumer.Traces, 0, len(nexts)) for _, next := range nexts { consumers = append(consumers, next.(consumer.Traces)) } n.baseConsumer = fanoutconsumer.NewTraces(consumers) - case component.DataTypeMetrics: + case component.SignalMetrics: consumers := make([]consumer.Metrics, 0, len(nexts)) for _, next := range nexts { consumers = append(consumers, next.(consumer.Metrics)) } n.baseConsumer = fanoutconsumer.NewMetrics(consumers) - case component.DataTypeLogs: + case component.SignalLogs: consumers := make([]consumer.Logs, 0, len(nexts)) for _, next := range nexts { consumers = append(consumers, next.(consumer.Logs)) } n.baseConsumer = fanoutconsumer.NewLogs(consumers) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: consumers := make([]consumerprofiles.Profiles, 0, len(nexts)) for _, next := range nexts { consumers = append(consumers, next.(consumerprofiles.Profiles)) @@ -483,12 +483,12 @@ func (g *Graph) ShutdownAll(ctx context.Context, reporter status.Reporter) error // connector. See https://github.com/open-telemetry/opentelemetry-collector/issues/7370 and // https://github.com/open-telemetry/opentelemetry-collector/pull/7390#issuecomment-1483710184 // for additional information. -func (g *Graph) GetExporters() map[component.DataType]map[component.ID]component.Component { - exportersMap := make(map[component.DataType]map[component.ID]component.Component) - exportersMap[component.DataTypeTraces] = make(map[component.ID]component.Component) - exportersMap[component.DataTypeMetrics] = make(map[component.ID]component.Component) - exportersMap[component.DataTypeLogs] = make(map[component.ID]component.Component) - exportersMap[componentprofiles.DataTypeProfiles] = make(map[component.ID]component.Component) +func (g *Graph) GetExporters() map[component.Signal]map[component.ID]component.Component { + exportersMap := make(map[component.Signal]map[component.ID]component.Component) + exportersMap[component.SignalTraces] = make(map[component.ID]component.Component) + exportersMap[component.SignalMetrics] = make(map[component.ID]component.Component) + exportersMap[component.SignalLogs] = make(map[component.ID]component.Component) + exportersMap[componentprofiles.SignalProfiles] = make(map[component.ID]component.Component) for _, pg := range g.pipelines { for _, expNode := range pg.exporters { @@ -531,7 +531,7 @@ func cycleErr(err error, cycles [][]graph.Node) error { for _, node := range cycle { switch n := node.(type) { case *processorNode: - componentDetails = append(componentDetails, fmt.Sprintf("processor %q in pipeline %q", n.componentID, n.pipelineID)) + componentDetails = append(componentDetails, fmt.Sprintf("processor %q in pipeline %q", n.componentID, n.pipelineID.String())) case *connectorNode: componentDetails = append(componentDetails, fmt.Sprintf("connector %q (%s to %s)", n.componentID, n.exprPipelineType, n.rcvrPipelineType)) default: @@ -541,50 +541,50 @@ func cycleErr(err error, cycles [][]graph.Node) error { return fmt.Errorf("cycle detected: %s", strings.Join(componentDetails, " -> ")) } -func connectorStability(f connector.Factory, expType, recType component.Type) component.StabilityLevel { +func connectorStability(f connector.Factory, expType, recType component.Signal) component.StabilityLevel { switch expType { - case component.DataTypeTraces: + case component.SignalTraces: switch recType { - case component.DataTypeTraces: + case component.SignalTraces: return f.TracesToTracesStability() - case component.DataTypeMetrics: + case component.SignalMetrics: return f.TracesToMetricsStability() - case component.DataTypeLogs: + case component.SignalLogs: return f.TracesToLogsStability() - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: return f.TracesToProfilesStability() } - case component.DataTypeMetrics: + case component.SignalMetrics: switch recType { - case component.DataTypeTraces: + case component.SignalTraces: return f.MetricsToTracesStability() - case component.DataTypeMetrics: + case component.SignalMetrics: return f.MetricsToMetricsStability() - case component.DataTypeLogs: + case component.SignalLogs: return f.MetricsToLogsStability() - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: return f.MetricsToProfilesStability() } - case component.DataTypeLogs: + case component.SignalLogs: switch recType { - case component.DataTypeTraces: + case component.SignalTraces: return f.LogsToTracesStability() - case component.DataTypeMetrics: + case component.SignalMetrics: return f.LogsToMetricsStability() - case component.DataTypeLogs: + case component.SignalLogs: return f.LogsToLogsStability() - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: return f.LogsToProfilesStability() } - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: switch recType { - case component.DataTypeTraces: + case component.SignalTraces: return f.ProfilesToTracesStability() - case component.DataTypeMetrics: + case component.SignalMetrics: return f.ProfilesToMetricsStability() - case component.DataTypeLogs: + case component.SignalLogs: return f.ProfilesToLogsStability() - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: return f.ProfilesToProfilesStability() } } diff --git a/service/internal/graph/graph_test.go b/service/internal/graph/graph_test.go index 7e33b37fd31..3080228bcde 100644 --- a/service/internal/graph/graph_test.go +++ b/service/internal/graph/graph_test.go @@ -237,22 +237,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_simple.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -263,22 +263,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_simple_mutate.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -289,22 +289,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_simple_multi_proc.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -315,19 +315,19 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_simple_no_proc.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -337,22 +337,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_multi.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate"), component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate"), component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate"), component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate"), component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, @@ -363,19 +363,19 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_multi_no_proc.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, @@ -385,39 +385,39 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "multi_pipeline_receivers_and_exporters.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("traces", "1"): { + component.NewPipelineIDWithName("traces", "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "1"): { + component.NewPipelineIDWithName("metrics", "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "1"): { + component.NewPipelineIDWithName("logs", "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "1"): { + component.NewPipelineIDWithName("profiles", "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -427,12 +427,12 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_simple_traces.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -443,12 +443,12 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_simple_metrics.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -459,12 +459,12 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_simple_logs.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -475,12 +475,12 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_simple_profiles.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -491,22 +491,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_fork_merge_traces.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("traces", "type0"): { + component.NewPipelineIDWithName("traces", "type0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("traces", "type1"): { + component.NewPipelineIDWithName("traces", "type1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -517,22 +517,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_fork_merge_metrics.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("metrics", "type0"): { + component.NewPipelineIDWithName("metrics", "type0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("metrics", "type1"): { + component.NewPipelineIDWithName("metrics", "type1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -543,22 +543,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_fork_merge_logs.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("logs", "type0"): { + component.NewPipelineIDWithName("logs", "type0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("logs", "type1"): { + component.NewPipelineIDWithName("logs", "type1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -569,22 +569,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_fork_merge_profiles.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("profiles", "type0"): { + component.NewPipelineIDWithName("profiles", "type0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("profiles", "type1"): { + component.NewPipelineIDWithName("profiles", "type1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -595,22 +595,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_translate_from_traces.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -621,22 +621,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_translate_from_metrics.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -647,22 +647,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_translate_from_logs.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -673,22 +673,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_translate_from_profiles.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -699,42 +699,42 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_matrix_immutable.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -745,42 +745,42 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_matrix_mutable.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, // mutate propagates upstream to connector Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -791,35 +791,35 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_lanes.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -829,22 +829,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_mutate_traces.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("traces", "out0"): { + component.NewPipelineIDWithName("traces", "out0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("traces", "middle"): { + component.NewPipelineIDWithName("traces", "middle"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, }, - component.MustNewIDWithName("traces", "out1"): { + component.NewPipelineIDWithName("traces", "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -855,22 +855,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_mutate_metrics.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("metrics", "out0"): { + component.NewPipelineIDWithName("metrics", "out0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "middle"): { + component.NewPipelineIDWithName("metrics", "middle"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, }, - component.MustNewIDWithName("metrics", "out1"): { + component.NewPipelineIDWithName("metrics", "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -881,22 +881,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_mutate_logs.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("logs", "out0"): { + component.NewPipelineIDWithName("logs", "out0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "middle"): { + component.NewPipelineIDWithName("logs", "middle"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, }, - component.MustNewIDWithName("logs", "out1"): { + component.NewPipelineIDWithName("logs", "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -907,22 +907,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_mutate_profiles.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, }, - component.MustNewIDWithName("profiles", "out0"): { + component.NewPipelineIDWithName("profiles", "out0"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("profiles", "middle"): { + component.NewPipelineIDWithName("profiles", "middle"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "inherit_mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, }, - component.MustNewIDWithName("profiles", "out1"): { + component.NewPipelineIDWithName("profiles", "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -988,7 +988,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { assert.NoError(t, pg.StartAll(context.Background(), &Host{Reporter: status.NewReporter(func(*componentstatus.InstanceID, *componentstatus.Event) {}, func(error) {})})) - mutatingPipelines := make(map[component.ID]bool, len(test.pipelineConfigs)) + mutatingPipelines := make(map[component.PipelineID]bool, len(test.pipelineConfigs)) // Check each pipeline individually, ensuring that all components are started // and that they have observed no signals yet. @@ -1081,7 +1081,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { // find all the Pipelines of the same type where this connector is a receiver var inheritMutatesData bool for recPipelineID, recPipeline := range pg.pipelines { - if recPipelineID == expPipelineID || recPipelineID.Type() != expPipelineID.Type() { + if recPipelineID == expPipelineID || recPipelineID.Signal() != expPipelineID.Signal() { continue } for _, rec := range recPipeline.receivers { @@ -1101,19 +1101,19 @@ func TestConnectorPipelinesGraph(t *testing.T) { // shared between Pipelines. The `allReceivers` function also excludes Connectors, which we do // not want to directly inject with signals. allReceivers := pg.getReceivers() - for _, c := range allReceivers[component.DataTypeTraces] { + for _, c := range allReceivers[component.SignalTraces] { tracesReceiver := c.(*testcomponents.ExampleReceiver) assert.NoError(t, tracesReceiver.ConsumeTraces(context.Background(), testdata.GenerateTraces(1))) } - for _, c := range allReceivers[component.DataTypeMetrics] { + for _, c := range allReceivers[component.SignalMetrics] { metricsReceiver := c.(*testcomponents.ExampleReceiver) assert.NoError(t, metricsReceiver.ConsumeMetrics(context.Background(), testdata.GenerateMetrics(1))) } - for _, c := range allReceivers[component.DataTypeLogs] { + for _, c := range allReceivers[component.SignalLogs] { logsReceiver := c.(*testcomponents.ExampleReceiver) assert.NoError(t, logsReceiver.ConsumeLogs(context.Background(), testdata.GenerateLogs(1))) } - for _, c := range allReceivers[componentprofiles.DataTypeProfiles] { + for _, c := range allReceivers[componentprofiles.SignalProfiles] { profilesReceiver := c.(*testcomponents.ExampleReceiver) assert.NoError(t, profilesReceiver.ConsumeProfiles(context.Background(), testdata.GenerateProfiles(1))) } @@ -1177,7 +1177,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { // Get the list of Exporters directly from the overall component graph. Like Receivers, // exclude Connectors and validate each exporter once regardless of sharing between Pipelines. allExporters := pg.GetExporters() - for _, e := range allExporters[component.DataTypeTraces] { + for _, e := range allExporters[component.SignalTraces] { tracesExporter := e.(*testcomponents.ExampleExporter) assert.Equal(t, test.expectedPerExporter, len(tracesExporter.Traces)) expectedMutable := testdata.GenerateTraces(1) @@ -1191,7 +1191,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } } - for _, e := range allExporters[component.DataTypeMetrics] { + for _, e := range allExporters[component.SignalMetrics] { metricsExporter := e.(*testcomponents.ExampleExporter) assert.Equal(t, test.expectedPerExporter, len(metricsExporter.Metrics)) expectedMutable := testdata.GenerateMetrics(1) @@ -1205,7 +1205,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } } - for _, e := range allExporters[component.DataTypeLogs] { + for _, e := range allExporters[component.SignalLogs] { logsExporter := e.(*testcomponents.ExampleExporter) assert.Equal(t, test.expectedPerExporter, len(logsExporter.Logs)) expectedMutable := testdata.GenerateLogs(1) @@ -1219,7 +1219,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { } } } - for _, e := range allExporters[componentprofiles.DataTypeProfiles] { + for _, e := range allExporters[componentprofiles.SignalProfiles] { profilesExporter := e.(*testcomponents.ExampleExporter) assert.Equal(t, test.expectedPerExporter, len(profilesExporter.Profiles)) expectedMutable := testdata.GenerateProfiles(1) @@ -1246,21 +1246,21 @@ func TestConnectorRouter(t *testing.T) { expRightID := component.MustNewIDWithName("exampleexporter", "right") expLeftID := component.MustNewIDWithName("exampleexporter", "left") - tracesInID := component.MustNewIDWithName("traces", "in") - tracesRightID := component.MustNewIDWithName("traces", "right") - tracesLeftID := component.MustNewIDWithName("traces", "left") + tracesInID := component.NewPipelineIDWithName("traces", "in") + tracesRightID := component.NewPipelineIDWithName("traces", "right") + tracesLeftID := component.NewPipelineIDWithName("traces", "left") - metricsInID := component.MustNewIDWithName("metrics", "in") - metricsRightID := component.MustNewIDWithName("metrics", "right") - metricsLeftID := component.MustNewIDWithName("metrics", "left") + metricsInID := component.NewPipelineIDWithName("metrics", "in") + metricsRightID := component.NewPipelineIDWithName("metrics", "right") + metricsLeftID := component.NewPipelineIDWithName("metrics", "left") - logsInID := component.MustNewIDWithName("logs", "in") - logsRightID := component.MustNewIDWithName("logs", "right") - logsLeftID := component.MustNewIDWithName("logs", "left") + logsInID := component.NewPipelineIDWithName("logs", "in") + logsRightID := component.NewPipelineIDWithName("logs", "right") + logsLeftID := component.NewPipelineIDWithName("logs", "left") - profilesInID := component.MustNewIDWithName("profiles", "in") - profilesRightID := component.MustNewIDWithName("profiles", "right") - profilesLeftID := component.MustNewIDWithName("profiles", "left") + profilesInID := component.NewPipelineIDWithName("profiles", "in") + profilesRightID := component.NewPipelineIDWithName("profiles", "right") + profilesLeftID := component.NewPipelineIDWithName("profiles", "left") ctx := context.Background() set := Settings{ @@ -1375,9 +1375,9 @@ func TestConnectorRouter(t *testing.T) { assert.Equal(t, len(set.PipelineConfigs), len(pg.pipelines)) // Get a handle for the traces receiver and both Exporters - tracesReceiver := allReceivers[component.DataTypeTraces][rcvrID].(*testcomponents.ExampleReceiver) - tracesRight := allExporters[component.DataTypeTraces][expRightID].(*testcomponents.ExampleExporter) - tracesLeft := allExporters[component.DataTypeTraces][expLeftID].(*testcomponents.ExampleExporter) + tracesReceiver := allReceivers[component.SignalTraces][rcvrID].(*testcomponents.ExampleReceiver) + tracesRight := allExporters[component.SignalTraces][expRightID].(*testcomponents.ExampleExporter) + tracesLeft := allExporters[component.SignalTraces][expLeftID].(*testcomponents.ExampleExporter) // Consume 1, validate it went right assert.NoError(t, tracesReceiver.ConsumeTraces(ctx, testdata.GenerateTraces(1))) @@ -1397,9 +1397,9 @@ func TestConnectorRouter(t *testing.T) { assert.Equal(t, 2, len(tracesLeft.Traces)) // Get a handle for the metrics receiver and both Exporters - metricsReceiver := allReceivers[component.DataTypeMetrics][rcvrID].(*testcomponents.ExampleReceiver) - metricsRight := allExporters[component.DataTypeMetrics][expRightID].(*testcomponents.ExampleExporter) - metricsLeft := allExporters[component.DataTypeMetrics][expLeftID].(*testcomponents.ExampleExporter) + metricsReceiver := allReceivers[component.SignalMetrics][rcvrID].(*testcomponents.ExampleReceiver) + metricsRight := allExporters[component.SignalMetrics][expRightID].(*testcomponents.ExampleExporter) + metricsLeft := allExporters[component.SignalMetrics][expLeftID].(*testcomponents.ExampleExporter) // Consume 1, validate it went right assert.NoError(t, metricsReceiver.ConsumeMetrics(ctx, testdata.GenerateMetrics(1))) @@ -1419,9 +1419,9 @@ func TestConnectorRouter(t *testing.T) { assert.Equal(t, 2, len(metricsLeft.Metrics)) // Get a handle for the logs receiver and both Exporters - logsReceiver := allReceivers[component.DataTypeLogs][rcvrID].(*testcomponents.ExampleReceiver) - logsRight := allExporters[component.DataTypeLogs][expRightID].(*testcomponents.ExampleExporter) - logsLeft := allExporters[component.DataTypeLogs][expLeftID].(*testcomponents.ExampleExporter) + logsReceiver := allReceivers[component.SignalLogs][rcvrID].(*testcomponents.ExampleReceiver) + logsRight := allExporters[component.SignalLogs][expRightID].(*testcomponents.ExampleExporter) + logsLeft := allExporters[component.SignalLogs][expLeftID].(*testcomponents.ExampleExporter) // Consume 1, validate it went right assert.NoError(t, logsReceiver.ConsumeLogs(ctx, testdata.GenerateLogs(1))) @@ -1441,9 +1441,9 @@ func TestConnectorRouter(t *testing.T) { assert.Equal(t, 2, len(logsLeft.Logs)) // Get a handle for the profiles receiver and both Exporters - profilesReceiver := allReceivers[componentprofiles.DataTypeProfiles][rcvrID].(*testcomponents.ExampleReceiver) - profilesRight := allExporters[componentprofiles.DataTypeProfiles][expRightID].(*testcomponents.ExampleExporter) - profilesLeft := allExporters[componentprofiles.DataTypeProfiles][expLeftID].(*testcomponents.ExampleExporter) + profilesReceiver := allReceivers[componentprofiles.SignalProfiles][rcvrID].(*testcomponents.ExampleReceiver) + profilesRight := allExporters[componentprofiles.SignalProfiles][expRightID].(*testcomponents.ExampleExporter) + profilesLeft := allExporters[componentprofiles.SignalProfiles][expLeftID].(*testcomponents.ExampleExporter) // Consume 1, validate it went right assert.NoError(t, profilesReceiver.ConsumeProfiles(ctx, testdata.GenerateProfiles(1))) @@ -1493,7 +1493,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1509,7 +1509,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1525,7 +1525,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1541,7 +1541,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1560,7 +1560,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1580,7 +1580,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1600,7 +1600,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1620,7 +1620,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1637,7 +1637,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1653,7 +1653,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1669,7 +1669,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1685,7 +1685,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1704,11 +1704,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1727,11 +1727,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1750,11 +1750,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1773,11 +1773,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1796,11 +1796,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1819,11 +1819,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1842,11 +1842,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1865,11 +1865,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1888,11 +1888,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1911,11 +1911,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1934,11 +1934,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1957,11 +1957,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1980,11 +1980,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2003,11 +2003,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2026,11 +2026,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2049,11 +2049,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2072,7 +2072,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, @@ -2091,7 +2091,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2110,15 +2110,15 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("mockforward"): mfConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, @@ -2137,15 +2137,15 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("mockforward"): mfConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2167,7 +2167,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -2193,7 +2193,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -2219,7 +2219,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -2245,7 +2245,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -2273,22 +2273,22 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("traces", "1"): { + component.NewPipelineIDWithName("traces", "1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn1")}, }, - component.MustNewIDWithName("traces", "2"): { + component.NewPipelineIDWithName("traces", "2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn1")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn2"), component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2318,22 +2318,22 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + component.NewPipelineIDWithName("metrics", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("metrics", "1"): { + component.NewPipelineIDWithName("metrics", "1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn1")}, }, - component.MustNewIDWithName("metrics", "2"): { + component.NewPipelineIDWithName("metrics", "2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn1")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn2"), component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("metrics", "out"): { + component.NewPipelineIDWithName("metrics", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2363,22 +2363,22 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + component.NewPipelineIDWithName("logs", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("logs", "1"): { + component.NewPipelineIDWithName("logs", "1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn1")}, }, - component.MustNewIDWithName("logs", "2"): { + component.NewPipelineIDWithName("logs", "2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn1")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn2"), component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("logs", "out"): { + component.NewPipelineIDWithName("logs", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2408,22 +2408,22 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("profiles", "in"): { + component.NewPipelineIDWithName("profiles", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("profiles", "1"): { + component.NewPipelineIDWithName("profiles", "1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn1")}, }, - component.MustNewIDWithName("profiles", "2"): { + component.NewPipelineIDWithName("profiles", "2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn1")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn2"), component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("profiles", "out"): { + component.NewPipelineIDWithName("profiles", "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2454,37 +2454,37 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "rawlog"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "fork")}, }, - component.MustNewIDWithName("traces", "copy1"): { + component.NewPipelineIDWithName("traces", "copy1"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "fork")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "count")}, }, - component.MustNewIDWithName("traces", "copy2"): { + component.NewPipelineIDWithName("traces", "copy2"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "fork")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "forkagain")}, }, - component.MustNewIDWithName("traces", "copy2a"): { + component.NewPipelineIDWithName("traces", "copy2a"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "forkagain")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "count")}, }, - component.MustNewIDWithName("traces", "copy2b"): { + component.NewPipelineIDWithName("traces", "copy2b"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "forkagain")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "rawlog")}, }, - component.MustNewIDWithName("metrics", "count"): { + component.NewPipelineIDWithName("metrics", "count"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "count")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("logs", "raw"): { + component.NewPipelineIDWithName("logs", "raw"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "rawlog")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "fork")}, // cannot loop back to "nop/fork" @@ -2508,7 +2508,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, }, @@ -2524,7 +2524,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("unknown"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("unknown")}, }, @@ -2543,7 +2543,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2563,7 +2563,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2580,7 +2580,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2596,7 +2596,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2615,11 +2615,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("unknown"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + component.NewPipelineIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("unknown")}, }, - component.MustNewIDWithName("traces", "out"): { + component.NewPipelineIDWithName("traces", "out"): { Receivers: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2719,11 +2719,11 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { }), } - dataTypes := []component.DataType{component.DataTypeTraces, component.DataTypeMetrics, component.DataTypeLogs} + dataTypes := []component.Signal{component.SignalTraces, component.SignalMetrics, component.SignalLogs} for _, dt := range dataTypes { t.Run(dt.String()+"/receiver", func(t *testing.T) { set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + component.NewPipelineID(dt): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2737,7 +2737,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { t.Run(dt.String()+"/processor", func(t *testing.T) { set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + component.NewPipelineID(dt): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2751,7 +2751,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { t.Run(dt.String()+"/exporter", func(t *testing.T) { set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + component.NewPipelineID(dt): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, @@ -2766,12 +2766,12 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { for _, dt2 := range dataTypes { t.Run(dt.String()+"/"+dt2.String()+"/connector", func(t *testing.T) { set.PipelineConfigs = pipelines.Config{ - component.NewIDWithName(dt, "in"): { + component.NewPipelineIDWithName(dt, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("err", "conn")}, }, - component.NewIDWithName(dt2, "out"): { + component.NewPipelineIDWithName(dt2, "out"): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("err", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2939,12 +2939,12 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { } } -func (g *Graph) getReceivers() map[component.DataType]map[component.ID]component.Component { - receiversMap := make(map[component.DataType]map[component.ID]component.Component) - receiversMap[component.DataTypeTraces] = make(map[component.ID]component.Component) - receiversMap[component.DataTypeMetrics] = make(map[component.ID]component.Component) - receiversMap[component.DataTypeLogs] = make(map[component.ID]component.Component) - receiversMap[componentprofiles.DataTypeProfiles] = make(map[component.ID]component.Component) +func (g *Graph) getReceivers() map[component.Signal]map[component.ID]component.Component { + receiversMap := make(map[component.Signal]map[component.ID]component.Component) + receiversMap[component.SignalTraces] = make(map[component.ID]component.Component) + receiversMap[component.SignalMetrics] = make(map[component.ID]component.Component) + receiversMap[component.SignalLogs] = make(map[component.ID]component.Component) + receiversMap[componentprofiles.SignalProfiles] = make(map[component.ID]component.Component) for _, pg := range g.pipelines { for _, rcvrNode := range pg.receivers { @@ -2972,7 +2972,7 @@ func (g *Graph) getReceivers() map[component.DataType]map[component.ID]component // However, within an individual pipeline, we expect: // - E instances of the connector as a receiver. // - R instances of the connector as an exporter. -func expectedInstances(m pipelines.Config, pID component.ID) (int, int) { +func expectedInstances(m pipelines.Config, pID component.PipelineID) (int, int) { exConnectorType := component.MustNewType("exampleconnector") var r, e int for _, rID := range m[pID].Receivers { @@ -2982,11 +2982,11 @@ func expectedInstances(m pipelines.Config, pID component.ID) (int, int) { } // This is a connector. Count the pipeline types where it is an exporter. - typeMap := map[component.DataType]bool{} + typeMap := map[component.Signal]bool{} for pID, pCfg := range m { for _, eID := range pCfg.Exporters { if eID == rID { - typeMap[pID.Type()] = true + typeMap[pID.Signal()] = true } } } @@ -2999,11 +2999,11 @@ func expectedInstances(m pipelines.Config, pID component.ID) (int, int) { } // This is a connector. Count the pipeline types where it is a receiver. - typeMap := map[component.DataType]bool{} + typeMap := map[component.Signal]bool{} for pID, pCfg := range m { for _, rID := range pCfg.Receivers { if rID == eID { - typeMap[pID.Type()] = true + typeMap[pID.Signal()] = true } } } diff --git a/service/internal/graph/host.go b/service/internal/graph/host.go index abadca4b4af..e00d30adf23 100644 --- a/service/internal/graph/host.go +++ b/service/internal/graph/host.go @@ -21,7 +21,7 @@ import ( // TODO: remove as part of https://github.com/open-telemetry/opentelemetry-collector/issues/7370 for service 1.0 type getExporters interface { - GetExporters() map[component.DataType]map[component.ID]component.Component + GetExporters() map[component.Signal]map[component.ID]component.Component } var _ getExporters = (*Host)(nil) @@ -70,7 +70,7 @@ func (host *Host) GetExtensions() map[component.ID]component.Component { // connector. See https://github.com/open-telemetry/opentelemetry-collector/issues/7370 and // https://github.com/open-telemetry/opentelemetry-collector/pull/7390#issuecomment-1483710184 // for additional information. -func (host *Host) GetExporters() map[component.DataType]map[component.ID]component.Component { +func (host *Host) GetExporters() map[component.Signal]map[component.ID]component.Component { return host.Pipelines.GetExporters() } diff --git a/service/internal/graph/nodes.go b/service/internal/graph/nodes.go index f9cc3e6fa7a..eb4b0f2c77f 100644 --- a/service/internal/graph/nodes.go +++ b/service/internal/graph/nodes.go @@ -59,13 +59,13 @@ type consumerNode interface { type receiverNode struct { nodeID componentID component.ID - pipelineType component.DataType + pipelineType component.Signal component.Component } -func newReceiverNode(pipelineType component.DataType, recvID component.ID) *receiverNode { +func newReceiverNode(pipelineType component.Signal, recvID component.ID) *receiverNode { return &receiverNode{ - nodeID: newNodeID(receiverSeed, pipelineType.String(), recvID.String()), + nodeID: newNodeID(receiverSeed, string(pipelineType), recvID.String()), componentID: recvID, pipelineType: pipelineType, } @@ -81,25 +81,25 @@ func (n *receiverNode) buildComponent(ctx context.Context, set := receiver.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} var err error switch n.pipelineType { - case component.DataTypeTraces: + case component.SignalTraces: var consumers []consumer.Traces for _, next := range nexts { consumers = append(consumers, next.(consumer.Traces)) } n.Component, err = builder.CreateTraces(ctx, set, fanoutconsumer.NewTraces(consumers)) - case component.DataTypeMetrics: + case component.SignalMetrics: var consumers []consumer.Metrics for _, next := range nexts { consumers = append(consumers, next.(consumer.Metrics)) } n.Component, err = builder.CreateMetrics(ctx, set, fanoutconsumer.NewMetrics(consumers)) - case component.DataTypeLogs: + case component.SignalLogs: var consumers []consumer.Logs for _, next := range nexts { consumers = append(consumers, next.(consumer.Logs)) } n.Component, err = builder.CreateLogs(ctx, set, fanoutconsumer.NewLogs(consumers)) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: var consumers []consumerprofiles.Profiles for _, next := range nexts { consumers = append(consumers, next.(consumerprofiles.Profiles)) @@ -121,11 +121,11 @@ var _ consumerNode = (*processorNode)(nil) type processorNode struct { nodeID componentID component.ID - pipelineID component.ID + pipelineID component.PipelineID component.Component } -func newProcessorNode(pipelineID, procID component.ID) *processorNode { +func newProcessorNode(pipelineID component.PipelineID, procID component.ID) *processorNode { return &processorNode{ nodeID: newNodeID(processorSeed, pipelineID.String(), procID.String()), componentID: procID, @@ -146,20 +146,20 @@ func (n *processorNode) buildComponent(ctx context.Context, tel.Logger = components.ProcessorLogger(tel.Logger, n.componentID, n.pipelineID) set := processor.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} var err error - switch n.pipelineID.Type() { - case component.DataTypeTraces: + switch n.pipelineID.Signal() { + case component.SignalTraces: n.Component, err = builder.CreateTraces(ctx, set, next.(consumer.Traces)) - case component.DataTypeMetrics: + case component.SignalMetrics: n.Component, err = builder.CreateMetrics(ctx, set, next.(consumer.Metrics)) - case component.DataTypeLogs: + case component.SignalLogs: n.Component, err = builder.CreateLogs(ctx, set, next.(consumer.Logs)) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: n.Component, err = builder.CreateProfiles(ctx, set, next.(consumerprofiles.Profiles)) default: - return fmt.Errorf("error creating processor %q in pipeline %q, data type %q is not supported", set.ID, n.pipelineID, n.pipelineID.Type()) + return fmt.Errorf("error creating processor %q in pipeline %q, data type %q is not supported", set.ID, n.pipelineID.String(), n.pipelineID.Signal()) } if err != nil { - return fmt.Errorf("failed to create %q processor, in pipeline %q: %w", set.ID, n.pipelineID, err) + return fmt.Errorf("failed to create %q processor, in pipeline %q: %w", set.ID, n.pipelineID.String(), err) } return nil } @@ -171,13 +171,13 @@ var _ consumerNode = (*exporterNode)(nil) type exporterNode struct { nodeID componentID component.ID - pipelineType component.DataType + pipelineType component.Signal component.Component } -func newExporterNode(pipelineType component.DataType, exprID component.ID) *exporterNode { +func newExporterNode(pipelineType component.Signal, exprID component.ID) *exporterNode { return &exporterNode{ - nodeID: newNodeID(exporterSeed, pipelineType.String(), exprID.String()), + nodeID: newNodeID(exporterSeed, string(pipelineType), exprID.String()), componentID: exprID, pipelineType: pipelineType, } @@ -197,13 +197,13 @@ func (n *exporterNode) buildComponent( set := exporter.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} var err error switch n.pipelineType { - case component.DataTypeTraces: + case component.SignalTraces: n.Component, err = builder.CreateTraces(ctx, set) - case component.DataTypeMetrics: + case component.SignalMetrics: n.Component, err = builder.CreateMetrics(ctx, set) - case component.DataTypeLogs: + case component.SignalLogs: n.Component, err = builder.CreateLogs(ctx, set) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: n.Component, err = builder.CreateProfiles(ctx, set) default: return fmt.Errorf("error creating exporter %q for data type %q is not supported", set.ID, n.pipelineType) @@ -221,15 +221,15 @@ var _ consumerNode = (*connectorNode)(nil) type connectorNode struct { nodeID componentID component.ID - exprPipelineType component.DataType - rcvrPipelineType component.DataType + exprPipelineType component.Signal + rcvrPipelineType component.Signal component.Component baseConsumer } -func newConnectorNode(exprPipelineType, rcvrPipelineType component.DataType, connID component.ID) *connectorNode { +func newConnectorNode(exprPipelineType, rcvrPipelineType component.Signal, connID component.ID) *connectorNode { return &connectorNode{ - nodeID: newNodeID(connectorSeed, connID.String(), exprPipelineType.String(), rcvrPipelineType.String()), + nodeID: newNodeID(connectorSeed, connID.String(), string(exprPipelineType), string(rcvrPipelineType)), componentID: connID, exprPipelineType: exprPipelineType, rcvrPipelineType: rcvrPipelineType, @@ -251,9 +251,9 @@ func (n *connectorNode) buildComponent( set := connector.Settings{ID: n.componentID, TelemetrySettings: tel, BuildInfo: info} switch n.rcvrPipelineType { - case component.DataTypeTraces: + case component.SignalTraces: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Traces, len(nexts)) + consumers := make(map[component.PipelineID]consumer.Traces, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Traces) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -261,7 +261,7 @@ func (n *connectorNode) buildComponent( next := connector.NewTracesRouter(consumers) switch n.exprPipelineType { - case component.DataTypeTraces: + case component.SignalTraces: conn, err := builder.CreateTracesToTraces(ctx, set, next) if err != nil { return err @@ -273,19 +273,19 @@ func (n *connectorNode) buildComponent( // that the connector itself may MutatesData. capability.MutatesData = capability.MutatesData || conn.Capabilities().MutatesData n.baseConsumer = capabilityconsumer.NewTraces(conn, capability) - case component.DataTypeMetrics: + case component.SignalMetrics: conn, err := builder.CreateMetricsToTraces(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeLogs: + case component.SignalLogs: conn, err := builder.CreateLogsToTraces(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: conn, err := builder.CreateProfilesToTraces(ctx, set, next) if err != nil { return err @@ -293,9 +293,9 @@ func (n *connectorNode) buildComponent( n.Component, n.baseConsumer = conn, conn } - case component.DataTypeMetrics: + case component.SignalMetrics: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Metrics, len(nexts)) + consumers := make(map[component.PipelineID]consumer.Metrics, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Metrics) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -303,13 +303,13 @@ func (n *connectorNode) buildComponent( next := connector.NewMetricsRouter(consumers) switch n.exprPipelineType { - case component.DataTypeTraces: + case component.SignalTraces: conn, err := builder.CreateTracesToMetrics(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeMetrics: + case component.SignalMetrics: conn, err := builder.CreateMetricsToMetrics(ctx, set, next) if err != nil { return err @@ -321,22 +321,22 @@ func (n *connectorNode) buildComponent( // that the connector itself may MutatesData. capability.MutatesData = capability.MutatesData || conn.Capabilities().MutatesData n.baseConsumer = capabilityconsumer.NewMetrics(conn, capability) - case component.DataTypeLogs: + case component.SignalLogs: conn, err := builder.CreateLogsToMetrics(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: conn, err := builder.CreateProfilesToMetrics(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn } - case component.DataTypeLogs: + case component.SignalLogs: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Logs, len(nexts)) + consumers := make(map[component.PipelineID]consumer.Logs, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Logs) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -344,19 +344,19 @@ func (n *connectorNode) buildComponent( next := connector.NewLogsRouter(consumers) switch n.exprPipelineType { - case component.DataTypeTraces: + case component.SignalTraces: conn, err := builder.CreateTracesToLogs(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeMetrics: + case component.SignalMetrics: conn, err := builder.CreateMetricsToLogs(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeLogs: + case component.SignalLogs: conn, err := builder.CreateLogsToLogs(ctx, set, next) if err != nil { return err @@ -368,16 +368,16 @@ func (n *connectorNode) buildComponent( // that the connector itself may MutatesData. capability.MutatesData = capability.MutatesData || conn.Capabilities().MutatesData n.baseConsumer = capabilityconsumer.NewLogs(conn, capability) - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: conn, err := builder.CreateProfilesToLogs(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn } - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumerprofiles.Profiles, len(nexts)) + consumers := make(map[component.PipelineID]consumerprofiles.Profiles, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumerprofiles.Profiles) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -385,25 +385,25 @@ func (n *connectorNode) buildComponent( next := connectorprofiles.NewProfilesRouter(consumers) switch n.exprPipelineType { - case component.DataTypeTraces: + case component.SignalTraces: conn, err := builder.CreateTracesToProfiles(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeMetrics: + case component.SignalMetrics: conn, err := builder.CreateMetricsToProfiles(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case component.DataTypeLogs: + case component.SignalLogs: conn, err := builder.CreateLogsToProfiles(ctx, set, next) if err != nil { return err } n.Component, n.baseConsumer = conn, conn - case componentprofiles.DataTypeProfiles: + case componentprofiles.SignalProfiles: conn, err := builder.CreateProfilesToProfiles(ctx, set, next) if err != nil { return err @@ -429,7 +429,7 @@ var _ consumerNode = (*capabilitiesNode)(nil) // The nodeID is derived from "pipeline ID". type capabilitiesNode struct { nodeID - pipelineID component.ID + pipelineID component.PipelineID baseConsumer consumer.ConsumeTracesFunc consumer.ConsumeMetricsFunc @@ -437,7 +437,7 @@ type capabilitiesNode struct { consumerprofiles.ConsumeProfilesFunc } -func newCapabilitiesNode(pipelineID component.ID) *capabilitiesNode { +func newCapabilitiesNode(pipelineID component.PipelineID) *capabilitiesNode { return &capabilitiesNode{ nodeID: newNodeID(capabilitiesSeed, pipelineID.String()), pipelineID: pipelineID, @@ -454,11 +454,11 @@ var _ consumerNode = (*fanOutNode)(nil) // Therefore, nodeID is derived from "pipeline ID". type fanOutNode struct { nodeID - pipelineID component.ID + pipelineID component.PipelineID baseConsumer } -func newFanOutNode(pipelineID component.ID) *fanOutNode { +func newFanOutNode(pipelineID component.PipelineID) *fanOutNode { return &fanOutNode{ nodeID: newNodeID(fanOutToExporters, pipelineID.String()), pipelineID: pipelineID, diff --git a/service/internal/graph/zpages.go b/service/internal/graph/zpages.go index 0f2793974e9..fad308307b6 100644 --- a/service/internal/graph/zpages.go +++ b/service/internal/graph/zpages.go @@ -55,7 +55,7 @@ func (g *Graph) HandleZPages(w http.ResponseWriter, r *http.Request) { sumData.Rows = append(sumData.Rows, zpages.SummaryPipelinesTableRowData{ FullName: c.String(), - InputType: c.Type().String(), + InputType: string(c.Signal()), MutatesData: p.capabilitiesNode.getConsumer().Capabilities().MutatesData, Receivers: recvIDs, Processors: procIDs, diff --git a/service/internal/testcomponents/example_router.go b/service/internal/testcomponents/example_router.go index c8fd28f48e1..6afbb71fdff 100644 --- a/service/internal/testcomponents/example_router.go +++ b/service/internal/testcomponents/example_router.go @@ -30,8 +30,8 @@ var ExampleRouterFactory = connector.NewFactory( ) type LeftRightConfig struct { - Left component.ID `mapstructure:"left"` - Right component.ID `mapstructure:"right"` + Left component.PipelineID `mapstructure:"left"` + Right component.PipelineID `mapstructure:"right"` } type ExampleRouterConfig struct { diff --git a/service/internal/testcomponents/example_router_test.go b/service/internal/testcomponents/example_router_test.go index a21ec0dcda1..bb788a3ff5d 100644 --- a/service/internal/testcomponents/example_router_test.go +++ b/service/internal/testcomponents/example_router_test.go @@ -33,8 +33,8 @@ func TestExampleRouter(t *testing.T) { } func TestTracesRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := component.NewPipelineIDWithName("sink", "left") + rightID := component.NewPipelineIDWithName("sink", "right") sinkLeft := new(consumertest.TracesSink) sinkRight := new(consumertest.TracesSink) @@ -43,7 +43,7 @@ func TestTracesRouter(t *testing.T) { // Many connectors will just call router.ConsumeTraces, // but some implementation will call RouteTraces instead. router := connector.NewTracesRouter( - map[component.ID]consumer.Traces{ + map[component.PipelineID]consumer.Traces{ leftID: sinkLeft, rightID: sinkRight, }) @@ -72,8 +72,8 @@ func TestTracesRouter(t *testing.T) { } func TestMetricsRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := component.NewPipelineIDWithName("sink", "left") + rightID := component.NewPipelineIDWithName("sink", "right") sinkLeft := new(consumertest.MetricsSink) sinkRight := new(consumertest.MetricsSink) @@ -82,7 +82,7 @@ func TestMetricsRouter(t *testing.T) { // Many connectors will just call router.ConsumeMetrics, // but some implementation will call RouteMetrics instead. router := connector.NewMetricsRouter( - map[component.ID]consumer.Metrics{ + map[component.PipelineID]consumer.Metrics{ leftID: sinkLeft, rightID: sinkRight, }) @@ -111,8 +111,8 @@ func TestMetricsRouter(t *testing.T) { } func TestLogsRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := component.NewPipelineIDWithName("sink", "left") + rightID := component.NewPipelineIDWithName("sink", "right") sinkLeft := new(consumertest.LogsSink) sinkRight := new(consumertest.LogsSink) @@ -121,7 +121,7 @@ func TestLogsRouter(t *testing.T) { // Many connectors will just call router.ConsumeLogs, // but some implementation will call RouteLogs instead. router := connector.NewLogsRouter( - map[component.ID]consumer.Logs{ + map[component.PipelineID]consumer.Logs{ leftID: sinkLeft, rightID: sinkRight, }) @@ -150,8 +150,8 @@ func TestLogsRouter(t *testing.T) { } func TestProfilesRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := component.NewPipelineIDWithName("sink", "left") + rightID := component.NewPipelineIDWithName("sink", "right") sinkLeft := new(consumertest.ProfilesSink) sinkRight := new(consumertest.ProfilesSink) @@ -160,7 +160,7 @@ func TestProfilesRouter(t *testing.T) { // Many connectors will just call router.ConsumeProfiles, // but some implementation will call RouteProfiles instead. router := connectorprofiles.NewProfilesRouter( - map[component.ID]consumerprofiles.Profiles{ + map[component.PipelineID]consumerprofiles.Profiles{ leftID: sinkLeft, rightID: sinkRight, }) diff --git a/service/pipelines/config.go b/service/pipelines/config.go index 66698539d5b..61a00ef978b 100644 --- a/service/pipelines/config.go +++ b/service/pipelines/config.go @@ -18,7 +18,7 @@ var ( ) // Config defines the configurable settings for service telemetry. -type Config map[component.ID]*PipelineConfig +type Config map[component.PipelineID]*PipelineConfig func (cfg Config) Validate() error { // Must have at least one pipeline. @@ -29,23 +29,23 @@ func (cfg Config) Validate() error { // Check that all pipelines have at least one receiver and one exporter, and they reference // only configured components. for pipelineID, pipeline := range cfg { - switch pipelineID.Type() { - case component.DataTypeTraces, component.DataTypeMetrics, component.DataTypeLogs, componentprofiles.DataTypeProfiles: + switch pipelineID.Signal() { + case component.SignalTraces, component.SignalMetrics, component.SignalLogs, componentprofiles.SignalProfiles: // Continue default: - return fmt.Errorf("pipeline %q: unknown datatype %q", pipelineID, pipelineID.Type()) + return fmt.Errorf("pipeline %q: unknown datatype %q", pipelineID, pipelineID.Signal()) } // Validate pipeline has at least one receiver. if err := pipeline.Validate(); err != nil { - return fmt.Errorf("pipeline %q: %w", pipelineID, err) + return fmt.Errorf("pipeline %q: %w", pipelineID.String(), err) } } return nil } -// PipelineConfig defines the configuration of a Pipeline. +// PipelineConfig defines the configuration of a PipelineID. type PipelineConfig struct { Receivers []component.ID `mapstructure:"receivers"` Processors []component.ID `mapstructure:"processors"` diff --git a/service/pipelines/config_test.go b/service/pipelines/config_test.go index 7ad94d5ab3f..dd17411e907 100644 --- a/service/pipelines/config_test.go +++ b/service/pipelines/config_test.go @@ -28,7 +28,7 @@ func TestConfigValidate(t *testing.T) { name: "duplicate-processor-reference", cfgFn: func() Config { cfg := generateConfig() - pipe := cfg[component.MustNewID("traces")] + pipe := cfg[component.NewPipelineID(component.SignalTraces)] pipe.Processors = append(pipe.Processors, pipe.Processors...) return cfg }, @@ -38,7 +38,7 @@ func TestConfigValidate(t *testing.T) { name: "missing-pipeline-receivers", cfgFn: func() Config { cfg := generateConfig() - cfg[component.MustNewID("traces")].Receivers = nil + cfg[component.NewPipelineID(component.SignalTraces)].Receivers = nil return cfg }, expected: fmt.Errorf(`pipeline "traces": %w`, errMissingServicePipelineReceivers), @@ -47,7 +47,7 @@ func TestConfigValidate(t *testing.T) { name: "missing-pipeline-exporters", cfgFn: func() Config { cfg := generateConfig() - cfg[component.MustNewID("traces")].Exporters = nil + cfg[component.NewPipelineID(component.SignalTraces)].Exporters = nil return cfg }, expected: fmt.Errorf(`pipeline "traces": %w`, errMissingServicePipelineExporters), @@ -63,7 +63,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-service-pipeline-type", cfgFn: func() Config { cfg := generateConfig() - cfg[component.MustNewID("wrongtype")] = &PipelineConfig{ + cfg[component.NewPipelineID("wrongtype")] = &PipelineConfig{ Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -83,8 +83,8 @@ func TestConfigValidate(t *testing.T) { } func generateConfig() Config { - return map[component.ID]*PipelineConfig{ - component.MustNewID("traces"): { + return map[component.PipelineID]*PipelineConfig{ + component.NewPipelineID(component.SignalTraces): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, diff --git a/service/service_test.go b/service/service_test.go index a76e267490d..2bd1dd26b06 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -228,21 +228,21 @@ func TestServiceGetExporters(t *testing.T) { // nolint expMap := srv.host.GetExporters() assert.Len(t, expMap, 4) - assert.Len(t, expMap[component.DataTypeTraces], 1) - assert.Contains(t, expMap[component.DataTypeTraces], component.NewID(nopType)) - assert.Len(t, expMap[component.DataTypeMetrics], 1) - assert.Contains(t, expMap[component.DataTypeMetrics], component.NewID(nopType)) - assert.Len(t, expMap[component.DataTypeLogs], 1) - assert.Contains(t, expMap[component.DataTypeLogs], component.NewID(nopType)) - assert.Len(t, expMap[componentprofiles.DataTypeProfiles], 1) - assert.Contains(t, expMap[componentprofiles.DataTypeProfiles], component.NewID(nopType)) + assert.Len(t, expMap[component.SignalTraces], 1) + assert.Contains(t, expMap[component.SignalTraces], component.NewID(nopType)) + assert.Len(t, expMap[component.SignalMetrics], 1) + assert.Contains(t, expMap[component.SignalMetrics], component.NewID(nopType)) + assert.Len(t, expMap[component.SignalLogs], 1) + assert.Contains(t, expMap[component.SignalLogs], component.NewID(nopType)) + assert.Len(t, expMap[componentprofiles.SignalProfiles], 1) + assert.Contains(t, expMap[componentprofiles.SignalProfiles], component.NewID(nopType)) } // TestServiceTelemetryCleanupOnError tests that if newService errors due to an invalid config telemetry is cleaned up // and another service with a valid config can be started right after. func TestServiceTelemetryCleanupOnError(t *testing.T) { invalidCfg := newNopConfig() - invalidCfg.Pipelines[component.MustNewID("traces")].Processors[0] = component.MustNewID("invalid") + invalidCfg.Pipelines[component.NewPipelineID("traces")].Processors[0] = component.MustNewID("invalid") // Create a service with an invalid config and expect an error _, err := New(context.Background(), newNopSettings(), invalidCfg) require.Error(t, err) @@ -567,22 +567,22 @@ func newNopSettings() Settings { func newNopConfig() Config { return newNopConfigPipelineConfigs(pipelines.Config{ - component.MustNewID("traces"): { + component.NewPipelineID("traces"): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("metrics"): { + component.NewPipelineID("metrics"): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("logs"): { + component.NewPipelineID("logs"): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("profiles"): { + component.NewPipelineID("profiles"): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)},