Skip to content

Commit

Permalink
Deprecate consumerprofiles module in favor of consumerexp
Browse files Browse the repository at this point in the history
To allow adding more experimental data types. First step towards open-telemetry#11778
  • Loading branch information
dmitryax committed Dec 2, 2024
1 parent c52d625 commit c5343ec
Show file tree
Hide file tree
Showing 84 changed files with 480 additions and 263 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 consumerexp 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]
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.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumerexp v0.114.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.114.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.114.0 // indirect
go.opentelemetry.io/collector/pipeline v0.114.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/consumerexp => ../../consumer/consumerexp

replace 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,7 +98,7 @@ require (
go.opentelemetry.io/collector/consumer v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror/consumererrorprofiles v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumerexp v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumertest v0.114.0 // indirect
go.opentelemetry.io/collector/exporter/exporterhelper/exporterhelperprofiles v0.114.0 // indirect
go.opentelemetry.io/collector/exporter/exporterprofiles v0.114.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/consumerexp => ../../consumer/consumerexp

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/consumerexp"
"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 consumerexp.Profiles) (connector.Traces, error)
CreateMetricsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerexp.Profiles) (connector.Metrics, error)
CreateLogsToProfiles(ctx context.Context, set connector.Settings, cfg component.Config, next consumerexp.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 consumerexp.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 consumerexp.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
consumerexp.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, consumerexp.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 consumerexp.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, consumerexp.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 consumerexp.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, consumerexp.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 consumerexp.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, consumerexp.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 consumerexp.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,7 +14,7 @@ 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/consumerexp"
"go.opentelemetry.io/collector/consumer/consumertest"
"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, consumerexp.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, consumerexp.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, consumerexp.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, consumerexp.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,7 +7,7 @@ require (
go.opentelemetry.io/collector/component v0.114.0
go.opentelemetry.io/collector/connector v0.114.0
go.opentelemetry.io/collector/consumer v0.114.0
go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0
go.opentelemetry.io/collector/consumer/consumerexp v0.114.0
go.opentelemetry.io/collector/consumer/consumertest v0.114.0
go.opentelemetry.io/collector/internal/fanoutconsumer v0.114.0
go.opentelemetry.io/collector/pdata/pprofile v0.114.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/consumerexp => ../../consumer/consumerexp

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/consumerexp"
"go.opentelemetry.io/collector/internal/fanoutconsumer"
"go.opentelemetry.io/collector/pipeline"
)

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

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

func NewProfilesRouter(cm map[pipeline.ID]consumerprofiles.Profiles) ProfilesRouterAndConsumer {
consumers := make([]consumerprofiles.Profiles, 0, len(cm))
func NewProfilesRouter(cm map[pipeline.ID]consumerexp.Profiles) ProfilesRouterAndConsumer {
consumers := make([]consumerexp.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,7 +13,7 @@ import (
"github.com/stretchr/testify/require"

"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumerprofiles"
"go.opentelemetry.io/collector/consumer/consumerexp"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/pdata/pprofile"
"go.opentelemetry.io/collector/pdata/testdata"
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([]consumerexp.Profiles, 0, numCons)
allConsMap := make(map[pipeline.ID]consumerexp.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]consumerexp.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,7 +13,7 @@ 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/consumerexp"
"go.opentelemetry.io/collector/consumer/consumertest"
)

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, consumerexp.Profiles) (connector.Traces, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

Expand All @@ -83,7 +83,7 @@ func createMetricsToMetricsConnector(context.Context, connector.Settings, compon
func createMetricsToLogsConnector(context.Context, connector.Settings, component.Config, consumer.Logs) (connector.Metrics, error) {
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, consumerexp.Profiles) (connector.Metrics, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

Expand All @@ -98,7 +98,7 @@ func createLogsToMetricsConnector(context.Context, connector.Settings, component
func createLogsToLogsConnector(context.Context, connector.Settings, component.Config, consumer.Logs) (connector.Logs, error) {
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, consumerexp.Profiles) (connector.Logs, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

Expand All @@ -113,7 +113,7 @@ func createProfilesToMetricsConnector(context.Context, connector.Settings, compo
func createProfilesToLogsConnector(context.Context, connector.Settings, component.Config, consumer.Logs) (connectorprofiles.Profiles, error) {
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, consumerexp.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,7 +10,7 @@ require (
go.opentelemetry.io/collector/connector v0.114.0
go.opentelemetry.io/collector/connector/connectorprofiles v0.114.0
go.opentelemetry.io/collector/consumer v0.114.0
go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0
go.opentelemetry.io/collector/consumer/consumerexp v0.114.0
go.opentelemetry.io/collector/consumer/consumertest v0.114.0
go.opentelemetry.io/collector/pdata v1.20.0
go.opentelemetry.io/collector/pdata/pprofile v0.114.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/consumerexp => ../../consumer/consumerexp

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

Expand Down
4 changes: 2 additions & 2 deletions connector/forwardconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.114.0 // indirect
go.opentelemetry.io/collector/connector/connectorprofiles v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumerexp v0.114.0 // indirect
go.opentelemetry.io/collector/internal/fanoutconsumer v0.114.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.114.0 // indirect
go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.114.0 // indirect
Expand Down Expand Up @@ -79,7 +79,7 @@ replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/con

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

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

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

Expand Down
Loading

0 comments on commit c5343ec

Please sign in to comment.