Remove deprecated funcs from processor package (#11368)

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
Bogdan Drutu 2024-10-07 09:36:18 -07:00 committed by GitHub
parent 0d1d6a28c6
commit 8e000eae83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 27 additions and 72 deletions

View File

@ -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: processor
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove deprecated funcs from processor package
# One or more tracking issues or pull requests related to the change
issues: [11368]
# 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]

View File

@ -54,52 +54,34 @@ 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.
CreateTracesProcessor(ctx context.Context, set Settings, cfg component.Config, next consumer.Traces) (Traces, error)
// TracesStability gets the stability level of the Traces processor.
TracesStability() component.StabilityLevel
// Deprecated: [v0.111.0] use TracesStability.
TracesProcessorStability() component.StabilityLevel
// CreateMetrics creates a Metrics processor based on this config.
// If the processor 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.
CreateMetricsProcessor(ctx context.Context, set Settings, cfg component.Config, next consumer.Metrics) (Metrics, error)
// MetricsStability gets the stability level of the Metrics processor.
MetricsStability() component.StabilityLevel
// Deprecated: [v0.111.0] use MetricsStability.
MetricsProcessorStability() component.StabilityLevel
// CreateLogs creates a Logs processor based on the config.
// If the processor 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.
CreateLogsProcessor(ctx context.Context, set Settings, cfg component.Config, next consumer.Logs) (Logs, error)
// LogsStability gets the stability level of the Logs processor.
LogsStability() component.StabilityLevel
// Deprecated: [v0.111.0] use LogsStability.
LogsProcessorStability() component.StabilityLevel
unexportedFactoryFunc()
}
// FactoryOption apply changes to Options.
type FactoryOption interface {
// applyProcessorFactoryOption applies the option.
applyProcessorFactoryOption(o *factory)
// applyOption applies the option.
applyOption(o *factory)
}
var _ FactoryOption = (*factoryOptionFunc)(nil)
@ -107,7 +89,7 @@ var _ FactoryOption = (*factoryOptionFunc)(nil)
// factoryOptionFunc is a FactoryOption created through a function.
type factoryOptionFunc func(*factory)
func (f factoryOptionFunc) applyProcessorFactoryOption(o *factory) {
func (f factoryOptionFunc) applyOption(o *factory) {
f(o)
}
@ -128,30 +110,15 @@ func (f *factory) Type() component.Type {
func (f *factory) unexportedFactoryFunc() {}
func (f factory) TracesStability() component.StabilityLevel {
func (f *factory) TracesStability() component.StabilityLevel {
return f.tracesStabilityLevel
}
// Deprecated: [v0.111.0] use TracesStability.
func (f factory) TracesProcessorStability() component.StabilityLevel {
return f.tracesStabilityLevel
}
func (f factory) MetricsStability() component.StabilityLevel {
func (f *factory) MetricsStability() component.StabilityLevel {
return f.metricsStabilityLevel
}
// Deprecated: [v0.111.0] use MetricsStability.
func (f factory) MetricsProcessorStability() component.StabilityLevel {
return f.tracesStabilityLevel
}
func (f factory) LogsStability() component.StabilityLevel {
return f.logsStabilityLevel
}
// Deprecated: [v0.111.0] use LogsStability.
func (f factory) LogsProcessorStability() component.StabilityLevel {
func (f *factory) LogsStability() component.StabilityLevel {
return f.logsStabilityLevel
}
@ -166,11 +133,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) CreateTracesProcessor(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)
@ -182,11 +144,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) CreateMetricsProcessor(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)
@ -198,11 +155,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) CreateLogsProcessor(ctx context.Context, set Settings, cfg component.Config, next consumer.Logs) (Logs, error) {
return f.CreateLogs(ctx, set, cfg, next)
}
// WithTraces overrides the default "error not supported" implementation for CreateTraces and the default "undefined" stability level.
func WithTraces(createTraces CreateTracesFunc, sl component.StabilityLevel) FactoryOption {
return factoryOptionFunc(func(o *factory) {
@ -234,7 +186,7 @@ func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefa
CreateDefaultConfigFunc: createDefaultConfig,
}
for _, opt := range options {
opt.applyProcessorFactoryOption(f)
opt.applyOption(f)
}
return f
}

View File

@ -75,6 +75,3 @@ func NewLogs(
Logs: logsConsumer,
}, nil
}
// Deprecated: [v0.111.0] use NewTraces.
var NewLogsProcessor = NewLogs

View File

@ -75,6 +75,3 @@ func NewMetrics(
Metrics: metricsConsumer,
}, nil
}
// Deprecated: [v0.111.0] use NewMetrics.
var NewMetricsProcessor = NewMetrics

View File

@ -76,6 +76,3 @@ func NewTraces(
Traces: traceConsumer,
}, nil
}
// Deprecated: [v0.111.0] use NewTraces.
var NewTracesProcessor = NewTraces

View File

@ -24,9 +24,6 @@ type Factory interface {
// an error will be returned instead.
CreateProfiles(ctx context.Context, set processor.Settings, cfg component.Config, next consumerprofiles.Profiles) (Profiles, error)
// Deprecated: [v0.111.0] use CreateProfiles.
CreateProfilesProcessor(ctx context.Context, set processor.Settings, cfg component.Config, next consumerprofiles.Profiles) (Profiles, error)
// ProfilesStability gets the stability level of the Profiles processor.
ProfilesStability() component.StabilityLevel
}
@ -49,11 +46,6 @@ func (f CreateProfilesFunc) CreateProfiles(ctx context.Context, set processor.Se
return f(ctx, set, cfg, next)
}
// Deprecated: [v0.111.0] use CreateProfiles.
func (f CreateProfilesFunc) CreateProfilesProcessor(ctx context.Context, set processor.Settings, cfg component.Config, next consumerprofiles.Profiles) (Profiles, error) {
return f.CreateProfiles(ctx, set, cfg, next)
}
// FactoryOption apply changes to ReceiverOptions.
type FactoryOption interface {
// applyOption applies the option.