Skip to content

Commit

Permalink
Deprecate connectorprofiles module in favor of xconnector (#11887)
Browse files Browse the repository at this point in the history
to allow adding more experimental data types.

Updates
#11778
  • Loading branch information
dmitryax authored Dec 14, 2024
1 parent 7941703 commit e9bc4bd
Show file tree
Hide file tree
Showing 32 changed files with 1,090 additions and 463 deletions.
20 changes: 20 additions & 0 deletions .chloggen/deprecate-connectorprofiles.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: connector

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate connectorprofiles module in favor of xconnector 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 @@ -32,6 +32,7 @@ pdata/pprofile @open-telemetry/collector-approve
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
connector/xconnector @open-telemetry/collector-approvers @mx-psi @dmathieu
exporter/exporterhelper/exporterhelperprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
exporter/exporterhelper/xexporterhelper @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 @@ -66,7 +66,7 @@ var replaceModules = []string{
"/consumer/consumertest",
"/connector",
"/connector/connectortest",
"/connector/connectorprofiles",
"/connector/xconnector",
"/exporter",
"/exporter/debugexporter",
"/exporter/xexporter",
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 @@ -65,7 +65,7 @@ replaces:
- go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
- go.opentelemetry.io/collector/connector => ../../connector
- go.opentelemetry.io/collector/connector/connectortest => ../../connector/connectortest
- go.opentelemetry.io/collector/connector/connectorprofiles => ../../connector/connectorprofiles
- go.opentelemetry.io/collector/connector/xconnector => ../../connector/xconnector
- go.opentelemetry.io/collector/connector/forwardconnector => ../../connector/forwardconnector
- go.opentelemetry.io/collector/exporter => ../../exporter
- go.opentelemetry.io/collector/exporter/debugexporter => ../../exporter/debugexporter
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ require (
go.opentelemetry.io/collector/config/configtelemetry v0.115.0 // indirect
go.opentelemetry.io/collector/config/configtls v1.21.0 // indirect
go.opentelemetry.io/collector/config/internal v0.115.0 // indirect
go.opentelemetry.io/collector/connector/connectorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/connector/connectortest v0.115.0 // indirect
go.opentelemetry.io/collector/connector/xconnector v0.115.0 // indirect
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/xconsumererror v0.0.0-00010101000000-000000000000 // indirect
Expand Down Expand Up @@ -215,7 +215,7 @@ replace go.opentelemetry.io/collector/connector => ../../connector

replace go.opentelemetry.io/collector/connector/connectortest => ../../connector/connectortest

replace go.opentelemetry.io/collector/connector/connectorprofiles => ../../connector/connectorprofiles
replace go.opentelemetry.io/collector/connector/xconnector => ../../connector/xconnector

replace go.opentelemetry.io/collector/connector/forwardconnector => ../../connector/forwardconnector

Expand Down
319 changes: 57 additions & 262 deletions connector/connectorprofiles/connector.go

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion connector/connectorprofiles/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ require (
github.com/stretchr/testify v1.10.0
go.opentelemetry.io/collector/component v0.115.0
go.opentelemetry.io/collector/connector v0.115.0
go.opentelemetry.io/collector/connector/xconnector v0.115.0
go.opentelemetry.io/collector/consumer v1.21.0
go.opentelemetry.io/collector/consumer/consumertest v0.115.0
go.opentelemetry.io/collector/consumer/xconsumer v0.115.1-0.20241213185000-4593ba7de234
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
go.opentelemetry.io/collector/pipeline v0.115.0
Expand All @@ -24,6 +24,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.115.0 // indirect
go.opentelemetry.io/collector/internal/fanoutconsumer v0.115.0 // indirect
go.opentelemetry.io/collector/pdata v1.21.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
Expand All @@ -41,6 +42,8 @@ require (

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

replace go.opentelemetry.io/collector/connector/xconnector => ../xconnector

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

replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/consumertest
Expand Down
35 changes: 6 additions & 29 deletions connector/connectorprofiles/profiles_router.go
Original file line number Diff line number Diff line change
@@ -1,36 +1,13 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Deprecated: [0.116.0] Use go.opentelemetry.io/collector/connector/xconnector instead.
package connectorprofiles // import "go.opentelemetry.io/collector/connector/connectorprofiles"

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

type ProfilesRouterAndConsumer interface {
xconsumer.Profiles
Consumer(...pipeline.ID) (xconsumer.Profiles, error)
PipelineIDs() []pipeline.ID
privateFunc()
}
// Deprecated: [0.116.0] Use xconnector.ProfilesRouterAndConsumer instead.
type ProfilesRouterAndConsumer = xconnector.ProfilesRouterAndConsumer

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

func NewProfilesRouter(cm map[pipeline.ID]xconsumer.Profiles) ProfilesRouterAndConsumer {
consumers := make([]xconsumer.Profiles, 0, len(cm))
for _, cons := range cm {
consumers = append(consumers, cons)
}
return &profilesRouter{
Profiles: fanoutconsumer.NewProfiles(consumers),
BaseRouter: internal.NewBaseRouter(fanoutconsumer.NewProfiles, cm),
}
}

func (r *profilesRouter) privateFunc() {}
// Deprecated: [0.116.0] Use xconnector.NewProfilesRouter instead.
var NewProfilesRouter = xconnector.NewProfilesRouter
44 changes: 22 additions & 22 deletions connector/connectortest/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/connector"
"go.opentelemetry.io/collector/connector/connectorprofiles"
"go.opentelemetry.io/collector/connector/xconnector"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/consumer/xconsumer"
Expand All @@ -32,27 +32,27 @@ type nopConfig struct{}

// NewNopFactory returns a connector.Factory that constructs nop processors.
func NewNopFactory() connector.Factory {
return connectorprofiles.NewFactory(
return xconnector.NewFactory(
nopType,
func() component.Config {
return &nopConfig{}
},
connectorprofiles.WithTracesToTraces(createTracesToTracesConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithTracesToMetrics(createTracesToMetricsConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithTracesToLogs(createTracesToLogsConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithTracesToProfiles(createTracesToProfilesConnector, component.StabilityLevelAlpha),
connectorprofiles.WithMetricsToTraces(createMetricsToTracesConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithMetricsToMetrics(createMetricsToMetricsConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithMetricsToLogs(createMetricsToLogsConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithMetricsToProfiles(createMetricsToProfilesConnector, component.StabilityLevelAlpha),
connectorprofiles.WithLogsToTraces(createLogsToTracesConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithLogsToMetrics(createLogsToMetricsConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithLogsToLogs(createLogsToLogsConnector, component.StabilityLevelDevelopment),
connectorprofiles.WithLogsToProfiles(createLogsToProfilesConnector, component.StabilityLevelAlpha),
connectorprofiles.WithProfilesToTraces(createProfilesToTracesConnector, component.StabilityLevelAlpha),
connectorprofiles.WithProfilesToMetrics(createProfilesToMetricsConnector, component.StabilityLevelAlpha),
connectorprofiles.WithProfilesToLogs(createProfilesToLogsConnector, component.StabilityLevelAlpha),
connectorprofiles.WithProfilesToProfiles(createProfilesToProfilesConnector, component.StabilityLevelAlpha),
xconnector.WithTracesToTraces(createTracesToTracesConnector, component.StabilityLevelDevelopment),
xconnector.WithTracesToMetrics(createTracesToMetricsConnector, component.StabilityLevelDevelopment),
xconnector.WithTracesToLogs(createTracesToLogsConnector, component.StabilityLevelDevelopment),
xconnector.WithTracesToProfiles(createTracesToProfilesConnector, component.StabilityLevelAlpha),
xconnector.WithMetricsToTraces(createMetricsToTracesConnector, component.StabilityLevelDevelopment),
xconnector.WithMetricsToMetrics(createMetricsToMetricsConnector, component.StabilityLevelDevelopment),
xconnector.WithMetricsToLogs(createMetricsToLogsConnector, component.StabilityLevelDevelopment),
xconnector.WithMetricsToProfiles(createMetricsToProfilesConnector, component.StabilityLevelAlpha),
xconnector.WithLogsToTraces(createLogsToTracesConnector, component.StabilityLevelDevelopment),
xconnector.WithLogsToMetrics(createLogsToMetricsConnector, component.StabilityLevelDevelopment),
xconnector.WithLogsToLogs(createLogsToLogsConnector, component.StabilityLevelDevelopment),
xconnector.WithLogsToProfiles(createLogsToProfilesConnector, component.StabilityLevelAlpha),
xconnector.WithProfilesToTraces(createProfilesToTracesConnector, component.StabilityLevelAlpha),
xconnector.WithProfilesToMetrics(createProfilesToMetricsConnector, component.StabilityLevelAlpha),
xconnector.WithProfilesToLogs(createProfilesToLogsConnector, component.StabilityLevelAlpha),
xconnector.WithProfilesToProfiles(createProfilesToProfilesConnector, component.StabilityLevelAlpha),
)
}

Expand Down Expand Up @@ -104,19 +104,19 @@ func createLogsToProfilesConnector(context.Context, connector.Settings, componen
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

func createProfilesToTracesConnector(context.Context, connector.Settings, component.Config, consumer.Traces) (connectorprofiles.Profiles, error) {
func createProfilesToTracesConnector(context.Context, connector.Settings, component.Config, consumer.Traces) (xconnector.Profiles, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

func createProfilesToMetricsConnector(context.Context, connector.Settings, component.Config, consumer.Metrics) (connectorprofiles.Profiles, error) {
func createProfilesToMetricsConnector(context.Context, connector.Settings, component.Config, consumer.Metrics) (xconnector.Profiles, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

func createProfilesToLogsConnector(context.Context, connector.Settings, component.Config, consumer.Logs) (connectorprofiles.Profiles, error) {
func createProfilesToLogsConnector(context.Context, connector.Settings, component.Config, consumer.Logs) (xconnector.Profiles, error) {
return &nopConnector{Consumer: consumertest.NewNop()}, nil
}

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

Expand Down
16 changes: 8 additions & 8 deletions connector/connectortest/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/connector/connectorprofiles"
"go.opentelemetry.io/collector/connector/xconnector"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/pmetric"
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestNewNopConnectorFactory(t *testing.T) {
assert.NoError(t, tracesToLogs.ConsumeTraces(context.Background(), ptrace.NewTraces()))
assert.NoError(t, tracesToLogs.Shutdown(context.Background()))

tracesToProfiles, err := factory.(connectorprofiles.Factory).CreateTracesToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
tracesToProfiles, err := factory.(xconnector.Factory).CreateTracesToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
require.NoError(t, err)
assert.NoError(t, tracesToProfiles.Start(context.Background(), componenttest.NewNopHost()))
assert.NoError(t, tracesToProfiles.ConsumeTraces(context.Background(), ptrace.NewTraces()))
Expand All @@ -69,7 +69,7 @@ func TestNewNopConnectorFactory(t *testing.T) {
assert.NoError(t, metricsToLogs.ConsumeMetrics(context.Background(), pmetric.NewMetrics()))
assert.NoError(t, metricsToLogs.Shutdown(context.Background()))

metricsToProfiles, err := factory.(connectorprofiles.Factory).CreateMetricsToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
metricsToProfiles, err := factory.(xconnector.Factory).CreateMetricsToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
require.NoError(t, err)
assert.NoError(t, metricsToProfiles.Start(context.Background(), componenttest.NewNopHost()))
assert.NoError(t, metricsToProfiles.ConsumeMetrics(context.Background(), pmetric.NewMetrics()))
Expand All @@ -93,31 +93,31 @@ func TestNewNopConnectorFactory(t *testing.T) {
assert.NoError(t, logsToLogs.ConsumeLogs(context.Background(), plog.NewLogs()))
assert.NoError(t, logsToLogs.Shutdown(context.Background()))

logsToProfiles, err := factory.(connectorprofiles.Factory).CreateLogsToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
logsToProfiles, err := factory.(xconnector.Factory).CreateLogsToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
require.NoError(t, err)
assert.NoError(t, logsToProfiles.Start(context.Background(), componenttest.NewNopHost()))
assert.NoError(t, logsToProfiles.ConsumeLogs(context.Background(), plog.NewLogs()))
assert.NoError(t, logsToProfiles.Shutdown(context.Background()))

profilesToTraces, err := factory.(connectorprofiles.Factory).CreateProfilesToTraces(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
profilesToTraces, err := factory.(xconnector.Factory).CreateProfilesToTraces(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
require.NoError(t, err)
assert.NoError(t, profilesToTraces.Start(context.Background(), componenttest.NewNopHost()))
assert.NoError(t, profilesToTraces.ConsumeProfiles(context.Background(), pprofile.NewProfiles()))
assert.NoError(t, profilesToTraces.Shutdown(context.Background()))

profilesToMetrics, err := factory.(connectorprofiles.Factory).CreateProfilesToMetrics(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
profilesToMetrics, err := factory.(xconnector.Factory).CreateProfilesToMetrics(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
require.NoError(t, err)
assert.NoError(t, profilesToMetrics.Start(context.Background(), componenttest.NewNopHost()))
assert.NoError(t, profilesToMetrics.ConsumeProfiles(context.Background(), pprofile.NewProfiles()))
assert.NoError(t, profilesToMetrics.Shutdown(context.Background()))

profilesToLogs, err := factory.(connectorprofiles.Factory).CreateProfilesToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
profilesToLogs, err := factory.(xconnector.Factory).CreateProfilesToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
require.NoError(t, err)
assert.NoError(t, profilesToLogs.Start(context.Background(), componenttest.NewNopHost()))
assert.NoError(t, profilesToLogs.ConsumeProfiles(context.Background(), pprofile.NewProfiles()))
assert.NoError(t, profilesToLogs.Shutdown(context.Background()))

profilesToProfiles, err := factory.(connectorprofiles.Factory).CreateProfilesToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
profilesToProfiles, err := factory.(xconnector.Factory).CreateProfilesToProfiles(context.Background(), NewNopSettings(), cfg, consumertest.NewNop())
require.NoError(t, err)
assert.NoError(t, profilesToProfiles.Start(context.Background(), componenttest.NewNopHost()))
assert.NoError(t, profilesToProfiles.ConsumeProfiles(context.Background(), pprofile.NewProfiles()))
Expand Down
4 changes: 2 additions & 2 deletions connector/connectortest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
go.opentelemetry.io/collector/component v0.115.0
go.opentelemetry.io/collector/component/componenttest v0.115.0
go.opentelemetry.io/collector/connector v0.115.0
go.opentelemetry.io/collector/connector/connectorprofiles v0.115.0
go.opentelemetry.io/collector/connector/xconnector v0.115.0
go.opentelemetry.io/collector/consumer v1.21.0
go.opentelemetry.io/collector/consumer/consumertest v0.115.0
go.opentelemetry.io/collector/consumer/xconsumer v0.115.1-0.20241213185000-4593ba7de234
Expand Down Expand Up @@ -62,7 +62,7 @@ replace go.opentelemetry.io/collector/consumer/xconsumer => ../../consumer/xcons

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

replace go.opentelemetry.io/collector/connector/connectorprofiles => ../connectorprofiles
replace go.opentelemetry.io/collector/connector/xconnector => ../xconnector

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

Expand Down
4 changes: 2 additions & 2 deletions connector/forwardconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.115.0 // indirect
go.opentelemetry.io/collector/connector/connectorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/connector/xconnector v0.115.0 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.115.1-0.20241213185000-4593ba7de234 // indirect
go.opentelemetry.io/collector/internal/fanoutconsumer v0.115.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
Expand Down Expand Up @@ -83,7 +83,7 @@ replace go.opentelemetry.io/collector/consumer/xconsumer => ../../consumer/xcons

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

replace go.opentelemetry.io/collector/connector/connectorprofiles => ../connectorprofiles
replace go.opentelemetry.io/collector/connector/xconnector => ../xconnector

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

Expand Down
1 change: 1 addition & 0 deletions connector/xconnector/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
Loading

0 comments on commit e9bc4bd

Please sign in to comment.