Skip to content

Commit

Permalink
Remove deprecated funcs from receiver package (#11367)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Oct 7, 2024
1 parent 8e000ea commit 2278eed
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 75 deletions.
20 changes: 20 additions & 0 deletions .chloggen/rm-dep-receiver.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: breaking

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove deprecated funcs from receiver package

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

# 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]
60 changes: 6 additions & 54 deletions receiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Logs interface {
component.Component
}

// Settings configures Receiver creators.
// Settings configures receiver creators.
type Settings struct {
// ID returns the ID of the component that will be created.
ID component.ID
Expand All @@ -53,7 +53,7 @@ type Settings struct {
// Factory is a factory interface for receivers.
//
// This interface cannot be directly implemented. Implementations must
// use the NewReceiverFactory to implement it.
// use the NewFactory to implement it.
type Factory interface {
component.Factory

Expand All @@ -63,45 +63,27 @@ type Factory interface {
// Implementers can assume `next` is never nil.
CreateTraces(ctx context.Context, set Settings, cfg component.Config, next consumer.Traces) (Traces, error)

// Deprecated: [v0.111.0] Use CreateTraces.
CreateTracesReceiver(ctx context.Context, set Settings, cfg component.Config, next consumer.Traces) (Traces, error)

// TracesStability gets the stability level of the TracesReceiver.
// TracesStability gets the stability level of the Traces receiver.
TracesStability() component.StabilityLevel

// Deprecated: [v0.111.0] Use TracesStability.
TracesReceiverStability() component.StabilityLevel

// CreateMetrics creates a Metrics based on this config.
// If the receiver type does not support metrics,
// this function returns the error [pipeline.ErrSignalNotSupported].
// Implementers can assume `next` is never nil.
CreateMetrics(ctx context.Context, set Settings, cfg component.Config, next consumer.Metrics) (Metrics, error)

// Deprecated: [v0.111.0] Use CreateMetrics.
CreateMetricsReceiver(ctx context.Context, set Settings, cfg component.Config, next consumer.Metrics) (Metrics, error)

// MetricsStability gets the stability level of the MetricsReceiver.
// MetricsStability gets the stability level of the Metrics receiver.
MetricsStability() component.StabilityLevel

// Deprecated: [v0.111.0] Use MetricsStability.
MetricsReceiverStability() component.StabilityLevel

// CreateLogs creates a Logs based on this config.
// If the receiver type does not support logs,
// this function returns the error [pipeline.ErrSignalNotSupported].
// Implementers can assume `next` is never nil.
CreateLogs(ctx context.Context, set Settings, cfg component.Config, next consumer.Logs) (Logs, error)

// Deprecated: [v0.111.0] Use CreateLogs.
CreateLogsReceiver(ctx context.Context, set Settings, cfg component.Config, next consumer.Logs) (Logs, error)

// LogsStability gets the stability level of the LogsReceiver.
// LogsStability gets the stability level of the Logs receiver.
LogsStability() component.StabilityLevel

// Deprecated: [v0.111.0] Use LogsStability.
LogsReceiverStability() component.StabilityLevel

unexportedFactoryFunc()
}

Expand All @@ -111,7 +93,7 @@ type FactoryOption interface {
applyOption(o *factory)
}

// factoryOptionFunc is an ReceiverFactoryOption created through a function.
// factoryOptionFunc is an FactoryOption created through a function.
type factoryOptionFunc func(*factory)

func (f factoryOptionFunc) applyOption(o *factory) {
Expand All @@ -129,11 +111,6 @@ func (f CreateTracesFunc) CreateTraces(ctx context.Context, set Settings, cfg co
return f(ctx, set, cfg, next)
}

// Deprecated: [v0.111.0] Use CreateTraces.
func (f CreateTracesFunc) CreateTracesReceiver(ctx context.Context, set Settings, cfg component.Config, next consumer.Traces) (Traces, error) {
return f.CreateTraces(ctx, set, cfg, next)
}

// CreateMetricsFunc is the equivalent of Factory.CreateMetrics.
type CreateMetricsFunc func(context.Context, Settings, component.Config, consumer.Metrics) (Metrics, error)

Expand All @@ -145,11 +122,6 @@ func (f CreateMetricsFunc) CreateMetrics(ctx context.Context, set Settings, cfg
return f(ctx, set, cfg, next)
}

// Deprecated: [v0.111.0] Use CreateMetrics.
func (f CreateMetricsFunc) CreateMetricsReceiver(ctx context.Context, set Settings, cfg component.Config, next consumer.Metrics) (Metrics, error) {
return f.CreateMetrics(ctx, set, cfg, next)
}

// CreateLogsFunc is the equivalent of Factory.CreateLogs.
type CreateLogsFunc func(context.Context, Settings, component.Config, consumer.Logs) (Logs, error)

Expand All @@ -161,11 +133,6 @@ func (f CreateLogsFunc) CreateLogs(ctx context.Context, set Settings, cfg compon
return f(ctx, set, cfg, next)
}

// Deprecated: [v0.111.0] Use CreateLogs.
func (f CreateLogsFunc) CreateLogsReceiver(ctx context.Context, set Settings, cfg component.Config, next consumer.Logs) (Logs, error) {
return f.CreateLogs(ctx, set, cfg, next)
}

type factory struct {
cfgType component.Type
component.CreateDefaultConfigFunc
Expand Down Expand Up @@ -195,21 +162,6 @@ func (f *factory) LogsStability() component.StabilityLevel {
return f.logsStabilityLevel
}

// Deprecated: [v0.111.0] use TracesStability.
func (f *factory) TracesReceiverStability() component.StabilityLevel {
return f.TracesStability()
}

// Deprecated: [v0.111.0] use MetricsStability.
func (f *factory) MetricsReceiverStability() component.StabilityLevel {
return f.MetricsStability()
}

// Deprecated: [v0.111.0] use LogsStability.
func (f *factory) LogsReceiverStability() component.StabilityLevel {
return f.LogsStability()
}

// WithTraces overrides the default "error not supported" implementation for Factory.CreateTraces and the default "undefined" stability level.
func WithTraces(createTraces CreateTracesFunc, sl component.StabilityLevel) FactoryOption {
return factoryOptionFunc(func(o *factory) {
Expand Down
26 changes: 5 additions & 21 deletions receiver/receiverprofiles/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// Profiles receiver receives profiles.
// Its purpose is to translate data from any format to the collector's internal profile format.
// ProfilessReceiver feeds a consumerprofiles.Profiles with data.
// Profiles receiver feeds a consumerprofiles.Profiles with data.
//
// For example, it could be a pprof data source which translates pprof profiles into pprofile.Profiles.
type Profiles interface {
Expand All @@ -24,7 +24,7 @@ type Profiles interface {
// Factory is a factory interface for receivers.
//
// This interface cannot be directly implemented. Implementations must
// use the NewReceiverFactory to implement it.
// use the NewFactory to implement it.
type Factory interface {
receiver.Factory

Expand All @@ -33,14 +33,8 @@ type Factory interface {
// an error will be returned instead. `next` is never nil.
CreateProfiles(ctx context.Context, set receiver.Settings, cfg component.Config, next consumerprofiles.Profiles) (Profiles, error)

// Deprecated: [v0.111.0] use CreateProfiles.
CreateProfilesReceiver(ctx context.Context, set receiver.Settings, cfg component.Config, next consumerprofiles.Profiles) (Profiles, error)

// ProfilesStability gets the stability level of the ProfilesReceiver.
// ProfilesStability gets the stability level of the Profiles receiver.
ProfilesStability() component.StabilityLevel

// Deprecated: [v0.111.0] use ProfilesStability.
ProfilesReceiverStability() component.StabilityLevel
}

// CreateProfilesFunc is the equivalent of Factory.CreateProfiles.
Expand All @@ -54,18 +48,13 @@ func (f CreateProfilesFunc) CreateProfiles(ctx context.Context, set receiver.Set
return f(ctx, set, cfg, next)
}

// Deprecated: [v0.111.0] use CreateProfiles.
func (f CreateProfilesFunc) CreateProfilesReceiver(ctx context.Context, set receiver.Settings, cfg component.Config, next consumerprofiles.Profiles) (Profiles, error) {
return f.CreateProfiles(ctx, set, cfg, next)
}

// FactoryOption apply changes to ReceiverOptions.
// FactoryOption apply changes to Factory.
type FactoryOption interface {
// applyOption applies the option.
applyOption(o *factoryOpts)
}

// factoryOptionFunc is an ReceiverFactoryOption created through a function.
// factoryOptionFunc is a FactoryOption created through a function.
type factoryOptionFunc func(*factoryOpts)

func (f factoryOptionFunc) applyOption(o *factoryOpts) {
Expand All @@ -82,11 +71,6 @@ func (f *factory) ProfilesStability() component.StabilityLevel {
return f.profilesStabilityLevel
}

// Deprecated: [v0.111.0] use ProfilesStability.
func (f *factory) ProfilesReceiverStability() component.StabilityLevel {
return f.ProfilesStability()
}

type factoryOpts struct {
opts []receiver.FactoryOption
*factory
Expand Down

0 comments on commit 2278eed

Please sign in to comment.