Skip to content

Commit

Permalink
Deprecate consumerprofiles module in favor of xconsumer
Browse files Browse the repository at this point in the history
To allow adding more experimental data types. First step towards #11778

Deprecate consumerprofiles module in favor of xconsumer
  • Loading branch information
dmitryax committed Dec 12, 2024
1 parent 220b583 commit 6bc7547
Show file tree
Hide file tree
Showing 88 changed files with 480 additions and 260 deletions.
20 changes: 20 additions & 0 deletions .chloggen/deprecate-consumerprofiles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: deprecation

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: consumer

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate consumerprofiles module in favor of xconsumer to allow adding more experimental data types.

# One or more tracking issues or pull requests related to the change
issues: [11778]

# 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]
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extension/experimental/storage @open-telemetry/collector-approvers @swiatekm
# Profiling-related modules
pdata/pprofile @open-telemetry/collector-approvers @mx-psi @dmathieu
consumer/consumerprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
consumer/xconsumer @open-telemetry/collector-approvers @mx-psi @dmathieu
connector/connectorprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
exporter/exporterhelper/exporterhelperprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
exporter/exporterprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
Expand Down
2 changes: 1 addition & 1 deletion cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var replaceModules = []string{
"/consumer",
"/consumer/consumererror",
"/consumer/consumererror/consumererrorprofiles",
"/consumer/consumerprofiles",
"/consumer/xconsumer",
"/consumer/consumertest",
"/connector",
"/connector/connectortest",
Expand Down
4 changes: 2 additions & 2 deletions cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
go.opentelemetry.io/collector/component/componentstatus v0.115.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.115.0 // indirect
go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.115.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline v0.115.0 // indirect
Expand Down Expand Up @@ -97,7 +97,7 @@ retract (

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles
replace go.opentelemetry.io/collector/consumer/xconsumer => ../../consumer/xconsumer

replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest

Expand Down
2 changes: 1 addition & 1 deletion cmd/otelcorecol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ replaces:
- go.opentelemetry.io/collector/confmap/provider/httpsprovider => ../../confmap/provider/httpsprovider
- go.opentelemetry.io/collector/confmap/provider/yamlprovider => ../../confmap/provider/yamlprovider
- go.opentelemetry.io/collector/consumer => ../../consumer
- go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles
- go.opentelemetry.io/collector/consumer/xconsumer => ../../consumer/xconsumer
- go.opentelemetry.io/collector/consumer/consumererror => ../../consumer/consumererror
- go.opentelemetry.io/collector/consumer/consumererror/consumererrorprofiles => ../../consumer/consumererror/consumererrorprofiles
- go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ require (
go.opentelemetry.io/collector/consumer v1.21.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.115.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror/consumererrorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/consumer/consumertest v0.115.0 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.115.0 // indirect
go.opentelemetry.io/collector/exporter/exporterhelper/exporterhelperprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/exporter/exporterprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/exporter/exportertest v0.115.0 // indirect
Expand Down Expand Up @@ -203,7 +203,7 @@ replace go.opentelemetry.io/collector/confmap/provider/yamlprovider => ../../con

replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles
replace go.opentelemetry.io/collector/consumer/xconsumer => ../../consumer/xconsumer

replace go.opentelemetry.io/collector/consumer/consumererror => ../../consumer/consumererror

Expand Down
30 changes: 15 additions & 15 deletions connector/connectorprofiles/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ import (
"go.opentelemetry.io/collector/connector"
"go.opentelemetry.io/collector/connector/internal"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumerprofiles"
"go.opentelemetry.io/collector/consumer/xconsumer"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/pipeline/pipelineprofiles"
)

type Factory interface {
connector.Factory

CreateTracesToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerprofiles.Profiles) (connector.Traces, error)
CreateMetricsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerprofiles.Profiles) (connector.Metrics, error)
CreateLogsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerprofiles.Profiles) (connector.Logs, error)
CreateTracesToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next xconsumer.Profiles) (connector.Traces, error)
CreateMetricsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next xconsumer.Profiles) (connector.Metrics, error)
CreateLogsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next xconsumer.Profiles) (connector.Logs, error)

TracesToProfilesStability() component.StabilityLevel
MetricsToProfilesStability() component.StabilityLevel
LogsToProfilesStability() component.StabilityLevel

CreateProfilesToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerprofiles.Profiles) (Profiles, error)
CreateProfilesToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next xconsumer.Profiles) (Profiles, error)
CreateProfilesToTraces(ctx context.Context, set connector.Settings, cfg component.Config, next consumer.Traces) (Profiles, error)
CreateProfilesToMetrics(ctx context.Context, set connector.Settings, cfg component.Config, next consumer.Metrics) (Profiles, error)
CreateProfilesToLogs(ctx context.Context, set connector.Settings, cfg component.Config, next consumer.Logs) (Profiles, error)
Expand All @@ -39,7 +39,7 @@ type Factory interface {

// A Profiles connector acts as an exporter from a profiles pipeline and a receiver
// to one or more traces, metrics, logs, or profiles pipelines.
// Profiles feeds a consumer.Traces, consumer.Metrics, consumer.Logs, or consumerprofiles.Profiles with data.
// Profiles feeds a consumer.Traces, consumer.Metrics, consumer.Logs, or xconsumer.Profiles with data.
//
// Examples:
// - Profiles could be collected in one pipeline and routed to another profiles pipeline
Expand All @@ -51,47 +51,47 @@ type Factory interface {
// criteria are met.
type Profiles interface {
component.Component
consumerprofiles.Profiles
xconsumer.Profiles
}

// CreateTracesToProfilesFunc is the equivalent of Factory.CreateTracesToProfiles().
type CreateTracesToProfilesFunc func(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Traces, error)
type CreateTracesToProfilesFunc func(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Traces, error)

// CreateTracesToProfiles implements Factory.CreateTracesToProfiles().
func (f CreateTracesToProfilesFunc) CreateTracesToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerprofiles.Profiles) (connector.Traces, error) {
func (f CreateTracesToProfilesFunc) CreateTracesToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next xconsumer.Profiles) (connector.Traces, error) {
if f == nil {
return nil, internal.ErrDataTypes(set.ID, pipeline.SignalTraces, pipelineprofiles.SignalProfiles)
}
return f(ctx, set, cfg, next)
}

// CreateMetricsToProfilesFunc is the equivalent of Factory.CreateMetricsToProfiles().
type CreateMetricsToProfilesFunc func(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Metrics, error)
type CreateMetricsToProfilesFunc func(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Metrics, error)

// CreateMetricsToProfiles implements Factory.CreateMetricsToProfiles().
func (f CreateMetricsToProfilesFunc) CreateMetricsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerprofiles.Profiles) (connector.Metrics, error) {
func (f CreateMetricsToProfilesFunc) CreateMetricsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next xconsumer.Profiles) (connector.Metrics, error) {
if f == nil {
return nil, internal.ErrDataTypes(set.ID, pipeline.SignalMetrics, pipelineprofiles.SignalProfiles)
}
return f(ctx, set, cfg, next)
}

// CreateLogsToProfilesFunc is the equivalent of Factory.CreateLogsToProfiles().
type CreateLogsToProfilesFunc func(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Logs, error)
type CreateLogsToProfilesFunc func(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Logs, error)

// CreateLogsToProfiles implements Factory.CreateLogsToProfiles().
func (f CreateLogsToProfilesFunc) CreateLogsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerprofiles.Profiles) (connector.Logs, error) {
func (f CreateLogsToProfilesFunc) CreateLogsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next xconsumer.Profiles) (connector.Logs, error) {
if f == nil {
return nil, internal.ErrDataTypes(set.ID, pipeline.SignalLogs, pipelineprofiles.SignalProfiles)
}
return f(ctx, set, cfg, next)
}

// CreateProfilesToProfilesFunc is the equivalent of Factory.CreateProfilesToProfiles().
type CreateProfilesToProfilesFunc func(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (Profiles, error)
type CreateProfilesToProfilesFunc func(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (Profiles, error)

// CreateProfilesToProfiles implements Factory.CreateProfilesToProfiles().
func (f CreateProfilesToProfilesFunc) CreateProfilesToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerprofiles.Profiles) (Profiles, error) {
func (f CreateProfilesToProfilesFunc) CreateProfilesToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next xconsumer.Profiles) (Profiles, error) {
if f == nil {
return nil, internal.ErrDataTypes(set.ID, pipelineprofiles.SignalProfiles, pipelineprofiles.SignalProfiles)
}
Expand Down
10 changes: 5 additions & 5 deletions connector/connectorprofiles/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"go.opentelemetry.io/collector/connector"
"go.opentelemetry.io/collector/connector/internal"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumerprofiles"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/consumer/xconsumer"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/pipeline/pipelineprofiles"
)
Expand Down Expand Up @@ -119,19 +119,19 @@ type nopConnector struct {
consumertest.Consumer
}

func createTracesToProfiles(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Traces, error) {
func createTracesToProfiles(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Traces, error) {
return nopInstance, nil
}

func createMetricsToProfiles(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Metrics, error) {
func createMetricsToProfiles(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Metrics, error) {
return nopInstance, nil
}

func createLogsToProfiles(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Logs, error) {
func createLogsToProfiles(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Logs, error) {
return nopInstance, nil
}

func createProfilesToProfiles(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (Profiles, error) {
func createProfilesToProfiles(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (Profiles, error) {
return nopInstance, nil
}

Expand Down
4 changes: 2 additions & 2 deletions connector/connectorprofiles/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
go.opentelemetry.io/collector/component v0.115.0
go.opentelemetry.io/collector/connector v0.115.0
go.opentelemetry.io/collector/consumer v1.21.0
go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0
go.opentelemetry.io/collector/consumer/consumertest v0.115.0
go.opentelemetry.io/collector/consumer/xconsumer v0.115.0
go.opentelemetry.io/collector/internal/fanoutconsumer v0.115.0
go.opentelemetry.io/collector/pdata/pprofile v0.115.0
go.opentelemetry.io/collector/pdata/testdata v0.115.0
Expand Down Expand Up @@ -47,7 +47,7 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles
replace go.opentelemetry.io/collector/consumer/xconsumer => ../../consumer/xconsumer

replace go.opentelemetry.io/collector/component => ../../component

Expand Down
14 changes: 7 additions & 7 deletions connector/connectorprofiles/profiles_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ package connectorprofiles // import "go.opentelemetry.io/collector/connector/con

import (
"go.opentelemetry.io/collector/connector/internal"
"go.opentelemetry.io/collector/consumer/consumerprofiles"
"go.opentelemetry.io/collector/consumer/xconsumer"
"go.opentelemetry.io/collector/internal/fanoutconsumer"
"go.opentelemetry.io/collector/pipeline"
)

type ProfilesRouterAndConsumer interface {
consumerprofiles.Profiles
Consumer(...pipeline.ID) (consumerprofiles.Profiles, error)
xconsumer.Profiles
Consumer(...pipeline.ID) (xconsumer.Profiles, error)
PipelineIDs() []pipeline.ID
privateFunc()
}

type profilesRouter struct {
consumerprofiles.Profiles
internal.BaseRouter[consumerprofiles.Profiles]
xconsumer.Profiles
internal.BaseRouter[xconsumer.Profiles]
}

func NewProfilesRouter(cm map[pipeline.ID]consumerprofiles.Profiles) ProfilesRouterAndConsumer {
consumers := make([]consumerprofiles.Profiles, 0, len(cm))
func NewProfilesRouter(cm map[pipeline.ID]xconsumer.Profiles) ProfilesRouterAndConsumer {
consumers := make([]xconsumer.Profiles, 0, len(cm))
for _, cons := range cm {
consumers = append(consumers, cons)
}
Expand Down
8 changes: 4 additions & 4 deletions connector/connectorprofiles/profiles_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/stretchr/testify/require"

"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumerprofiles"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/consumer/xconsumer"
"go.opentelemetry.io/collector/pdata/pprofile"
"go.opentelemetry.io/collector/pdata/testdata"
"go.opentelemetry.io/collector/pipeline"
Expand Down Expand Up @@ -46,8 +46,8 @@ func TestProfilesRouterMultiplexing(t *testing.T) {
func fuzzProfiles(numIDs, numCons, numProfiles int) func(*testing.T) {
return func(t *testing.T) {
allIDs := make([]pipeline.ID, 0, numCons)
allCons := make([]consumerprofiles.Profiles, 0, numCons)
allConsMap := make(map[pipeline.ID]consumerprofiles.Profiles)
allCons := make([]xconsumer.Profiles, 0, numCons)
allConsMap := make(map[pipeline.ID]xconsumer.Profiles)

// If any consumer is mutating, the router must report mutating
for i := 0; i < numCons; i++ {
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestProfilessRouterConsumer(t *testing.T) {

foo := new(consumertest.ProfilesSink)
bar := new(consumertest.ProfilesSink)
r := NewProfilesRouter(map[pipeline.ID]consumerprofiles.Profiles{fooID: foo, barID: bar})
r := NewProfilesRouter(map[pipeline.ID]xconsumer.Profiles{fooID: foo, barID: bar})

rcs := r.PipelineIDs()
assert.Len(t, rcs, 2)
Expand Down
10 changes: 5 additions & 5 deletions connector/connectortest/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"go.opentelemetry.io/collector/connector"
"go.opentelemetry.io/collector/connector/connectorprofiles"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumerprofiles"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/consumer/xconsumer"
)

var nopType = component.MustNewType("nop")
Expand Down Expand Up @@ -68,7 +68,7 @@ func createTracesToLogsConnector(context.Context, connector.Settings, component.
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

func createTracesToProfilesConnector(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Traces, error) {
func createTracesToProfilesConnector(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Traces, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

Expand All @@ -84,7 +84,7 @@ func createMetricsToLogsConnector(context.Context, connector.Settings, component
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

func createMetricsToProfilesConnector(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Metrics, error) {
func createMetricsToProfilesConnector(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Metrics, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

Expand All @@ -100,7 +100,7 @@ func createLogsToLogsConnector(context.Context, connector.Settings, component.Co
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

func createLogsToProfilesConnector(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connector.Logs, error) {
func createLogsToProfilesConnector(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connector.Logs, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

Expand All @@ -116,7 +116,7 @@ func createProfilesToLogsConnector(context.Context, connector.Settings, componen
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

func createProfilesToProfilesConnector(context.Context, connector.Settings, component.Config, consumerprofiles.Profiles) (connectorprofiles.Profiles, error) {
func createProfilesToProfilesConnector(context.Context, connector.Settings, component.Config, xconsumer.Profiles) (connectorprofiles.Profiles, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

Expand Down
4 changes: 2 additions & 2 deletions connector/connectortest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
go.opentelemetry.io/collector/connector v0.115.0
go.opentelemetry.io/collector/connector/connectorprofiles v0.115.0
go.opentelemetry.io/collector/consumer v1.21.0
go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0
go.opentelemetry.io/collector/consumer/consumertest v0.115.0
go.opentelemetry.io/collector/consumer/xconsumer v0.115.0
go.opentelemetry.io/collector/pdata v1.21.0
go.opentelemetry.io/collector/pdata/pprofile v0.115.0
go.uber.org/goleak v1.3.0
Expand Down Expand Up @@ -58,7 +58,7 @@ replace go.opentelemetry.io/collector/pdata => ../../pdata

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile

replace go.opentelemetry.io/collector/consumer/consumerprofiles => ../../consumer/consumerprofiles
replace go.opentelemetry.io/collector/consumer/xconsumer => ../../consumer/xconsumer

replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest

Expand Down
Loading

0 comments on commit 6bc7547

Please sign in to comment.