diff --git a/.chloggen/datatype-newid.yaml b/.chloggen/datatype-newid.yaml new file mode 100644 index 00000000000..2162a5148fa --- /dev/null +++ b/.chloggen/datatype-newid.yaml @@ -0,0 +1,32 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: component + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Changes DataType to be an enum of Otel signals. Creates a new module pipeline to centralize types related to pipelines. Creates a new struct pipeline.ID - made up of a DataType and an optional string name. This pipeline.ID replaces the previous use of component.ID to identify Pipelines. Moves InstanceID to pipeline to break import cycles." + +# One or more tracking issues or pull requests related to the change +issues: [9429] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + Related API changes: + connector.LogsRouterAndConsumer, connector.MetricsRouterAndConsumer, and connector.TracesRouterAndConsumer `Consumer` methods now accepts pipeline.ID instead of component.ID. Their PipelineIDs function return pipeline.ID instead of component.ID. + NewStatusWatcherExtensionFactory now accepts a pipeline.InstanceID instead of component.InstanceID. + The generated component tests now use PipelineIDs for testing connectors. + extension.ComponentStatusChanged now takes in a *pipeline.InstanceID instead of a *component.InstanceID. + extensiontest.NewStatusWatcherExtensionFactory now takes in a *pipeline.InstanceID instead of a *component.InstanceID. + extensions.NotifyComponentStatusChange now takes in a *pipeline.InstanceID instead of a *component.InstanceID. + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: ['api'] \ No newline at end of file diff --git a/cmd/mdatagen/go.mod b/cmd/mdatagen/go.mod index e258d63a5fe..8f59e0e0781 100644 --- a/cmd/mdatagen/go.mod +++ b/cmd/mdatagen/go.mod @@ -49,7 +49,7 @@ require ( go.opentelemetry.io/otel/sdk v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.1 // indirect @@ -85,3 +85,5 @@ retract ( v0.76.1 v0.65.0 ) + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/cmd/mdatagen/go.sum b/cmd/mdatagen/go.sum index 4a4d76787c8..06e51927203 100644 --- a/cmd/mdatagen/go.sum +++ b/cmd/mdatagen/go.sum @@ -95,8 +95,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= diff --git a/cmd/mdatagen/templates/component_test.go.tmpl b/cmd/mdatagen/templates/component_test.go.tmpl index 45deb99e545..637a4b74835 100644 --- a/cmd/mdatagen/templates/component_test.go.tmpl +++ b/cmd/mdatagen/templates/component_test.go.tmpl @@ -44,6 +44,8 @@ import ( "go.opentelemetry.io/collector/connector/connectortest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" + {{- end }} {{- if or isExporter isProcessor }} "go.opentelemetry.io/collector/pdata/pcommon" @@ -372,7 +374,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[pipeline.ID]consumer.Logs{pipeline.ID(component.DataTypeLogs): consumertest.NewNop()}) return factory.CreateLogsToLogs(ctx, set, cfg, router) }, }, @@ -381,7 +383,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[pipeline.ID]consumer.Metrics{pipeline.NewID(component.DataTypeMetrics): consumertest.NewNop()}) return factory.CreateLogsToMetrics(ctx, set, cfg, router) }, }, @@ -390,7 +392,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[pipeline.ID]consumer.Traces{pipeline.NewID(component.DataTypeTraces): consumertest.NewNop()}) return factory.CreateLogsToTraces(ctx, set, cfg, router) }, }, @@ -399,7 +401,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[pipeline.ID]consumer.Logs{pipeline.NewID(component.DataTypeLogs): consumertest.NewNop()}) return factory.CreateMetricsToLogs(ctx, set, cfg, router) }, }, @@ -408,7 +410,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[pipeline.ID]consumer.Metrics{pipeline.NewID(component.DataTypeMetrics): consumertest.NewNop()}) return factory.CreateMetricsToMetrics(ctx, set, cfg, router) }, }, @@ -417,7 +419,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[pipeline.ID]consumer.Traces{pipeline.NewID(component.DataTypeTraces): consumertest.NewNop()}) return factory.CreateMetricsToTraces(ctx, set, cfg, router) }, }, @@ -426,7 +428,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[pipeline.ID]consumer.Logs{pipeline.NewID(component.DataTypeLogs): consumertest.NewNop()}) return factory.CreateTracesToLogs(ctx, set, cfg, router) }, }, @@ -435,7 +437,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[pipeline.ID]consumer.Metrics{pipeline.NewID(component.DataTypeMetrics): consumertest.NewNop()}) return factory.CreateTracesToMetrics(ctx, set, cfg, router) }, }, @@ -444,7 +446,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[pipeline.ID]consumer.Traces{pipeline.NewID(component.DataTypeTraces): consumertest.NewNop()}) return factory.CreateTracesToTraces(ctx, set, cfg, router) }, }, diff --git a/cmd/otelcorecol/go.mod b/cmd/otelcorecol/go.mod index 5da9dceec49..79d5d45a364 100644 --- a/cmd/otelcorecol/go.mod +++ b/cmd/otelcorecol/go.mod @@ -94,6 +94,7 @@ require ( go.opentelemetry.io/collector/extension/auth v0.102.1 // indirect go.opentelemetry.io/collector/featuregate v1.9.0 // indirect go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/collector/semconv v0.102.1 // indirect go.opentelemetry.io/collector/service v0.102.1 // indirect go.opentelemetry.io/contrib/config v0.7.0 // indirect @@ -218,3 +219,5 @@ replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../ replace go.opentelemetry.io/collector/semconv => ../../semconv replace go.opentelemetry.io/collector/service => ../../service + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/component/component.go b/component/component.go index f5f68b57290..bd1ff210d4b 100644 --- a/component/component.go +++ b/component/component.go @@ -189,10 +189,3 @@ type CreateDefaultConfigFunc func() Config func (f CreateDefaultConfigFunc) CreateDefaultConfig() Config { return f() } - -// InstanceID uniquely identifies a component instance -type InstanceID struct { - ID ID - Kind Kind - PipelineIDs map[ID]struct{} -} diff --git a/component/config.go b/component/config.go index b961d1fdb1f..e6586eb7b17 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" @@ -97,6 +98,8 @@ func callValidateIfPossible(v reflect.Value) error { } // Type is the component type as it is used in the config. +// Examples of a Type include the names of receivers (otlp, filelog, etc), +// processors (batch, memory_limit, etc), or exporters (debug, rabbitmq) type Type struct { name string } @@ -147,20 +150,44 @@ 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. -type DataType = Type - -func mustNewDataType(strType string) DataType { - return MustNewType(strType) -} +type DataType string // Currently supported data types. Add new data types here when new types are supported in the future. -var ( +const ( // DataTypeTraces is the data type tag for traces. - DataTypeTraces = mustNewDataType("traces") + DataTypeTraces DataType = "traces" // DataTypeMetrics is the data type tag for metrics. - DataTypeMetrics = mustNewDataType("metrics") + DataTypeMetrics DataType = "metrics" // DataTypeLogs is the data type tag for logs. - DataTypeLogs = mustNewDataType("logs") + DataTypeLogs DataType = "logs" ) + +func (dt DataType) String() string { + return string(dt) +} + +func (dt DataType) MarshalText() (text []byte, err error) { + return []byte(dt), nil +} + +func (dt *DataType) UnmarshalText(text []byte) error { + if len(text) == 0 { + return errors.New("id must not be empty") + } + strText := string(text) + switch strText { + case "metrics": + *dt = DataTypeMetrics + return nil + case "logs": + *dt = DataTypeLogs + return nil + case "traces": + *dt = DataTypeTraces + return nil + default: + return fmt.Errorf("invalid data type %q", strText) + } +} diff --git a/component/config_test.go b/component/config_test.go index f47a9edc87c..b6d3ca15502 100644 --- a/component/config_test.go +++ b/component/config_test.go @@ -420,3 +420,41 @@ func TestNewType(t *testing.T) { }) } } + +func TestNewDataType(t *testing.T) { + var dt DataType + err := dt.UnmarshalText([]byte("logs")) + require.NoError(t, err) + assert.Equal(t, DataTypeLogs, dt) + + var dt2 DataType + // hopefully this reminds us to update DataType when profiles get included + err = dt2.UnmarshalText([]byte("profiles")) + assert.Equal(t, DataType(""), dt2) + assert.Equal(t, errors.New("invalid data type \"profiles\""), err) +} + +func TestDataTypeStringMarshal(t *testing.T) { + assert.Equal(t, "metrics", DataTypeMetrics.String()) + text, err := DataTypeMetrics.MarshalText() + assert.Equal(t, []byte("metrics"), text) + assert.Nil(t, err) +} + +func TestDataTypeFromSignal(t *testing.T) { + var dt DataType + err := dt.UnmarshalText([]byte("metrics")) + assert.Nil(t, err) + assert.Equal(t, DataTypeMetrics, dt) + + var dt2 DataType + err = dt2.UnmarshalText([]byte("traces")) + assert.Equal(t, DataTypeTraces, dt2) + assert.Nil(t, err) + + var dt3 DataType + err = dt3.UnmarshalText([]byte("")) + assert.Equal(t, errors.New("id must not be empty"), err) + assert.Equal(t, DataType(""), dt3) + +} diff --git a/component/go.mod b/component/go.mod index a870abba8d2..1601e457c12 100644 --- a/component/go.mod +++ b/component/go.mod @@ -29,10 +29,10 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/procfs v0.15.0 // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/component/go.sum b/component/go.sum index ec205ab4aba..6aaa629aaa1 100644 --- a/component/go.sum +++ b/component/go.sum @@ -62,8 +62,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -74,8 +74,8 @@ golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -84,8 +84,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 h1:Q2RxlXqh1cgzzUgV261vBO2jI5R/3DD1J2pM0nI4NhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= diff --git a/component/identifiable.go b/component/identifiable.go index d2d65a5e24f..d9e2f9d4aae 100644 --- a/component/identifiable.go +++ b/component/identifiable.go @@ -9,12 +9,13 @@ import ( "strings" ) -// typeAndNameSeparator is the separator that is used between type and name in type/name composite keys. -const typeAndNameSeparator = "/" +// TypeAndNameSeparator is the separator that is used between type and name in type/name composite keys. +const TypeAndNameSeparator = "/" // ID represents the identity for a component. It combines two values: // * type - the Type of the component. -// * name - the name of that component. +// * name - the name of that component. This can be an empty string. +// Components are defined in configuration by type[/name] - for examples [traces/1] or [oltp/blah] // The component ID (combination type + name) is unique for a given component.Kind. type ID struct { typeVal Type `mapstructure:"-"` @@ -62,7 +63,7 @@ func (id ID) MarshalText() (text []byte, err error) { // UnmarshalText implements the encoding.TextUnmarshaler interface. func (id *ID) UnmarshalText(text []byte) error { idStr := string(text) - items := strings.SplitN(idStr, typeAndNameSeparator, 2) + items := strings.SplitN(idStr, TypeAndNameSeparator, 2) var typeStr, nameStr string if len(items) >= 1 { typeStr = strings.TrimSpace(items[0]) @@ -73,14 +74,14 @@ func (id *ID) UnmarshalText(text []byte) error { } if typeStr == "" { - return fmt.Errorf("in %q id: the part before %s should not be empty", idStr, typeAndNameSeparator) + return fmt.Errorf("in %q id: the part before %s should not be empty", idStr, TypeAndNameSeparator) } 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", idStr, typeAndNameSeparator) + return fmt.Errorf("in %q id: the part after %s should not be empty", idStr, TypeAndNameSeparator) } } @@ -99,5 +100,5 @@ func (id ID) String() string { return id.typeVal.String() } - return id.typeVal.String() + typeAndNameSeparator + id.nameVal + return id.typeVal.String() + TypeAndNameSeparator + id.nameVal } diff --git a/component/status_test.go b/component/status_test.go index 13755d078a5..20efad283f8 100644 --- a/component/status_test.go +++ b/component/status_test.go @@ -52,12 +52,12 @@ func TestStatusEventsWithError(t *testing.T) { func TestAggregateStatus(t *testing.T) { for _, tc := range []struct { name string - statusMap map[*InstanceID]*StatusEvent + statusMap map[*ID]*StatusEvent expectedStatus Status }{ { name: "aggregate status with fatal is FatalError", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusFatalError), @@ -67,7 +67,7 @@ func TestAggregateStatus(t *testing.T) { }, { name: "aggregate status with permanent is PermanentError", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusPermanentError), @@ -77,7 +77,7 @@ func TestAggregateStatus(t *testing.T) { }, { name: "aggregate status with stopping is Stopping", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusRecoverableError), @@ -87,7 +87,7 @@ func TestAggregateStatus(t *testing.T) { }, { name: "aggregate status with stopped and non-stopped is Stopping", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusRecoverableError), @@ -97,7 +97,7 @@ func TestAggregateStatus(t *testing.T) { }, { name: "aggregate status with all stopped is Stopped", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStopped), {}: NewStatusEvent(StatusStopped), {}: NewStatusEvent(StatusStopped), @@ -106,7 +106,7 @@ func TestAggregateStatus(t *testing.T) { }, { name: "aggregate status with recoverable is RecoverableError", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusRecoverableError), @@ -115,7 +115,7 @@ func TestAggregateStatus(t *testing.T) { }, { name: "aggregate status with starting is Starting", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), }, @@ -123,7 +123,7 @@ func TestAggregateStatus(t *testing.T) { }, { name: "aggregate status with all ok is OK", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusOK), @@ -189,12 +189,12 @@ func TestAggregateStatusEvent(t *testing.T) { for _, tc := range []struct { name string - statusMap map[*InstanceID]*StatusEvent + statusMap map[*ID]*StatusEvent expectedStatus *StatusEvent }{ { name: "FatalError - existing event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: latest(NewFatalErrorEvent(assert.AnError)), @@ -208,7 +208,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "FatalError - synthetic event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewFatalErrorEvent(assert.AnError), @@ -222,7 +222,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "PermanentError - existing event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: latest(NewPermanentErrorEvent(assert.AnError)), @@ -236,7 +236,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "PermanentError - synthetic event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewPermanentErrorEvent(assert.AnError), @@ -250,7 +250,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "Stopping - existing event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusRecoverableError), @@ -263,7 +263,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "Stopping - synthetic event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: NewStatusEvent(StatusRecoverableError), @@ -276,7 +276,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "Stopped - existing event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStopped), {}: latest(NewStatusEvent(StatusStopped)), {}: NewStatusEvent(StatusStopped), @@ -288,7 +288,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "RecoverableError - existing event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: NewStatusEvent(StatusOK), {}: latest(NewRecoverableErrorEvent(assert.AnError)), @@ -301,7 +301,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "Starting - synthetic event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusStarting), {}: latest(NewStatusEvent(StatusOK)), }, @@ -312,7 +312,7 @@ func TestAggregateStatusEvent(t *testing.T) { }, { name: "OK - existing event", - statusMap: map[*InstanceID]*StatusEvent{ + statusMap: map[*ID]*StatusEvent{ {}: NewStatusEvent(StatusOK), {}: latest(NewStatusEvent(StatusOK)), {}: NewStatusEvent(StatusOK), diff --git a/config/configauth/go.mod b/config/configauth/go.mod index 2d92d1b09cf..37a251b8d36 100644 --- a/config/configauth/go.mod +++ b/config/configauth/go.mod @@ -23,15 +23,16 @@ require ( go.opentelemetry.io/collector/config/configtelemetry v0.102.1 // indirect go.opentelemetry.io/collector/confmap v0.102.1 // indirect go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect go.opentelemetry.io/otel/trace v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -48,3 +49,5 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../configtelemet replace go.opentelemetry.io/collector/extension => ../../extension replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/config/configauth/go.sum b/config/configauth/go.sum index f058d94d6ae..b5d3fe5ff45 100644 --- a/config/configauth/go.sum +++ b/config/configauth/go.sum @@ -73,20 +73,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -95,8 +95,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 h1:Q2RxlXqh1cgzzUgV261vBO2jI5R/3DD1J2pM0nI4NhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= diff --git a/config/configgrpc/go.mod b/config/configgrpc/go.mod index a22e4b507ff..7861c47b3ff 100644 --- a/config/configgrpc/go.mod +++ b/config/configgrpc/go.mod @@ -52,6 +52,7 @@ require ( go.opentelemetry.io/collector/confmap v0.102.1 // indirect go.opentelemetry.io/collector/extension v0.102.1 // indirect go.opentelemetry.io/collector/featuregate v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect @@ -59,7 +60,7 @@ require ( go.opentelemetry.io/otel/trace v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/protobuf v1.34.1 // indirect @@ -97,3 +98,5 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/consumer => ../../consumer + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/config/configgrpc/go.sum b/config/configgrpc/go.sum index dc78c6d50d7..d730c5b0e68 100644 --- a/config/configgrpc/go.sum +++ b/config/configgrpc/go.sum @@ -105,8 +105,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/config/confighttp/go.mod b/config/confighttp/go.mod index 0076f421a53..be8e906a4a9 100644 --- a/config/confighttp/go.mod +++ b/config/confighttp/go.mod @@ -48,6 +48,7 @@ require ( go.opentelemetry.io/collector/extension v0.102.1 // indirect go.opentelemetry.io/collector/featuregate v1.9.0 // indirect go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect @@ -88,6 +89,8 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/component => ../../component +replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata + replace go.opentelemetry.io/collector/consumer => ../../consumer -replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/config/internal/go.mod b/config/internal/go.mod index bc1c7f91db0..837c6fa7111 100644 --- a/config/internal/go.mod +++ b/config/internal/go.mod @@ -33,3 +33,5 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer replace go.opentelemetry.io/collector/component => ../../component replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/connector/forwardconnector/generated_component_test.go b/connector/forwardconnector/generated_component_test.go index ec49a1d505d..528f4cb5c7c 100644 --- a/connector/forwardconnector/generated_component_test.go +++ b/connector/forwardconnector/generated_component_test.go @@ -15,6 +15,7 @@ import ( "go.opentelemetry.io/collector/connector/connectortest" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/pipeline" ) func TestComponentFactoryType(t *testing.T) { @@ -36,7 +37,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[pipeline.ID]consumer.Logs{pipeline.NewID(component.DataTypeLogs): consumertest.NewNop()}) return factory.CreateLogsToLogs(ctx, set, cfg, router) }, }, @@ -44,7 +45,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[pipeline.ID]consumer.Metrics{pipeline.NewID(component.DataTypeMetrics): consumertest.NewNop()}) return factory.CreateMetricsToMetrics(ctx, set, cfg, router) }, }, @@ -52,7 +53,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[pipeline.ID]consumer.Traces{pipeline.NewID(component.DataTypeTraces): consumertest.NewNop()}) return factory.CreateTracesToTraces(ctx, set, cfg, router) }, }, diff --git a/connector/forwardconnector/go.mod b/connector/forwardconnector/go.mod index ad2489afc17..341442a7ff9 100644 --- a/connector/forwardconnector/go.mod +++ b/connector/forwardconnector/go.mod @@ -9,6 +9,7 @@ require ( go.opentelemetry.io/collector/connector v0.102.1 go.opentelemetry.io/collector/consumer v0.102.1 go.opentelemetry.io/collector/pdata v1.9.0 + go.opentelemetry.io/collector/pipeline v0.102.1 go.uber.org/goleak v1.3.0 ) @@ -45,7 +46,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -75,3 +76,5 @@ retract ( ) replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/connector/forwardconnector/go.sum b/connector/forwardconnector/go.sum index ace4d10d26a..f8409145e25 100644 --- a/connector/forwardconnector/go.sum +++ b/connector/forwardconnector/go.sum @@ -95,8 +95,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/connector/go.mod b/connector/go.mod index c636056da7c..de6c24ae032 100644 --- a/connector/go.mod +++ b/connector/go.mod @@ -10,6 +10,7 @@ require ( go.opentelemetry.io/collector/consumer v0.102.1 go.opentelemetry.io/collector/pdata v1.9.0 go.opentelemetry.io/collector/pdata/testdata v0.102.1 + go.opentelemetry.io/collector/pipeline v0.102.1 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -38,7 +39,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect go.opentelemetry.io/otel/trace v1.27.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -61,3 +62,5 @@ replace go.opentelemetry.io/collector/featuregate => ../featuregate replace go.opentelemetry.io/collector/pdata => ../pdata replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata + +replace go.opentelemetry.io/collector/pipeline => ../pipeline diff --git a/connector/go.sum b/connector/go.sum index aaa6afbf77b..19e96b90dbe 100644 --- a/connector/go.sum +++ b/connector/go.sum @@ -83,8 +83,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/connector/logs_router.go b/connector/logs_router.go index 0db9ea7799d..21e9404f9fb 100644 --- a/connector/logs_router.go +++ b/connector/logs_router.go @@ -8,16 +8,16 @@ import ( "go.uber.org/multierr" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" ) // 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(...pipeline.ID) (consumer.Logs, error) + PipelineIDs() []pipeline.ID privateFunc() } @@ -26,7 +26,7 @@ type logsRouter struct { baseRouter[consumer.Logs] } -func NewLogsRouter(cm map[component.ID]consumer.Logs) LogsRouterAndConsumer { +func NewLogsRouter(cm map[pipeline.ID]consumer.Logs) LogsRouterAndConsumer { consumers := make([]consumer.Logs, 0, len(cm)) for _, cons := range cm { consumers = append(consumers, cons) @@ -37,15 +37,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() []pipeline.ID { + ids := make([]pipeline.ID, 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 ...pipeline.ID) (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..dcd56173223 100644 --- a/connector/logs_router_test.go +++ b/connector/logs_router_test.go @@ -16,6 +16,7 @@ import ( "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) type mutatingLogsSink struct { @@ -42,13 +43,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([]pipeline.ID, 0, numCons) allCons := make([]consumer.Logs, 0, numCons) - allConsMap := make(map[component.ID]consumer.Logs) + allConsMap := make(map[pipeline.ID]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, pipeline.NewIDWithName(component.DataTypeMetrics, 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 +64,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[pipeline.ID]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[pipeline.ID]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 +76,7 @@ func fuzzLogs(numIDs, numCons, numLogs int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]pipeline.ID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -108,16 +109,16 @@ func TestLogsRouterConsumers(t *testing.T) { ctx := context.Background() ld := testdata.GenerateLogs(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := pipeline.NewID(component.DataTypeLogs) + barID := pipeline.NewID(component.DataTypeMetrics) foo := new(consumertest.LogsSink) bar := new(consumertest.LogsSink) - r := NewLogsRouter(map[component.ID]consumer.Logs{fooID: foo, barID: bar}) + r := NewLogsRouter(map[pipeline.ID]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, []pipeline.ID{fooID, barID}, rcs) assert.Len(t, foo.AllLogs(), 0) assert.Len(t, bar.AllLogs(), 0) @@ -150,7 +151,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(pipeline.NewID(component.DataTypeTraces)) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/connector/metrics_router.go b/connector/metrics_router.go index 3e688261bfe..35f68eac2a4 100644 --- a/connector/metrics_router.go +++ b/connector/metrics_router.go @@ -4,16 +4,16 @@ package connector // import "go.opentelemetry.io/collector/connector" import ( - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" ) // 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(...pipeline.ID) (consumer.Metrics, error) + PipelineIDs() []pipeline.ID privateFunc() } @@ -22,7 +22,7 @@ type metricsRouter struct { baseRouter[consumer.Metrics] } -func NewMetricsRouter(cm map[component.ID]consumer.Metrics) MetricsRouterAndConsumer { +func NewMetricsRouter(cm map[pipeline.ID]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..ae4cb2c371a 100644 --- a/connector/metrics_router_test.go +++ b/connector/metrics_router_test.go @@ -16,6 +16,7 @@ import ( "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) type mutatingMetricsSink struct { @@ -31,6 +32,7 @@ func TestMetricsRouterMultiplexing(t *testing.T) { for numIDs := 1; numIDs < max; numIDs++ { for numCons := 1; numCons < max; numCons++ { for numMetrics := 1; numMetrics < max; numMetrics++ { + t.Run( fmt.Sprintf("%d-ids/%d-cons/%d-logs", numIDs, numCons, numMetrics), fuzzMetrics(numIDs, numCons, numMetrics), @@ -42,13 +44,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([]pipeline.ID, 0, numCons) allCons := make([]consumer.Metrics, 0, numCons) - allConsMap := make(map[component.ID]consumer.Metrics) + allConsMap := make(map[pipeline.ID]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, pipeline.NewIDWithName(component.DataTypeMetrics, 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 +65,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[pipeline.ID]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[pipeline.ID]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 +77,7 @@ func fuzzMetrics(numIDs, numCons, numMetrics int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]pipeline.ID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -108,16 +110,16 @@ func TestMetricsRouterConsumers(t *testing.T) { ctx := context.Background() md := testdata.GenerateMetrics(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := pipeline.NewID(component.DataTypeMetrics) + barID := pipeline.NewID(component.DataTypeTraces) foo := new(consumertest.MetricsSink) bar := new(consumertest.MetricsSink) - r := NewMetricsRouter(map[component.ID]consumer.Metrics{fooID: foo, barID: bar}) + r := NewMetricsRouter(map[pipeline.ID]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, []pipeline.ID{fooID, barID}, rcs) assert.Len(t, foo.AllMetrics(), 0) assert.Len(t, bar.AllMetrics(), 0) @@ -150,7 +152,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(pipeline.NewID(component.DataTypeLogs)) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/connector/router.go b/connector/router.go index bba7ee76bba..86b0fe5f874 100644 --- a/connector/router.go +++ b/connector/router.go @@ -8,31 +8,31 @@ import ( "go.uber.org/multierr" - "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) type baseRouter[T any] struct { fanout func([]T) T - consumers map[component.ID]T + consumers map[pipeline.ID]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[pipeline.ID]T) baseRouter[T] { + consumers := make(map[pipeline.ID]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() []pipeline.ID { + ids := make([]pipeline.ID, 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 ...pipeline.ID) (T, error) { var ret T if len(pipelineIDs) == 0 { return ret, fmt.Errorf("missing consumers") diff --git a/connector/traces_router.go b/connector/traces_router.go index 84eb889c05a..ec0a82d5474 100644 --- a/connector/traces_router.go +++ b/connector/traces_router.go @@ -4,16 +4,16 @@ package connector // import "go.opentelemetry.io/collector/connector" import ( - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" ) // 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(...pipeline.ID) (consumer.Traces, error) + PipelineIDs() []pipeline.ID privateFunc() } @@ -22,7 +22,7 @@ type tracesRouter struct { baseRouter[consumer.Traces] } -func NewTracesRouter(cm map[component.ID]consumer.Traces) TracesRouterAndConsumer { +func NewTracesRouter(cm map[pipeline.ID]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..c069dc1e1bd 100644 --- a/connector/traces_router_test.go +++ b/connector/traces_router_test.go @@ -16,6 +16,7 @@ import ( "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/ptrace" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) type mutatingTracesSink struct { @@ -42,13 +43,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([]pipeline.ID, 0, numCons) allCons := make([]consumer.Traces, 0, numCons) - allConsMap := make(map[component.ID]consumer.Traces) + allConsMap := make(map[pipeline.ID]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, pipeline.NewIDWithName(component.DataTypeTraces, 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 +64,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[pipeline.ID]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[pipeline.ID]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 +76,7 @@ func fuzzTraces(numIDs, numCons, numTraces int) func(*testing.T) { } // Convert to slice, update expectations - conIDs := make([]component.ID, 0, len(randCons)) + conIDs := make([]pipeline.ID, 0, len(randCons)) for id := range randCons { conIDs = append(conIDs, id) expected[id]++ @@ -108,16 +109,16 @@ func TestTracesRouterConsumer(t *testing.T) { ctx := context.Background() td := testdata.GenerateTraces(1) - fooID := component.MustNewID("foo") - barID := component.MustNewID("bar") + fooID := pipeline.NewID(component.DataTypeMetrics) + barID := pipeline.NewID(component.DataTypeLogs) foo := new(consumertest.TracesSink) bar := new(consumertest.TracesSink) - r := NewTracesRouter(map[component.ID]consumer.Traces{fooID: foo, barID: bar}) + r := NewTracesRouter(map[pipeline.ID]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, []pipeline.ID{fooID, barID}, rcs) assert.Len(t, foo.AllTraces(), 0) assert.Len(t, bar.AllTraces(), 0) @@ -150,7 +151,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(pipeline.NewID(component.DataTypeTraces)) assert.Nil(t, fake) assert.Error(t, err) } diff --git a/exporter/debugexporter/go.mod b/exporter/debugexporter/go.mod index bb18171ce89..55c071cd2fa 100644 --- a/exporter/debugexporter/go.mod +++ b/exporter/debugexporter/go.mod @@ -41,6 +41,7 @@ require ( go.opentelemetry.io/collector v0.102.1 // indirect go.opentelemetry.io/collector/config/configretry v0.102.1 // indirect go.opentelemetry.io/collector/extension v0.102.1 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/collector/receiver v0.102.1 // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect @@ -81,3 +82,5 @@ replace go.opentelemetry.io/collector/extension => ../../extension replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/exporter/go.mod b/exporter/go.mod index e015b48b82d..588918e942e 100644 --- a/exporter/go.mod +++ b/exporter/go.mod @@ -49,6 +49,7 @@ require ( github.com/prometheus/common v0.54.0 // indirect github.com/prometheus/procfs v0.15.0 // indirect go.opentelemetry.io/collector/confmap v0.102.1 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/text v0.15.0 // indirect @@ -80,3 +81,5 @@ retract v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module replace go.opentelemetry.io/collector/config/configretry => ../config/configretry replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../pipeline diff --git a/exporter/loggingexporter/go.mod b/exporter/loggingexporter/go.mod index 8a9989c35b7..f35e6ffca64 100644 --- a/exporter/loggingexporter/go.mod +++ b/exporter/loggingexporter/go.mod @@ -41,6 +41,7 @@ require ( go.opentelemetry.io/collector/config/configretry v0.102.1 // indirect go.opentelemetry.io/collector/consumer v0.102.1 // indirect go.opentelemetry.io/collector/extension v0.102.1 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/collector/receiver v0.102.1 // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect @@ -86,3 +87,5 @@ retract ( replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/exporter/nopexporter/go.mod b/exporter/nopexporter/go.mod index d9740d3d54c..935fa40e19b 100644 --- a/exporter/nopexporter/go.mod +++ b/exporter/nopexporter/go.mod @@ -76,3 +76,5 @@ replace go.opentelemetry.io/collector/confmap => ../../confmap replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/extension => ../../extension + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/exporter/otlpexporter/go.mod b/exporter/otlpexporter/go.mod index e60c40d1e3a..66e86b03923 100644 --- a/exporter/otlpexporter/go.mod +++ b/exporter/otlpexporter/go.mod @@ -59,6 +59,7 @@ require ( go.opentelemetry.io/collector/extension v0.102.1 // indirect go.opentelemetry.io/collector/extension/auth v0.102.1 // indirect go.opentelemetry.io/collector/featuregate v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/collector/receiver v0.102.1 // indirect go.opentelemetry.io/contrib/config v0.7.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect @@ -128,3 +129,5 @@ retract ( replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/exporter/otlphttpexporter/go.mod b/exporter/otlphttpexporter/go.mod index 166771069a2..61f28f0f9d8 100644 --- a/exporter/otlphttpexporter/go.mod +++ b/exporter/otlphttpexporter/go.mod @@ -58,6 +58,7 @@ require ( go.opentelemetry.io/collector/extension v0.102.1 // indirect go.opentelemetry.io/collector/extension/auth v0.102.1 // indirect go.opentelemetry.io/collector/featuregate v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/collector/receiver v0.102.1 // indirect go.opentelemetry.io/contrib/config v0.7.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect @@ -125,3 +126,5 @@ retract ( ) replace go.opentelemetry.io/collector/config/configretry => ../../config/configretry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/extension/auth/go.mod b/extension/auth/go.mod index fb61f5aed5b..51111c7a79c 100644 --- a/extension/auth/go.mod +++ b/extension/auth/go.mod @@ -31,6 +31,7 @@ require ( go.opentelemetry.io/collector/config/configtelemetry v0.102.1 // indirect go.opentelemetry.io/collector/confmap v0.102.1 // indirect go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect @@ -39,10 +40,10 @@ require ( go.opentelemetry.io/otel/trace v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -56,3 +57,5 @@ replace go.opentelemetry.io/collector/extension => ../ replace go.opentelemetry.io/collector/pdata => ../../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/extension/auth/go.sum b/extension/auth/go.sum index 000c077e9bc..8b06a611e09 100644 --- a/extension/auth/go.sum +++ b/extension/auth/go.sum @@ -74,20 +74,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -96,8 +96,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 h1:Q2RxlXqh1cgzzUgV261vBO2jI5R/3DD1J2pM0nI4NhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= diff --git a/extension/ballastextension/go.mod b/extension/ballastextension/go.mod index c0715c58028..7c1e602f218 100644 --- a/extension/ballastextension/go.mod +++ b/extension/ballastextension/go.mod @@ -41,6 +41,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.102.1 // indirect go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect @@ -49,7 +50,7 @@ require ( go.opentelemetry.io/otel/trace v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -79,3 +80,5 @@ retract ( replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/extension/ballastextension/go.sum b/extension/ballastextension/go.sum index 561e60dbea4..6c8b57d0c17 100644 --- a/extension/ballastextension/go.sum +++ b/extension/ballastextension/go.sum @@ -103,8 +103,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/extension/extension.go b/extension/extension.go index 8ee61a422cc..7badac31f51 100644 --- a/extension/extension.go +++ b/extension/extension.go @@ -9,6 +9,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/pipeline" ) // Extension is the interface for objects hosted by the OpenTelemetry Collector that @@ -59,7 +60,7 @@ type StatusWatcher interface { // Extensions that implement this interface must be ready that the ComponentStatusChanged // may be called before, after or concurrently with calls to Component.Start() and Component.Shutdown(). // The function may be called concurrently with itself. - ComponentStatusChanged(source *component.InstanceID, event *component.StatusEvent) + ComponentStatusChanged(source *pipeline.InstanceID, event *component.StatusEvent) } // CreateSettings is passed to Factory.Create(...) function. diff --git a/extension/extensiontest/statuswatcher_extension.go b/extension/extensiontest/statuswatcher_extension.go index a4d78f9033e..3477698b0a6 100644 --- a/extension/extensiontest/statuswatcher_extension.go +++ b/extension/extensiontest/statuswatcher_extension.go @@ -9,6 +9,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/pipeline" ) // NewStatusWatcherExtensionCreateSettings returns a new nop settings for Create*Extension functions. @@ -21,7 +22,7 @@ func NewStatusWatcherExtensionCreateSettings() extension.Settings { // NewStatusWatcherExtensionFactory returns a component.ExtensionFactory to construct a status watcher extension. func NewStatusWatcherExtensionFactory( - onStatusChanged func(source *component.InstanceID, event *component.StatusEvent), + onStatusChanged func(source *pipeline.InstanceID, event *component.StatusEvent), ) extension.Factory { return extension.NewFactory( component.MustNewType("statuswatcher"), @@ -39,9 +40,9 @@ func NewStatusWatcherExtensionFactory( type statusWatcherExtension struct { component.StartFunc component.ShutdownFunc - onStatusChanged func(source *component.InstanceID, event *component.StatusEvent) + onStatusChanged func(source *pipeline.InstanceID, event *component.StatusEvent) } -func (e statusWatcherExtension) ComponentStatusChanged(source *component.InstanceID, event *component.StatusEvent) { +func (e statusWatcherExtension) ComponentStatusChanged(source *pipeline.InstanceID, event *component.StatusEvent) { e.onStatusChanged(source, event) } diff --git a/extension/extensiontest/statuswatcher_extension_test.go b/extension/extensiontest/statuswatcher_extension_test.go index 14f9859e354..f54de7c403d 100644 --- a/extension/extensiontest/statuswatcher_extension_test.go +++ b/extension/extensiontest/statuswatcher_extension_test.go @@ -13,12 +13,13 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/pipeline" ) func TestStatusWatcherExtension(t *testing.T) { statusChanged := false factory := NewStatusWatcherExtensionFactory( - func(*component.InstanceID, *component.StatusEvent) { + func(*pipeline.InstanceID, *component.StatusEvent) { statusChanged = true }, ) @@ -32,7 +33,7 @@ func TestStatusWatcherExtension(t *testing.T) { assert.NoError(t, ext.Start(context.Background(), componenttest.NewNopHost())) assert.False(t, statusChanged) - ext.(extension.StatusWatcher).ComponentStatusChanged(&component.InstanceID{}, &component.StatusEvent{}) + ext.(extension.StatusWatcher).ComponentStatusChanged(&pipeline.InstanceID{}, &component.StatusEvent{}) assert.True(t, statusChanged) assert.NoError(t, ext.Shutdown(context.Background())) diff --git a/extension/go.mod b/extension/go.mod index a681c080970..163a973b2c6 100644 --- a/extension/go.mod +++ b/extension/go.mod @@ -7,6 +7,7 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.102.1 go.opentelemetry.io/collector/confmap v0.102.1 + go.opentelemetry.io/collector/pipeline v0.102.1 go.uber.org/goleak v1.3.0 ) @@ -38,10 +39,10 @@ require ( go.opentelemetry.io/otel/trace v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -54,3 +55,5 @@ replace go.opentelemetry.io/collector/confmap => ../confmap replace go.opentelemetry.io/collector/pdata => ../pdata replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../pipeline diff --git a/extension/go.sum b/extension/go.sum index 3ca262fb778..f55144304f8 100644 --- a/extension/go.sum +++ b/extension/go.sum @@ -76,20 +76,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -98,8 +98,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 h1:Q2RxlXqh1cgzzUgV261vBO2jI5R/3DD1J2pM0nI4NhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= diff --git a/extension/memorylimiterextension/go.mod b/extension/memorylimiterextension/go.mod index 2b68dbae290..210ef600b16 100644 --- a/extension/memorylimiterextension/go.mod +++ b/extension/memorylimiterextension/go.mod @@ -40,6 +40,7 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.102.1 // indirect go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect @@ -48,7 +49,7 @@ require ( go.opentelemetry.io/otel/trace v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -73,3 +74,5 @@ replace go.opentelemetry.io/collector/consumer => ../../consumer replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/extension/memorylimiterextension/go.sum b/extension/memorylimiterextension/go.sum index 561e60dbea4..6c8b57d0c17 100644 --- a/extension/memorylimiterextension/go.sum +++ b/extension/memorylimiterextension/go.sum @@ -103,8 +103,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/extension/zpagesextension/go.mod b/extension/zpagesextension/go.mod index f44f97d235f..ce7db1b6fae 100644 --- a/extension/zpagesextension/go.mod +++ b/extension/zpagesextension/go.mod @@ -39,6 +39,7 @@ require ( github.com/prometheus/procfs v0.15.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.102.1 // indirect go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/contrib/config v0.7.0 // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 // indirect @@ -54,7 +55,7 @@ require ( go.opentelemetry.io/proto/otlp v1.2.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect @@ -87,3 +88,5 @@ retract ( replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry replace go.opentelemetry.io/collector/pdata/testdata => ../../pdata/testdata + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/extension/zpagesextension/go.sum b/extension/zpagesextension/go.sum index 175064a2c97..50dd3b2668a 100644 --- a/extension/zpagesextension/go.sum +++ b/extension/zpagesextension/go.sum @@ -108,8 +108,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/go.mod b/go.mod index b4c6bab7f18..8542a450fcc 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/featuregate v1.9.0 go.opentelemetry.io/collector/pdata v1.9.0 go.opentelemetry.io/collector/pdata/testdata v0.102.1 + go.opentelemetry.io/collector/pipeline v0.102.1 go.opentelemetry.io/contrib/config v0.7.0 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 @@ -72,7 +73,7 @@ require ( go.opentelemetry.io/otel/trace v1.27.0 // indirect go.opentelemetry.io/proto/otlp v1.2.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect @@ -101,3 +102,5 @@ retract ( v0.57.0 // Release failed, use v0.57.2 v0.32.0 // Contains incomplete metrics transition to proto 0.9.0, random components are not working. ) + +replace go.opentelemetry.io/collector/pipeline => ./pipeline diff --git a/go.sum b/go.sum index 060e6a0293f..f0ee94fabc3 100644 --- a/go.sum +++ b/go.sum @@ -136,8 +136,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/internal/e2e/go.mod b/internal/e2e/go.mod index ae78f5fb268..971f2a9a1ee 100644 --- a/internal/e2e/go.mod +++ b/internal/e2e/go.mod @@ -62,6 +62,7 @@ require ( go.opentelemetry.io/collector/extension v0.102.1 // indirect go.opentelemetry.io/collector/extension/auth v0.102.1 // indirect go.opentelemetry.io/collector/featuregate v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/contrib/config v0.7.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect @@ -138,3 +139,5 @@ replace go.opentelemetry.io/collector/exporter => ../../exporter replace go.opentelemetry.io/collector/featuregate => ../../featuregate replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/internal/sharedcomponent/sharedcomponent_test.go b/internal/sharedcomponent/sharedcomponent_test.go index 77cda5124db..8ff88059ac7 100644 --- a/internal/sharedcomponent/sharedcomponent_test.go +++ b/internal/sharedcomponent/sharedcomponent_test.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/pipeline" ) var id = component.MustNewID("test") @@ -108,9 +109,9 @@ func TestSharedComponent(t *testing.T) { assert.Equal(t, 1, calledStop) } func TestSharedComponentsReportStatus(t *testing.T) { - reportedStatuses := make(map[*component.InstanceID][]component.Status) + reportedStatuses := make(map[*pipeline.InstanceID][]component.Status) newStatusFunc := func() func(*component.StatusEvent) { - instanceID := &component.InstanceID{} + instanceID := &pipeline.InstanceID{} return func(ev *component.StatusEvent) { if ev.Status() == component.StatusNone { return @@ -218,9 +219,9 @@ func TestReportStatusOnStartShutdown(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - reportedStatuses := make(map[*component.InstanceID][]component.Status) + reportedStatuses := make(map[*pipeline.InstanceID][]component.Status) newStatusFunc := func() func(*component.StatusEvent) { - instanceID := &component.InstanceID{} + instanceID := &pipeline.InstanceID{} return func(ev *component.StatusEvent) { reportedStatuses[instanceID] = append(reportedStatuses[instanceID], ev.Status()) } diff --git a/otelcol/collector_test.go b/otelcol/collector_test.go index 68eb3b54318..486f6e5930d 100644 --- a/otelcol/collector_test.go +++ b/otelcol/collector_test.go @@ -19,6 +19,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/extension/extensiontest" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor/processortest" ) @@ -142,9 +143,9 @@ func TestComponentStatusWatcher(t *testing.T) { factories.Processors[unhealthyProcessorFactory.Type()] = unhealthyProcessorFactory // Keep track of all status changes in a map. - changedComponents := map[*component.InstanceID][]component.Status{} + changedComponents := map[*pipeline.InstanceID][]component.Status{} var mux sync.Mutex - onStatusChanged := func(source *component.InstanceID, event *component.StatusEvent) { + onStatusChanged := func(source *pipeline.InstanceID, event *component.StatusEvent) { if source.ID.Type() != unhealthyProcessorFactory.Type() { return } diff --git a/otelcol/config_test.go b/otelcol/config_test.go index c1677c07220..f4c0b78be7f 100644 --- a/otelcol/config_test.go +++ b/otelcol/config_test.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service" "go.opentelemetry.io/collector/service/pipelines" "go.opentelemetry.io/collector/service/telemetry" @@ -98,7 +99,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[pipeline.NewID(component.DataTypeTraces)] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -108,7 +109,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[pipeline.NewID(component.DataTypeTraces)] pipe.Processors = append(pipe.Processors, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -118,7 +119,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[pipeline.NewID(component.DataTypeTraces)] pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg }, @@ -185,7 +186,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[pipeline.NewID(component.DataTypeTraces)] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg @@ -198,7 +199,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[pipeline.NewID(component.DataTypeTraces)] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "2")) pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "2")) return cfg @@ -209,7 +210,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[pipeline.NewID(component.DataTypeTraces)] pipe.Receivers = append(pipe.Receivers, component.MustNewIDWithName("nop", "conn2")) return cfg }, @@ -219,7 +220,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[pipeline.NewID(component.DataTypeTraces)] pipe.Exporters = append(pipe.Exporters, component.MustNewIDWithName("nop", "conn2")) return cfg }, @@ -280,7 +281,7 @@ func generateConfig() *Config { }, Extensions: []component.ID{component.MustNewID("nop")}, Pipelines: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, diff --git a/otelcol/go.mod b/otelcol/go.mod index 3c8640b770f..2f2898a8d47 100644 --- a/otelcol/go.mod +++ b/otelcol/go.mod @@ -18,6 +18,7 @@ require ( go.opentelemetry.io/collector/exporter v0.102.1 go.opentelemetry.io/collector/extension v0.102.1 go.opentelemetry.io/collector/featuregate v1.9.0 + go.opentelemetry.io/collector/pipeline v0.102.1 go.opentelemetry.io/collector/processor v0.102.1 go.opentelemetry.io/collector/receiver v0.102.1 go.opentelemetry.io/collector/service v0.102.1 @@ -144,3 +145,5 @@ replace go.opentelemetry.io/collector/featuregate => ../featuregate replace go.opentelemetry.io/collector/config/confignet => ../config/confignet replace go.opentelemetry.io/collector/config/configretry => ../config/configretry + +replace go.opentelemetry.io/collector/pipeline => ../pipeline diff --git a/otelcol/otelcoltest/config_test.go b/otelcol/otelcoltest/config_test.go index 71502de536e..3bf5310ca67 100644 --- a/otelcol/otelcoltest/config_test.go +++ b/otelcol/otelcoltest/config_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/pipelines" ) @@ -55,7 +56,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[pipeline.NewID(component.DataTypeTraces)], "Did not load pipeline config correctly") } diff --git a/pipeline/Makefile b/pipeline/Makefile new file mode 100644 index 00000000000..39734bfaebb --- /dev/null +++ b/pipeline/Makefile @@ -0,0 +1 @@ +include ../Makefile.Common diff --git a/pipeline/go.mod b/pipeline/go.mod new file mode 100644 index 00000000000..4e5f67f8f20 --- /dev/null +++ b/pipeline/go.mod @@ -0,0 +1,34 @@ +module go.opentelemetry.io/collector/pipeline + +go 1.21.0 + +require ( + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/collector/component v0.102.1 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.102.1 // indirect + go.opentelemetry.io/collector/pdata v1.9.0 // indirect + go.opentelemetry.io/otel v1.27.0 // indirect + go.opentelemetry.io/otel/metric v1.27.0 // indirect + go.opentelemetry.io/otel/trace v1.27.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect + google.golang.org/grpc v1.64.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +replace go.opentelemetry.io/collector/pdata => ../pdata + +replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry + +replace go.opentelemetry.io/collector/component => ../component diff --git a/pipeline/go.sum b/pipeline/go.sum new file mode 100644 index 00000000000..c89106d8e09 --- /dev/null +++ b/pipeline/go.sum @@ -0,0 +1,78 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= +go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= +go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 h1:Q2RxlXqh1cgzzUgV261vBO2jI5R/3DD1J2pM0nI4NhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pipeline/instance.go b/pipeline/instance.go new file mode 100644 index 00000000000..2b2a7c8b9b4 --- /dev/null +++ b/pipeline/instance.go @@ -0,0 +1,13 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package pipeline + +import "go.opentelemetry.io/collector/component" + +// InstanceID uniquely identifies a component instance +type InstanceID struct { + ID component.ID + Kind component.Kind + PipelineIDs map[ID]struct{} +} diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go new file mode 100644 index 00000000000..b151faace01 --- /dev/null +++ b/pipeline/pipeline.go @@ -0,0 +1,88 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package pipeline // import "go.opentelemetry.io/collector/pipeline" + +import ( + "errors" + "fmt" + "strings" + + "go.opentelemetry.io/collector/component" +) + +type ID struct { + typeVal component.DataType + nameVal string +} + +// Type returns the type of the component. +func (id ID) Type() component.DataType { + return id.typeVal +} + +// Name returns the custom name of the component. +func (id ID) Name() string { + return id.nameVal +} + +// NewID returns a new ID with the given DataType and empty name. +func NewID(typeVal component.DataType) ID { + return ID{typeVal: typeVal} +} + +// NewIDWithName returns a new ID with the given DataType and name. +func NewIDWithName(typeVal component.DataType, nameVal string) ID { + return ID{typeVal: typeVal, nameVal: nameVal} +} + +// MarshalText implements the encoding.TextMarshaler interface. +// This marshals the type and name as one string in the config. +func (id ID) MarshalText() (text []byte, err error) { + return []byte(id.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +func (id *ID) UnmarshalText(text []byte) error { + idStr := string(text) + items := strings.SplitN(idStr, component.TypeAndNameSeparator, 2) + var typeStr, nameStr string + if len(items) >= 1 { + typeStr = strings.TrimSpace(items[0]) + } + + if len(items) == 1 && typeStr == "" { + return errors.New("id must not be empty") + } + + if typeStr == "" { + return fmt.Errorf("in %q id: the part before %s should not be empty", idStr, component.TypeAndNameSeparator) + } + + 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", idStr, component.TypeAndNameSeparator) + } + } + + var err error + var dt component.DataType + if err = dt.UnmarshalText([]byte(typeStr)); err != nil { + return fmt.Errorf("in %q id: %w", idStr, err) + } + id.typeVal = dt + id.nameVal = nameStr + + return nil +} + +// String returns the ID string representation as "type[/name]" format. +func (id ID) String() string { + if id.nameVal == "" { + return id.typeVal.String() + } + + return id.typeVal.String() + component.TypeAndNameSeparator + id.nameVal +} diff --git a/pipeline/pipeline_test.go b/pipeline/pipeline_test.go new file mode 100644 index 00000000000..8b7323c8004 --- /dev/null +++ b/pipeline/pipeline_test.go @@ -0,0 +1,82 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package pipeline + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/collector/component" +) + +func TestNewPipelineID(t *testing.T) { + id := NewID(component.DataTypeMetrics) + assert.Equal(t, "", id.nameVal) +} + +func TestPipelineIDMarshalText(t *testing.T) { + id := NewIDWithName(component.DataTypeMetrics, "name") + got, err := id.MarshalText() + assert.NoError(t, err) + assert.Equal(t, id.String(), string(got)) +} + +func TestPipelineIDUnmarshalText(t *testing.T) { + var testCases = []struct { + idStr string + expectedErr bool + expectedID ID + }{ + { + idStr: "metrics", + expectedID: ID{typeVal: component.DataTypeMetrics, nameVal: ""}, + }, + { + idStr: "logs/valid_name", + expectedID: ID{typeVal: component.DataTypeLogs, nameVal: "valid_name"}, + }, + { + idStr: " traces / valid_name ", + expectedID: ID{typeVal: component.DataTypeTraces, nameVal: "valid_name"}, + }, + { + idStr: "/valid_name", + expectedErr: true, + }, + { + idStr: " /valid_name", + expectedErr: true, + }, + { + idStr: "valid_type/", + expectedErr: true, + }, + { + idStr: "valid_type/ ", + expectedErr: true, + }, + { + idStr: " ", + expectedErr: true, + }, + } + + for _, test := range testCases { + t.Run(test.idStr, func(t *testing.T) { + id := ID{} + err := id.UnmarshalText([]byte(test.idStr)) + if test.expectedErr { + assert.Error(t, err) + return + } + + assert.NoError(t, err) + assert.Equal(t, test.expectedID, id) + assert.Equal(t, test.expectedID.Type(), id.Type()) + assert.Equal(t, test.expectedID.Name(), id.Name()) + assert.Equal(t, test.expectedID.String(), id.String()) + }) + } +} diff --git a/processor/batchprocessor/go.mod b/processor/batchprocessor/go.mod index d64b1e53b17..fa0f0bb5667 100644 --- a/processor/batchprocessor/go.mod +++ b/processor/batchprocessor/go.mod @@ -46,7 +46,7 @@ require ( go.opentelemetry.io/otel/sdk v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -76,3 +76,5 @@ retract ( ) replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/processor/batchprocessor/go.sum b/processor/batchprocessor/go.sum index ace4d10d26a..f8409145e25 100644 --- a/processor/batchprocessor/go.sum +++ b/processor/batchprocessor/go.sum @@ -95,8 +95,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/processor/go.mod b/processor/go.mod index eb908c75d49..2b79f718d90 100644 --- a/processor/go.mod +++ b/processor/go.mod @@ -38,7 +38,7 @@ require ( go.opentelemetry.io/otel/sdk v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -61,3 +61,5 @@ replace go.opentelemetry.io/collector/pdata => ../pdata replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../pipeline diff --git a/processor/go.sum b/processor/go.sum index aaa6afbf77b..19e96b90dbe 100644 --- a/processor/go.sum +++ b/processor/go.sum @@ -83,8 +83,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/processor/memorylimiterprocessor/go.mod b/processor/memorylimiterprocessor/go.mod index aa890028df6..dfbb34aae1b 100644 --- a/processor/memorylimiterprocessor/go.mod +++ b/processor/memorylimiterprocessor/go.mod @@ -53,7 +53,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -83,3 +83,5 @@ retract ( ) replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/processor/memorylimiterprocessor/go.sum b/processor/memorylimiterprocessor/go.sum index 721c7422dea..93477b212e6 100644 --- a/processor/memorylimiterprocessor/go.sum +++ b/processor/memorylimiterprocessor/go.sum @@ -114,8 +114,8 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/receiver/go.mod b/receiver/go.mod index e40ddd8725b..4520e16202e 100644 --- a/receiver/go.mod +++ b/receiver/go.mod @@ -37,7 +37,7 @@ require ( github.com/prometheus/procfs v0.15.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -62,3 +62,5 @@ replace go.opentelemetry.io/collector/pdata/testdata => ../pdata/testdata retract v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry + +replace go.opentelemetry.io/collector/pipeline => ../pipeline diff --git a/receiver/go.sum b/receiver/go.sum index aaa6afbf77b..19e96b90dbe 100644 --- a/receiver/go.sum +++ b/receiver/go.sum @@ -83,8 +83,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/receiver/nopreceiver/go.mod b/receiver/nopreceiver/go.mod index 12792d8f460..ad750a08721 100644 --- a/receiver/nopreceiver/go.mod +++ b/receiver/nopreceiver/go.mod @@ -44,7 +44,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect @@ -69,3 +69,5 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con replace go.opentelemetry.io/collector => ../.. replace go.opentelemetry.io/collector/featuregate => ../../featuregate + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/receiver/nopreceiver/go.sum b/receiver/nopreceiver/go.sum index ace4d10d26a..f8409145e25 100644 --- a/receiver/nopreceiver/go.sum +++ b/receiver/nopreceiver/go.sum @@ -95,8 +95,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= diff --git a/receiver/otlpreceiver/go.mod b/receiver/otlpreceiver/go.mod index 3a2e0a11d83..f8d8679124b 100644 --- a/receiver/otlpreceiver/go.mod +++ b/receiver/otlpreceiver/go.mod @@ -61,6 +61,7 @@ require ( go.opentelemetry.io/collector/extension v0.102.1 // indirect go.opentelemetry.io/collector/extension/auth v0.102.1 // indirect go.opentelemetry.io/collector/featuregate v1.9.0 // indirect + go.opentelemetry.io/collector/pipeline v0.102.1 // indirect go.opentelemetry.io/contrib/config v0.7.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect @@ -128,3 +129,5 @@ retract ( v0.76.0 // Depends on retracted pdata v1.0.0-rc10 module, use v0.76.1 v0.69.0 // Release failed, use v0.69.1 ) + +replace go.opentelemetry.io/collector/pipeline => ../../pipeline diff --git a/service/config_test.go b/service/config_test.go index 6ac9d6e625a..745f9fc952b 100644 --- a/service/config_test.go +++ b/service/config_test.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/extensions" "go.opentelemetry.io/collector/service/pipelines" "go.opentelemetry.io/collector/service/telemetry" @@ -42,7 +43,7 @@ func TestConfigValidate(t *testing.T) { name: "duplicate-processor-reference", cfgFn: func() *Config { cfg := generateConfig() - pipe := cfg.Pipelines[component.MustNewID("traces")] + pipe := cfg.Pipelines[pipeline.NewID(component.DataTypeTraces)] pipe.Processors = append(pipe.Processors, pipe.Processors...) return cfg }, @@ -52,7 +53,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[pipeline.NewID("wrongtype")] = &pipelines.PipelineConfig{ Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -101,7 +102,7 @@ func generateConfig() *Config { }, Extensions: extensions.Config{component.MustNewID("nop")}, Pipelines: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, diff --git a/service/extensions/extensions.go b/service/extensions/extensions.go index c8f632965ca..2fff134193e 100644 --- a/service/extensions/extensions.go +++ b/service/extensions/extensions.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/internal/components" "go.opentelemetry.io/collector/service/internal/servicetelemetry" "go.opentelemetry.io/collector/service/internal/zpages" @@ -25,7 +26,7 @@ const zExtensionName = "zextensionname" type Extensions struct { telemetry servicetelemetry.TelemetrySettings extMap map[component.ID]extension.Extension - instanceIDs map[component.ID]*component.InstanceID + instanceIDs map[component.ID]*pipeline.InstanceID extensionIDs []component.ID // start order (and reverse stop order) } @@ -118,7 +119,7 @@ func (bes *Extensions) NotifyConfig(ctx context.Context, conf *confmap.Conf) err return errs } -func (bes *Extensions) NotifyComponentStatusChange(source *component.InstanceID, event *component.StatusEvent) { +func (bes *Extensions) NotifyComponentStatusChange(source *pipeline.InstanceID, event *component.StatusEvent) { for _, extID := range bes.extensionIDs { ext := bes.extMap[extID] if sw, ok := ext.(extension.StatusWatcher); ok { @@ -175,11 +176,11 @@ func New(ctx context.Context, set Settings, cfg Config) (*Extensions, error) { exts := &Extensions{ telemetry: set.Telemetry, extMap: make(map[component.ID]extension.Extension), - instanceIDs: make(map[component.ID]*component.InstanceID), + instanceIDs: make(map[component.ID]*pipeline.InstanceID), extensionIDs: make([]component.ID, 0, len(cfg)), } for _, extID := range cfg { - instanceID := &component.InstanceID{ + instanceID := &pipeline.InstanceID{ ID: extID, Kind: component.KindExtension, } diff --git a/service/extensions/extensions_test.go b/service/extensions/extensions_test.go index d519132d3f3..43a0ebd98da 100644 --- a/service/extensions/extensions_test.go +++ b/service/extensions/extensions_test.go @@ -16,6 +16,7 @@ import ( "go.opentelemetry.io/collector/confmap" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/extension/extensiontest" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/internal/servicetelemetry" "go.opentelemetry.io/collector/service/internal/status" ) @@ -433,7 +434,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { assert.NoError(t, err) var actualStatuses []*component.StatusEvent - rep := status.NewReporter(func(_ *component.InstanceID, ev *component.StatusEvent) { + rep := status.NewReporter(func(_ *pipeline.InstanceID, ev *component.StatusEvent) { actualStatuses = append(actualStatuses, ev) }, func(err error) { require.NoError(t, err) diff --git a/service/go.mod b/service/go.mod index 5ff0699bb63..025f297f707 100644 --- a/service/go.mod +++ b/service/go.mod @@ -23,6 +23,7 @@ require ( go.opentelemetry.io/collector/featuregate v1.9.0 go.opentelemetry.io/collector/pdata v1.9.0 go.opentelemetry.io/collector/pdata/testdata v0.102.1 + go.opentelemetry.io/collector/pipeline v0.102.1 go.opentelemetry.io/collector/processor v0.102.1 go.opentelemetry.io/collector/receiver v0.102.1 go.opentelemetry.io/collector/semconv v0.102.1 @@ -122,3 +123,5 @@ replace go.opentelemetry.io/collector/featuregate => ../featuregate replace go.opentelemetry.io/collector/config/confignet => ../config/confignet replace go.opentelemetry.io/collector/config/configretry => ../config/configretry + +replace go.opentelemetry.io/collector/pipeline => ../pipeline diff --git a/service/host.go b/service/host.go index ce8dc530d40..e462a6366db 100644 --- a/service/host.go +++ b/service/host.go @@ -8,6 +8,7 @@ import ( "go.opentelemetry.io/collector/connector" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/service/extensions" @@ -66,7 +67,7 @@ func (host *serviceHost) GetExporters() map[component.DataType]map[component.ID] return host.pipelines.GetExporters() } -func (host *serviceHost) notifyComponentStatusChange(source *component.InstanceID, event *component.StatusEvent) { +func (host *serviceHost) notifyComponentStatusChange(source *pipeline.InstanceID, event *component.StatusEvent) { host.serviceExtensions.NotifyComponentStatusChange(source, event) if event.Status() == component.StatusFatalError { host.asyncErrorChannel <- event.Err() diff --git a/service/internal/components/loggers.go b/service/internal/components/loggers.go index f4178977b2d..c473cc41984 100644 --- a/service/internal/components/loggers.go +++ b/service/internal/components/loggers.go @@ -9,6 +9,7 @@ import ( "go.uber.org/zap" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) const ( @@ -28,7 +29,7 @@ func ReceiverLogger(logger *zap.Logger, id component.ID, dt component.DataType) 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 pipeline.ID) *zap.Logger { return logger.With( zap.String(zapKindKey, strings.ToLower(component.KindProcessor.String())), zap.String(zapNameKey, id.String()), diff --git a/service/internal/graph/graph.go b/service/internal/graph/graph.go index c95d1f54b7e..6273895ad89 100644 --- a/service/internal/graph/graph.go +++ b/service/internal/graph/graph.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/service/internal/capabilityconsumer" @@ -54,10 +55,10 @@ 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[pipeline.ID]*pipelineNodes // Keep track of status source per node - instanceIDs map[int64]*component.InstanceID + instanceIDs map[int64]*pipeline.InstanceID telemetry servicetelemetry.TelemetrySettings } @@ -67,8 +68,8 @@ 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)), - instanceIDs: make(map[int64]*component.InstanceID), + pipelines: make(map[pipeline.ID]*pipelineNodes, len(set.PipelineConfigs)), + instanceIDs: make(map[int64]*pipeline.InstanceID), telemetry: set.Telemetry, } for pipelineID := range set.PipelineConfigs { @@ -90,9 +91,9 @@ func (g *Graph) createNodes(set Settings) error { // Build a list of all connectors for easy reference. 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) + // Keep track of connectors and where they are used. (map[connectorID][]pipelineID) + connectorsAsExporter := make(map[component.ID][]pipeline.ID) + connectorsAsReceiver := make(map[component.ID][]pipeline.ID) // Build each pipelineNodes struct for each pipeline by parsing the pipelineCfg. // Also populates the connectors, connectorsAsExporter and connectorsAsReceiver maps. @@ -190,54 +191,54 @@ func (g *Graph) createNodes(set Settings) error { return nil } -func (g *Graph) createReceiver(pipelineID, recvID component.ID) *receiverNode { +func (g *Graph) createReceiver(pipelineID pipeline.ID, recvID component.ID) *receiverNode { rcvrNode := newReceiverNode(pipelineID.Type(), recvID) if node := g.componentGraph.Node(rcvrNode.ID()); node != nil { g.instanceIDs[node.ID()].PipelineIDs[pipelineID] = struct{}{} return node.(*receiverNode) } g.componentGraph.AddNode(rcvrNode) - g.instanceIDs[rcvrNode.ID()] = &component.InstanceID{ + g.instanceIDs[rcvrNode.ID()] = &pipeline.InstanceID{ ID: recvID, Kind: component.KindReceiver, - PipelineIDs: map[component.ID]struct{}{ + PipelineIDs: map[pipeline.ID]struct{}{ pipelineID: {}, }, } return rcvrNode } -func (g *Graph) createProcessor(pipelineID, procID component.ID) *processorNode { +func (g *Graph) createProcessor(pipelineID pipeline.ID, procID component.ID) *processorNode { procNode := newProcessorNode(pipelineID, procID) g.componentGraph.AddNode(procNode) - g.instanceIDs[procNode.ID()] = &component.InstanceID{ + g.instanceIDs[procNode.ID()] = &pipeline.InstanceID{ ID: procID, Kind: component.KindProcessor, - PipelineIDs: map[component.ID]struct{}{ + PipelineIDs: map[pipeline.ID]struct{}{ pipelineID: {}, }, } return procNode } -func (g *Graph) createExporter(pipelineID, exprID component.ID) *exporterNode { +func (g *Graph) createExporter(pipelineID pipeline.ID, exprID component.ID) *exporterNode { expNode := newExporterNode(pipelineID.Type(), exprID) if node := g.componentGraph.Node(expNode.ID()); node != nil { g.instanceIDs[expNode.ID()].PipelineIDs[pipelineID] = struct{}{} return node.(*exporterNode) } g.componentGraph.AddNode(expNode) - g.instanceIDs[expNode.ID()] = &component.InstanceID{ + g.instanceIDs[expNode.ID()] = &pipeline.InstanceID{ ID: expNode.componentID, Kind: component.KindExporter, - PipelineIDs: map[component.ID]struct{}{ + PipelineIDs: map[pipeline.ID]struct{}{ pipelineID: {}, }, } return expNode } -func (g *Graph) createConnector(exprPipelineID, rcvrPipelineID, connID component.ID) *connectorNode { +func (g *Graph) createConnector(exprPipelineID, rcvrPipelineID pipeline.ID, connID component.ID) *connectorNode { connNode := newConnectorNode(exprPipelineID.Type(), rcvrPipelineID.Type(), connID) if node := g.componentGraph.Node(connNode.ID()); node != nil { instanceID := g.instanceIDs[connNode.ID()] @@ -246,10 +247,10 @@ func (g *Graph) createConnector(exprPipelineID, rcvrPipelineID, connID component return node.(*connectorNode) } g.componentGraph.AddNode(connNode) - g.instanceIDs[connNode.ID()] = &component.InstanceID{ + g.instanceIDs[connNode.ID()] = &pipeline.InstanceID{ ID: connNode.componentID, Kind: component.KindConnector, - PipelineIDs: map[component.ID]struct{}{ + PipelineIDs: map[pipeline.ID]struct{}{ exprPipelineID: {}, rcvrPipelineID: {}, }, @@ -537,7 +538,7 @@ 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.DataType) component.StabilityLevel { switch expType { case component.DataTypeTraces: switch recType { diff --git a/service/internal/graph/graph_test.go b/service/internal/graph/graph_test.go index 575f93cab89..36c5d075484 100644 --- a/service/internal/graph/graph_test.go +++ b/service/internal/graph/graph_test.go @@ -24,6 +24,7 @@ import ( "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exportertest" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processortest" "go.opentelemetry.io/collector/receiver" @@ -145,12 +146,12 @@ func TestGraphStartStop(t *testing.T) { pg := &Graph{componentGraph: simple.NewDirectedGraph()} pg.telemetry = servicetelemetry.NewNopTelemetrySettings() - pg.instanceIDs = make(map[int64]*component.InstanceID) + pg.instanceIDs = make(map[int64]*pipeline.InstanceID) for _, edge := range tt.edges { f, t := &testNode{id: edge[0]}, &testNode{id: edge[1]} - pg.instanceIDs[f.ID()] = &component.InstanceID{} - pg.instanceIDs[t.ID()] = &component.InstanceID{} + pg.instanceIDs[f.ID()] = &pipeline.InstanceID{} + pg.instanceIDs[t.ID()] = &pipeline.InstanceID{} pg.componentGraph.SetEdge(simple.Edge{F: f, T: t}) } @@ -176,7 +177,7 @@ func TestGraphStartStopCycle(t *testing.T) { c1 := &testNode{id: component.MustNewIDWithName("c", "1")} e1 := &testNode{id: component.MustNewIDWithName("e", "1")} - pg.instanceIDs = map[int64]*component.InstanceID{ + pg.instanceIDs = map[int64]*pipeline.InstanceID{ r1.ID(): {}, p1.ID(): {}, c1.ID(): {}, @@ -208,7 +209,7 @@ func TestGraphStartStopComponentError(t *testing.T) { id: component.MustNewIDWithName("e", "1"), shutdownErr: errors.New("bar"), } - pg.instanceIDs = map[int64]*component.InstanceID{ + pg.instanceIDs = map[int64]*pipeline.InstanceID{ r1.ID(): {}, e1.ID(): {}, } @@ -229,17 +230,17 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_simple.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -250,17 +251,17 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_simple_mutate.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -271,17 +272,17 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_simple_multi_proc.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { 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"): { + pipeline.NewID(component.DataTypeMetrics): { 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"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor"), component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -292,15 +293,15 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_simple_no_proc.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -310,17 +311,17 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_multi.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { 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"): { + pipeline.NewID(component.DataTypeMetrics): { 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"): { + pipeline.NewID(component.DataTypeLogs): { 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")}, @@ -331,15 +332,15 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_multi_no_proc.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("examplereceiver"), component.MustNewIDWithName("examplereceiver", "1")}, Exporters: []component.ID{component.MustNewID("exampleexporter"), component.MustNewIDWithName("exampleexporter", "1")}, }, @@ -349,30 +350,30 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "multi_pipeline_receivers_and_exporters.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("traces", "1"): { + pipeline.NewIDWithName(component.DataTypeTraces, "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "1"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewIDWithName("exampleprocessor", "mutate")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "1"): { + pipeline.NewIDWithName(component.DataTypeLogs, "1"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -382,12 +383,12 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_simple_traces.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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")}, @@ -398,12 +399,12 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_simple_metrics.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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")}, @@ -414,12 +415,12 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_simple_logs.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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")}, @@ -430,22 +431,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_fork_merge_traces.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -456,22 +457,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_fork_merge_metrics.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -482,22 +483,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_fork_merge_logs.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "out"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "merge")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -508,17 +509,17 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_translate_from_traces.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -529,17 +530,17 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_translate_from_metrics.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -550,17 +551,17 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_translate_from_logs.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleconnector")}, }, - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("exampleconnector")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -571,32 +572,32 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_matrix.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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")}, @@ -607,27 +608,27 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_lanes.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, - component.MustNewIDWithName("logs", "in"): { + pipeline.NewIDWithName(component.DataTypeLogs, "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.NewIDWithName(component.DataTypeLogs, "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, }, @@ -637,22 +638,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_mutate_traces.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -663,22 +664,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_mutate_metrics.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -689,22 +690,22 @@ func TestConnectorPipelinesGraph(t *testing.T) { { name: "pipelines_conn_mutate_logs.yaml", pipelineConfigs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "out1"): { Receivers: []component.ID{component.MustNewIDWithName("exampleconnector", "mutate")}, Processors: []component.ID{component.MustNewID("exampleprocessor")}, Exporters: []component.ID{component.MustNewID("exampleexporter")}, @@ -770,7 +771,7 @@ func TestConnectorPipelinesGraph(t *testing.T) { assert.NoError(t, pg.StartAll(context.Background(), componenttest.NewNopHost())) - mutatingPipelines := make(map[component.ID]bool, len(test.pipelineConfigs)) + mutatingPipelines := make(map[pipeline.ID]bool, len(test.pipelineConfigs)) // Check each pipeline individually, ensuring that all components are started // and that they have observed no signals yet. @@ -991,17 +992,17 @@ 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 := pipeline.NewIDWithName(component.DataTypeTraces, "in") + tracesRightID := pipeline.NewIDWithName(component.DataTypeTraces, "right") + tracesLeftID := pipeline.NewIDWithName(component.DataTypeTraces, "left") - metricsInID := component.MustNewIDWithName("metrics", "in") - metricsRightID := component.MustNewIDWithName("metrics", "right") - metricsLeftID := component.MustNewIDWithName("metrics", "left") + metricsInID := pipeline.NewIDWithName(component.DataTypeMetrics, "in") + metricsRightID := pipeline.NewIDWithName(component.DataTypeMetrics, "right") + metricsLeftID := pipeline.NewIDWithName(component.DataTypeMetrics, "left") - logsInID := component.MustNewIDWithName("logs", "in") - logsRightID := component.MustNewIDWithName("logs", "right") - logsLeftID := component.MustNewIDWithName("logs", "left") + logsInID := pipeline.NewIDWithName(component.DataTypeLogs, "in") + logsRightID := pipeline.NewIDWithName(component.DataTypeLogs, "right") + logsLeftID := pipeline.NewIDWithName(component.DataTypeLogs, "left") ctx := context.Background() set := Settings{ @@ -1194,7 +1195,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1210,7 +1211,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1226,7 +1227,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): badExporterFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, @@ -1245,7 +1246,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1265,7 +1266,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1285,7 +1286,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1302,7 +1303,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1318,7 +1319,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1334,7 +1335,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1353,11 +1354,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1376,11 +1377,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1399,11 +1400,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.NewIDWithName(component.DataTypeLogs, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1422,11 +1423,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1445,11 +1446,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1468,11 +1469,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.NewIDWithName(component.DataTypeLogs, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1491,11 +1492,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipeline.NewIDWithName(component.DataTypeLogs, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1514,11 +1515,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipeline.NewIDWithName(component.DataTypeLogs, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1537,11 +1538,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("bf"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipeline.NewIDWithName(component.DataTypeLogs, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("bf")}, }, - component.MustNewIDWithName("logs", "out"): { + pipeline.NewIDWithName(component.DataTypeLogs, "out"): { Receivers: []component.ID{component.MustNewID("bf")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1560,7 +1561,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, @@ -1579,7 +1580,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "out"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1598,15 +1599,15 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("mockforward"): mfConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, @@ -1625,15 +1626,15 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("mockforward"): mfConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("mockforward")}, }, - component.MustNewIDWithName("metrics", "out"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewID("mockforward")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -1655,7 +1656,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -1681,7 +1682,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -1707,7 +1708,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, @@ -1735,22 +1736,22 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("traces", "1"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1780,22 +1781,22 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("metrics", "in"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("metrics", "1"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1825,22 +1826,22 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "conn2"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("logs", "in"): { + pipeline.NewIDWithName(component.DataTypeLogs, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "conn")}, }, - component.MustNewIDWithName("logs", "1"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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"): { + pipeline.NewIDWithName(component.DataTypeLogs, "out"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "conn2")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1871,37 +1872,37 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewIDWithName("nop", "rawlog"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewIDWithName("nop", "fork")}, }, - component.MustNewIDWithName("traces", "copy1"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeTraces, "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"): { + pipeline.NewIDWithName(component.DataTypeMetrics, "count"): { Receivers: []component.ID{component.MustNewIDWithName("nop", "count")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, }, - component.MustNewIDWithName("logs", "raw"): { + pipeline.NewIDWithName(component.DataTypeLogs, "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" @@ -1925,7 +1926,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, }, @@ -1941,7 +1942,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("unknown"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("unknown")}, }, @@ -1960,7 +1961,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1980,7 +1981,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -1997,7 +1998,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("nop", "1")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2013,7 +2014,7 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("nop"): nopReceiverFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2032,11 +2033,11 @@ func TestGraphBuildErrors(t *testing.T) { component.MustNewID("unknown"): nopConnectorFactory.CreateDefaultConfig(), }, pipelineCfgs: pipelines.Config{ - component.MustNewIDWithName("traces", "in"): { + pipeline.NewIDWithName(component.DataTypeTraces, "in"): { Receivers: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("unknown")}, }, - component.MustNewIDWithName("traces", "out"): { + pipeline.NewIDWithName(component.DataTypeTraces, "out"): { Receivers: []component.ID{component.MustNewID("unknown")}, Exporters: []component.ID{component.MustNewID("nop")}, }, @@ -2140,7 +2141,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { for _, dt := range dataTypes { t.Run(dt.String()+"/receiver", func(t *testing.T) { set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + pipeline.NewID(dt): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2154,7 +2155,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { t.Run(dt.String()+"/processor", func(t *testing.T) { set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + pipeline.NewID(dt): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2168,7 +2169,7 @@ func TestGraphFailToStartAndShutdown(t *testing.T) { t.Run(dt.String()+"/exporter", func(t *testing.T) { set.PipelineConfigs = pipelines.Config{ - component.NewID(dt): { + pipeline.NewID(dt): { Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop"), component.MustNewID("err")}, @@ -2183,12 +2184,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"): { + pipeline.NewIDWithName(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"): { + pipeline.NewIDWithName(dt2, "out"): { Receivers: []component.ID{component.MustNewID("nop"), component.MustNewIDWithName("err", "conn")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -2213,7 +2214,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { eStErr := &testNode{id: component.MustNewIDWithName("e_st_err", "1"), startErr: assert.AnError} eSdErr := &testNode{id: component.MustNewIDWithName("e_sd_err", "1"), shutdownErr: assert.AnError} - instanceIDs := map[*testNode]*component.InstanceID{ + instanceIDs := map[*testNode]*pipeline.InstanceID{ rNoErr: {ID: rNoErr.id}, rStErr: {ID: rStErr.id}, rSdErr: {ID: rSdErr.id}, @@ -2223,7 +2224,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { } // compare two maps of status events ignoring timestamp - assertEqualStatuses := func(t *testing.T, evMap1, evMap2 map[*component.InstanceID][]*component.StatusEvent) { + assertEqualStatuses := func(t *testing.T, evMap1, evMap2 map[*pipeline.InstanceID][]*component.StatusEvent) { assert.Equal(t, len(evMap1), len(evMap2)) for id, evts1 := range evMap1 { evts2 := evMap2[id] @@ -2241,14 +2242,14 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { for _, tc := range []struct { name string edge [2]*testNode - expectedStatuses map[*component.InstanceID][]*component.StatusEvent + expectedStatuses map[*pipeline.InstanceID][]*component.StatusEvent startupErr error shutdownErr error }{ { name: "successful startup/shutdown", edge: [2]*testNode{rNoErr, eNoErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*pipeline.InstanceID][]*component.StatusEvent{ instanceIDs[rNoErr]: { component.NewStatusEvent(component.StatusStarting), component.NewStatusEvent(component.StatusOK), @@ -2266,7 +2267,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { { name: "early startup error", edge: [2]*testNode{rNoErr, eStErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*pipeline.InstanceID][]*component.StatusEvent{ instanceIDs[eStErr]: { component.NewStatusEvent(component.StatusStarting), component.NewPermanentErrorEvent(assert.AnError), @@ -2277,7 +2278,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { { name: "late startup error", edge: [2]*testNode{rStErr, eNoErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*pipeline.InstanceID][]*component.StatusEvent{ instanceIDs[rStErr]: { component.NewStatusEvent(component.StatusStarting), component.NewPermanentErrorEvent(assert.AnError), @@ -2294,7 +2295,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { { name: "early shutdown error", edge: [2]*testNode{rSdErr, eNoErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*pipeline.InstanceID][]*component.StatusEvent{ instanceIDs[rSdErr]: { component.NewStatusEvent(component.StatusStarting), component.NewStatusEvent(component.StatusOK), @@ -2313,7 +2314,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { { name: "late shutdown error", edge: [2]*testNode{rNoErr, eSdErr}, - expectedStatuses: map[*component.InstanceID][]*component.StatusEvent{ + expectedStatuses: map[*pipeline.InstanceID][]*component.StatusEvent{ instanceIDs[rNoErr]: { component.NewStatusEvent(component.StatusStarting), component.NewStatusEvent(component.StatusOK), @@ -2334,8 +2335,8 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { pg := &Graph{componentGraph: simple.NewDirectedGraph()} pg.telemetry = servicetelemetry.NewNopTelemetrySettings() - actualStatuses := make(map[*component.InstanceID][]*component.StatusEvent) - rep := status.NewReporter(func(id *component.InstanceID, ev *component.StatusEvent) { + actualStatuses := make(map[*pipeline.InstanceID][]*component.StatusEvent) + rep := status.NewReporter(func(id *pipeline.InstanceID, ev *component.StatusEvent) { actualStatuses[id] = append(actualStatuses[id], ev) }, func(error) { }) @@ -2344,7 +2345,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) { rep.Ready() e0, e1 := tc.edge[0], tc.edge[1] - pg.instanceIDs = map[int64]*component.InstanceID{ + pg.instanceIDs = map[int64]*pipeline.InstanceID{ e0.ID(): instanceIDs[e0], e1.ID(): instanceIDs[e1], } @@ -2389,7 +2390,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 pipeline.ID) (int, int) { exConnectorType := component.MustNewType("exampleconnector") var r, e int for _, rID := range m[pID].Receivers { diff --git a/service/internal/graph/nodes.go b/service/internal/graph/nodes.go index 9edb700b242..a98e31bc7dc 100644 --- a/service/internal/graph/nodes.go +++ b/service/internal/graph/nodes.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/internal/fanoutconsumer" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/service/internal/capabilityconsumer" @@ -111,11 +112,11 @@ var _ consumerNode = (*processorNode)(nil) type processorNode struct { nodeID componentID component.ID - pipelineID component.ID + pipelineID pipeline.ID component.Component } -func newProcessorNode(pipelineID, procID component.ID) *processorNode { +func newProcessorNode(pipelineID pipeline.ID, procID component.ID) *processorNode { return &processorNode{ nodeID: newNodeID(processorSeed, pipelineID.String(), procID.String()), componentID: procID, @@ -239,7 +240,7 @@ func (n *connectorNode) buildComponent( switch n.rcvrPipelineType { case component.DataTypeTraces: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Traces, len(nexts)) + consumers := make(map[pipeline.ID]consumer.Traces, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Traces) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -275,7 +276,7 @@ func (n *connectorNode) buildComponent( case component.DataTypeMetrics: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Metrics, len(nexts)) + consumers := make(map[pipeline.ID]consumer.Metrics, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Metrics) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -310,7 +311,7 @@ func (n *connectorNode) buildComponent( } case component.DataTypeLogs: capability := consumer.Capabilities{MutatesData: false} - consumers := make(map[component.ID]consumer.Logs, len(nexts)) + consumers := make(map[pipeline.ID]consumer.Logs, len(nexts)) for _, next := range nexts { consumers[next.(*capabilitiesNode).pipelineID] = next.(consumer.Logs) capability.MutatesData = capability.MutatesData || next.Capabilities().MutatesData @@ -356,14 +357,14 @@ var _ consumerNode = (*capabilitiesNode)(nil) // The nodeID is derived from "pipeline ID". type capabilitiesNode struct { nodeID - pipelineID component.ID + pipelineID pipeline.ID baseConsumer consumer.ConsumeTracesFunc consumer.ConsumeMetricsFunc consumer.ConsumeLogsFunc } -func newCapabilitiesNode(pipelineID component.ID) *capabilitiesNode { +func newCapabilitiesNode(pipelineID pipeline.ID) *capabilitiesNode { return &capabilitiesNode{ nodeID: newNodeID(capabilitiesSeed, pipelineID.String()), pipelineID: pipelineID, @@ -380,11 +381,11 @@ var _ consumerNode = (*fanOutNode)(nil) // Therefore, nodeID is derived from "pipeline ID". type fanOutNode struct { nodeID - pipelineID component.ID + pipelineID pipeline.ID baseConsumer } -func newFanOutNode(pipelineID component.ID) *fanOutNode { +func newFanOutNode(pipelineID pipeline.ID) *fanOutNode { return &fanOutNode{ nodeID: newNodeID(fanOutToExporters, pipelineID.String()), pipelineID: pipelineID, diff --git a/service/internal/proctelemetry/process_telemetry.go b/service/internal/proctelemetry/process_telemetry.go index 9f8f0874e97..ebc3fc90b43 100644 --- a/service/internal/proctelemetry/process_telemetry.go +++ b/service/internal/proctelemetry/process_telemetry.go @@ -13,7 +13,7 @@ import ( "github.com/shirou/gopsutil/v3/common" "github.com/shirou/gopsutil/v3/process" - "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/internal/metadata" "go.opentelemetry.io/collector/service/internal/servicetelemetry" ) @@ -76,7 +76,7 @@ func RegisterProcessMetrics(cfg servicetelemetry.TelemetrySettings, ballastSizeB return err } - _, err = metadata.NewTelemetryBuilder(cfg.ToComponentTelemetrySettings(&component.InstanceID{}), + _, err = metadata.NewTelemetryBuilder(cfg.ToComponentTelemetrySettings(&pipeline.InstanceID{}), metadata.WithProcessUptimeCallback(pm.updateProcessUptime), metadata.WithProcessRuntimeHeapAllocBytesCallback(pm.updateAllocMem), metadata.WithProcessRuntimeTotalAllocBytesCallback(pm.updateTotalAllocMem), diff --git a/service/internal/servicetelemetry/nop_telemetry_settings.go b/service/internal/servicetelemetry/nop_telemetry_settings.go index 116554a51f8..f95cfc07a72 100644 --- a/service/internal/servicetelemetry/nop_telemetry_settings.go +++ b/service/internal/servicetelemetry/nop_telemetry_settings.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/internal/status" ) @@ -22,6 +23,6 @@ func NewNopTelemetrySettings() TelemetrySettings { MeterProvider: noopmetric.NewMeterProvider(), MetricsLevel: configtelemetry.LevelNone, Resource: pcommon.NewResource(), - Status: status.NewReporter(func(*component.InstanceID, *component.StatusEvent) {}, func(error) {}), + Status: status.NewReporter(func(*pipeline.InstanceID, *component.StatusEvent) {}, func(error) {}), } } diff --git a/service/internal/servicetelemetry/nop_telemetry_settings_test.go b/service/internal/servicetelemetry/nop_telemetry_settings_test.go index 8c4a401e0f0..1f6089e0ffe 100644 --- a/service/internal/servicetelemetry/nop_telemetry_settings_test.go +++ b/service/internal/servicetelemetry/nop_telemetry_settings_test.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pipeline" ) func TestNewNopSettings(t *testing.T) { @@ -27,9 +28,9 @@ func TestNewNopSettings(t *testing.T) { require.Equal(t, configtelemetry.LevelNone, set.MetricsLevel) require.Equal(t, pcommon.NewResource(), set.Resource) set.Status.ReportStatus( - &component.InstanceID{}, + &pipeline.InstanceID{}, component.NewStatusEvent(component.StatusStarting), ) - set.Status.ReportOKIfStarting(&component.InstanceID{}) + set.Status.ReportOKIfStarting(&pipeline.InstanceID{}) } diff --git a/service/internal/servicetelemetry/telemetry_settings.go b/service/internal/servicetelemetry/telemetry_settings.go index 55c6b9f3962..2a3720da9fa 100644 --- a/service/internal/servicetelemetry/telemetry_settings.go +++ b/service/internal/servicetelemetry/telemetry_settings.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/internal/status" ) @@ -42,7 +43,7 @@ type TelemetrySettings struct { // ToComponentTelemetrySettings returns a TelemetrySettings for a specific component derived from // this service level Settings object. -func (s TelemetrySettings) ToComponentTelemetrySettings(id *component.InstanceID) component.TelemetrySettings { +func (s TelemetrySettings) ToComponentTelemetrySettings(id *pipeline.InstanceID) component.TelemetrySettings { statusFunc := status.NewReportStatusFunc(id, s.Status.ReportStatus) return component.TelemetrySettings{ Logger: s.Logger, diff --git a/service/internal/servicetelemetry/telemetry_settings_test.go b/service/internal/servicetelemetry/telemetry_settings_test.go index 5aad2c6c2b6..f963aaede70 100644 --- a/service/internal/servicetelemetry/telemetry_settings_test.go +++ b/service/internal/servicetelemetry/telemetry_settings_test.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/service/internal/status" ) @@ -25,16 +26,16 @@ func TestSettings(t *testing.T) { MetricsLevel: configtelemetry.LevelNone, Resource: pcommon.NewResource(), Status: status.NewReporter( - func(*component.InstanceID, *component.StatusEvent) {}, + func(*pipeline.InstanceID, *component.StatusEvent) {}, func(err error) { require.NoError(t, err) }), } set.Status.Ready() set.Status.ReportStatus( - &component.InstanceID{}, + &pipeline.InstanceID{}, component.NewStatusEvent(component.StatusStarting), ) - set.Status.ReportOKIfStarting(&component.InstanceID{}) + set.Status.ReportOKIfStarting(&pipeline.InstanceID{}) - compSet := set.ToComponentTelemetrySettings(&component.InstanceID{}) + compSet := set.ToComponentTelemetrySettings(&pipeline.InstanceID{}) compSet.ReportStatus(component.NewStatusEvent(component.StatusStarting)) } diff --git a/service/internal/status/status.go b/service/internal/status/status.go index e1d524906e5..5a82f686f12 100644 --- a/service/internal/status/status.go +++ b/service/internal/status/status.go @@ -9,6 +9,7 @@ import ( "sync" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) // onTransitionFunc receives a component.StatusEvent on a successful state transition @@ -84,13 +85,13 @@ func newFSM(onTransition onTransitionFunc) *fsm { } // NotifyStatusFunc is the receiver of status events after successful state transitions -type NotifyStatusFunc func(*component.InstanceID, *component.StatusEvent) +type NotifyStatusFunc func(*pipeline.InstanceID, *component.StatusEvent) // InvalidTransitionFunc is the receiver of invalid transition errors type InvalidTransitionFunc func(error) // ServiceStatusFunc is the expected type of ReportStatus for servicetelemetry.Settings -type ServiceStatusFunc func(*component.InstanceID, *component.StatusEvent) +type ServiceStatusFunc func(*pipeline.InstanceID, *component.StatusEvent) // ErrStatusNotReady is returned when trying to report status before service start var ErrStatusNotReady = errors.New("report component status is not ready until service start") @@ -99,7 +100,7 @@ var ErrStatusNotReady = errors.New("report component status is not ready until s type Reporter struct { mu sync.Mutex ready bool - fsmMap map[*component.InstanceID]*fsm + fsmMap map[*pipeline.InstanceID]*fsm onStatusChange NotifyStatusFunc onInvalidTransition InvalidTransitionFunc } @@ -108,7 +109,7 @@ type Reporter struct { // has changed. func NewReporter(onStatusChange NotifyStatusFunc, onInvalidTransition InvalidTransitionFunc) *Reporter { return &Reporter{ - fsmMap: make(map[*component.InstanceID]*fsm), + fsmMap: make(map[*pipeline.InstanceID]*fsm), onStatusChange: onStatusChange, onInvalidTransition: onInvalidTransition, } @@ -123,7 +124,7 @@ func (r *Reporter) Ready() { // ReportStatus reports status for the given InstanceID func (r *Reporter) ReportStatus( - id *component.InstanceID, + id *pipeline.InstanceID, ev *component.StatusEvent, ) { r.mu.Lock() @@ -137,7 +138,7 @@ func (r *Reporter) ReportStatus( } } -func (r *Reporter) ReportOKIfStarting(id *component.InstanceID) { +func (r *Reporter) ReportOKIfStarting(id *pipeline.InstanceID) { r.mu.Lock() defer r.mu.Unlock() if !r.ready { @@ -152,7 +153,7 @@ func (r *Reporter) ReportOKIfStarting(id *component.InstanceID) { } // Note: a lock must be acquired before calling this method. -func (r *Reporter) componentFSM(id *component.InstanceID) *fsm { +func (r *Reporter) componentFSM(id *pipeline.InstanceID) *fsm { fsm, ok := r.fsmMap[id] if !ok { fsm = newFSM(func(ev *component.StatusEvent) { r.onStatusChange(id, ev) }) @@ -165,7 +166,7 @@ func (r *Reporter) componentFSM(id *component.InstanceID) *fsm { // component.TelemetrySettings, which differs from servicetelemetry.Settings in that // the component version is tied to specific component instance. func NewReportStatusFunc( - id *component.InstanceID, + id *pipeline.InstanceID, srvStatus ServiceStatusFunc, ) func(*component.StatusEvent) { return func(ev *component.StatusEvent) { diff --git a/service/internal/status/status_test.go b/service/internal/status/status_test.go index c31c649e496..ea8012b4975 100644 --- a/service/internal/status/status_test.go +++ b/service/internal/status/status_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) func TestStatusFSM(t *testing.T) { @@ -179,11 +180,11 @@ func TestValidSeqsToStopped(t *testing.T) { } func TestStatusFuncs(t *testing.T) { - id1 := &component.InstanceID{} - id2 := &component.InstanceID{} + id1 := &pipeline.InstanceID{} + id2 := &pipeline.InstanceID{} - actualStatuses := make(map[*component.InstanceID][]component.Status) - statusFunc := func(id *component.InstanceID, ev *component.StatusEvent) { + actualStatuses := make(map[*pipeline.InstanceID][]component.Status) + statusFunc := func(id *pipeline.InstanceID, ev *component.StatusEvent) { actualStatuses[id] = append(actualStatuses[id], ev.Status()) } @@ -203,7 +204,7 @@ func TestStatusFuncs(t *testing.T) { component.StatusStopped, } - expectedStatuses := map[*component.InstanceID][]component.Status{ + expectedStatuses := map[*pipeline.InstanceID][]component.Status{ id1: statuses1, id2: statuses2, } @@ -228,9 +229,9 @@ func TestStatusFuncs(t *testing.T) { } func TestStatusFuncsConcurrent(t *testing.T) { - ids := []*component.InstanceID{{}, {}, {}, {}} + ids := []*pipeline.InstanceID{{}, {}, {}, {}} count := 0 - statusFunc := func(*component.InstanceID, *component.StatusEvent) { + statusFunc := func(*pipeline.InstanceID, *component.StatusEvent) { count++ } rep := NewReporter(statusFunc, @@ -260,13 +261,13 @@ func TestStatusFuncsConcurrent(t *testing.T) { } func TestReporterReady(t *testing.T) { - statusFunc := func(*component.InstanceID, *component.StatusEvent) {} + statusFunc := func(*pipeline.InstanceID, *component.StatusEvent) {} var err error rep := NewReporter(statusFunc, func(e error) { err = e }) - id := &component.InstanceID{} + id := &pipeline.InstanceID{} rep.ReportStatus(id, component.NewStatusEvent(component.StatusStarting)) require.ErrorIs(t, err, ErrStatusNotReady) @@ -331,7 +332,7 @@ func TestReportComponentOKIfStarting(t *testing.T) { var receivedStatuses []component.Status rep := NewReporter( - func(_ *component.InstanceID, ev *component.StatusEvent) { + func(_ *pipeline.InstanceID, ev *component.StatusEvent) { receivedStatuses = append(receivedStatuses, ev.Status()) }, func(err error) { @@ -340,7 +341,7 @@ func TestReportComponentOKIfStarting(t *testing.T) { ) rep.Ready() - id := &component.InstanceID{} + id := &pipeline.InstanceID{} for _, status := range tc.initialStatuses { rep.ReportStatus(id, component.NewStatusEvent(status)) } diff --git a/service/internal/testcomponents/example_router.go b/service/internal/testcomponents/example_router.go index 6d7211c89e8..a71d26264ed 100644 --- a/service/internal/testcomponents/example_router.go +++ b/service/internal/testcomponents/example_router.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/pipeline" ) var routerType = component.MustNewType("examplerouter") @@ -26,8 +27,8 @@ var ExampleRouterFactory = connector.NewFactory( ) type LeftRightConfig struct { - Left component.ID `mapstructure:"left"` - Right component.ID `mapstructure:"right"` + Left pipeline.ID `mapstructure:"left"` + Right pipeline.ID `mapstructure:"right"` } type ExampleRouterConfig struct { diff --git a/service/internal/testcomponents/example_router_test.go b/service/internal/testcomponents/example_router_test.go index f868b99543b..a79df3c0810 100644 --- a/service/internal/testcomponents/example_router_test.go +++ b/service/internal/testcomponents/example_router_test.go @@ -16,6 +16,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/testdata" + "go.opentelemetry.io/collector/pipeline" ) func TestExampleRouter(t *testing.T) { @@ -31,8 +32,8 @@ func TestExampleRouter(t *testing.T) { } func TestTracesRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := pipeline.NewIDWithName(component.DataTypeTraces, "left") + rightID := pipeline.NewIDWithName(component.DataTypeTraces, "right") sinkLeft := new(consumertest.TracesSink) sinkRight := new(consumertest.TracesSink) @@ -41,7 +42,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[pipeline.ID]consumer.Traces{ leftID: sinkLeft, rightID: sinkRight, }) @@ -70,8 +71,8 @@ func TestTracesRouter(t *testing.T) { } func TestMetricsRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := pipeline.NewIDWithName(component.DataTypeMetrics, "left") + rightID := pipeline.NewIDWithName(component.DataTypeMetrics, "right") sinkLeft := new(consumertest.MetricsSink) sinkRight := new(consumertest.MetricsSink) @@ -80,7 +81,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[pipeline.ID]consumer.Metrics{ leftID: sinkLeft, rightID: sinkRight, }) @@ -109,8 +110,8 @@ func TestMetricsRouter(t *testing.T) { } func TestLogsRouter(t *testing.T) { - leftID := component.MustNewIDWithName("sink", "left") - rightID := component.MustNewIDWithName("sink", "right") + leftID := pipeline.NewIDWithName(component.DataTypeLogs, "left") + rightID := pipeline.NewIDWithName(component.DataTypeLogs, "right") sinkLeft := new(consumertest.LogsSink) sinkRight := new(consumertest.LogsSink) @@ -119,7 +120,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[pipeline.ID]consumer.Logs{ leftID: sinkLeft, rightID: sinkRight, }) diff --git a/service/pipelines/config.go b/service/pipelines/config.go index ed8c77a31c0..81bba72d0ef 100644 --- a/service/pipelines/config.go +++ b/service/pipelines/config.go @@ -8,6 +8,7 @@ import ( "fmt" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) var ( @@ -17,7 +18,7 @@ var ( ) // Config defines the configurable settings for service telemetry. -type Config map[component.ID]*PipelineConfig +type Config map[pipeline.ID]*PipelineConfig func (cfg Config) Validate() error { // Must have at least one pipeline. diff --git a/service/pipelines/config_test.go b/service/pipelines/config_test.go index 7ad94d5ab3f..8299bcf425e 100644 --- a/service/pipelines/config_test.go +++ b/service/pipelines/config_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pipeline" ) func TestConfigValidate(t *testing.T) { @@ -28,7 +29,7 @@ func TestConfigValidate(t *testing.T) { name: "duplicate-processor-reference", cfgFn: func() Config { cfg := generateConfig() - pipe := cfg[component.MustNewID("traces")] + pipe := cfg[pipeline.NewID(component.DataTypeTraces)] pipe.Processors = append(pipe.Processors, pipe.Processors...) return cfg }, @@ -38,7 +39,7 @@ func TestConfigValidate(t *testing.T) { name: "missing-pipeline-receivers", cfgFn: func() Config { cfg := generateConfig() - cfg[component.MustNewID("traces")].Receivers = nil + cfg[pipeline.NewID(component.DataTypeTraces)].Receivers = nil return cfg }, expected: fmt.Errorf(`pipeline "traces": %w`, errMissingServicePipelineReceivers), @@ -47,7 +48,7 @@ func TestConfigValidate(t *testing.T) { name: "missing-pipeline-exporters", cfgFn: func() Config { cfg := generateConfig() - cfg[component.MustNewID("traces")].Exporters = nil + cfg[pipeline.NewID(component.DataTypeTraces)].Exporters = nil return cfg }, expected: fmt.Errorf(`pipeline "traces": %w`, errMissingServicePipelineExporters), @@ -63,7 +64,7 @@ func TestConfigValidate(t *testing.T) { name: "invalid-service-pipeline-type", cfgFn: func() Config { cfg := generateConfig() - cfg[component.MustNewID("wrongtype")] = &PipelineConfig{ + cfg[pipeline.NewID("wrongtype")] = &PipelineConfig{ Receivers: []component.ID{component.MustNewID("nop")}, Processors: []component.ID{component.MustNewID("nop")}, Exporters: []component.ID{component.MustNewID("nop")}, @@ -83,8 +84,8 @@ func TestConfigValidate(t *testing.T) { } func generateConfig() Config { - return map[component.ID]*PipelineConfig{ - component.MustNewID("traces"): { + return map[pipeline.ID]*PipelineConfig{ + pipeline.NewID(component.DataTypeTraces): { 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 f708a82fb0d..e185399874b 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -30,6 +30,7 @@ import ( "go.opentelemetry.io/collector/extension/zpagesextension" "go.opentelemetry.io/collector/internal/testutil" "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pipeline" "go.opentelemetry.io/collector/processor/processortest" "go.opentelemetry.io/collector/receiver/receivertest" "go.opentelemetry.io/collector/service/extensions" @@ -240,7 +241,7 @@ func TestServiceGetExporters(t *testing.T) { // 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[pipeline.NewID(component.DataTypeTraces)].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) @@ -422,7 +423,7 @@ func TestServiceFatalError(t *testing.T) { go func() { ev := component.NewFatalErrorEvent(assert.AnError) - srv.host.notifyComponentStatusChange(&component.InstanceID{}, ev) + srv.host.notifyComponentStatusChange(&pipeline.InstanceID{}, ev) }() err = <-srv.host.asyncErrorChannel @@ -532,17 +533,17 @@ func newNopSettings() Settings { func newNopConfig() Config { return newNopConfigPipelineConfigs(pipelines.Config{ - component.MustNewID("traces"): { + pipeline.NewID(component.DataTypeTraces): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("metrics"): { + pipeline.NewID(component.DataTypeMetrics): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, }, - component.MustNewID("logs"): { + pipeline.NewID(component.DataTypeLogs): { Receivers: []component.ID{component.NewID(nopType)}, Processors: []component.ID{component.NewID(nopType)}, Exporters: []component.ID{component.NewID(nopType)}, diff --git a/versions.yaml b/versions.yaml index 49c6b625c58..391af3d3cdc 100644 --- a/versions.yaml +++ b/versions.yaml @@ -48,6 +48,7 @@ module-sets: - go.opentelemetry.io/collector/otelcol - go.opentelemetry.io/collector/pdata/pprofile - go.opentelemetry.io/collector/pdata/testdata + - go.opentelemetry.io/collector/pipeline - go.opentelemetry.io/collector/processor - go.opentelemetry.io/collector/processor/batchprocessor - go.opentelemetry.io/collector/processor/memorylimiterprocessor