From 2fc6b0e893928647341f0f68b65d66a4673b1852 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 4 Jan 2023 08:07:07 -0800 Subject: [PATCH] Remove deprecated component [Traces|Metrics|Logs]Processor and ProcessorFactory (#6884) Signed-off-by: Bogdan Drutu --- .chloggen/rm-deprecated-processor.yaml | 2 +- .chloggen/rmdepprocs.yaml | 11 ++++ component/processor.go | 79 -------------------------- processor/processor.go | 55 ++++++++++++++++-- 4 files changed, 61 insertions(+), 86 deletions(-) create mode 100755 .chloggen/rmdepprocs.yaml delete mode 100644 component/processor.go diff --git a/.chloggen/rm-deprecated-processor.yaml b/.chloggen/rm-deprecated-processor.yaml index ac235e3b500..d4a5722480a 100755 --- a/.chloggen/rm-deprecated-processor.yaml +++ b/.chloggen/rm-deprecated-processor.yaml @@ -5,7 +5,7 @@ change_type: breaking component: component # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Remove deprecated ProcessorFactory +note: Remove deprecated ProcessorFactoryOptions # One or more tracking issues or pull requests related to the change issues: [6881] diff --git a/.chloggen/rmdepprocs.yaml b/.chloggen/rmdepprocs.yaml new file mode 100755 index 00000000000..a811fd43e46 --- /dev/null +++ b/.chloggen/rmdepprocs.yaml @@ -0,0 +1,11 @@ +# 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: component + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Remove deprecated component [Traces|Metrics|Logs]Processor and ProcessorFactory + +# One or more tracking issues or pull requests related to the change +issues: [6884] \ No newline at end of file diff --git a/component/processor.go b/component/processor.go deleted file mode 100644 index 53cbad54030..00000000000 --- a/component/processor.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package component // import "go.opentelemetry.io/collector/component" - -import ( - "context" - - "go.opentelemetry.io/collector/consumer" -) - -// Deprecated: [v0.68.0] use processor.Traces. -type TracesProcessor interface { - Component - consumer.Traces -} - -// Deprecated: [v0.68.0] use processor.Metrics. -type MetricsProcessor interface { - Component - consumer.Metrics -} - -// Deprecated: [v0.68.0] use processor.Logs. -type LogsProcessor interface { - Component - consumer.Logs -} - -// Deprecated: [v0.68.0] use processor.CreateSettings. -type ProcessorCreateSettings struct { - // ID returns the ID of the component that will be created. - ID ID - - TelemetrySettings - - // BuildInfo can be used by components for informational purposes - BuildInfo BuildInfo -} - -// Deprecated: [v0.68.0] use processor.Factory. -type ProcessorFactory interface { - Factory - - // CreateTracesProcessor creates a TracesProcessor based on this config. - // If the processor type does not support tracing or if the config is not valid, - // an error will be returned instead. - CreateTracesProcessor(ctx context.Context, set ProcessorCreateSettings, cfg Config, nextConsumer consumer.Traces) (TracesProcessor, error) - - // TracesProcessorStability gets the stability level of the TracesProcessor. - TracesProcessorStability() StabilityLevel - - // CreateMetricsProcessor creates a MetricsProcessor based on this config. - // If the processor type does not support metrics or if the config is not valid, - // an error will be returned instead. - CreateMetricsProcessor(ctx context.Context, set ProcessorCreateSettings, cfg Config, nextConsumer consumer.Metrics) (MetricsProcessor, error) - - // MetricsProcessorStability gets the stability level of the MetricsProcessor. - MetricsProcessorStability() StabilityLevel - - // CreateLogsProcessor creates a LogsProcessor based on the config. - // If the processor type does not support logs or if the config is not valid, - // an error will be returned instead. - CreateLogsProcessor(ctx context.Context, set ProcessorCreateSettings, cfg Config, nextConsumer consumer.Logs) (LogsProcessor, error) - - // LogsProcessorStability gets the stability level of the LogsProcessor. - LogsProcessorStability() StabilityLevel -} diff --git a/processor/processor.go b/processor/processor.go index ea6863de3cc..6dd4a863a09 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -25,22 +25,65 @@ import ( ) // Traces is a processor that can consume traces. -type Traces = component.TracesProcessor //nolint:staticcheck +type Traces interface { + component.Component + consumer.Traces +} // Metrics is a processor that can consume metrics. -type Metrics = component.MetricsProcessor //nolint:staticcheck +type Metrics interface { + component.Component + consumer.Metrics +} // Logs is a processor that can consume logs. -type Logs = component.LogsProcessor //nolint:staticcheck +type Logs interface { + component.Component + consumer.Logs +} + +// CreateSettings is passed to Create* functions in Factory. +type CreateSettings struct { + // ID returns the ID of the component that will be created. + ID component.ID -// CreateSettings is passed to Create* functions in ProcessorFactory. -type CreateSettings = component.ProcessorCreateSettings //nolint:staticcheck + component.TelemetrySettings + + // BuildInfo can be used by components for informational purposes + BuildInfo component.BuildInfo +} // Factory is Factory interface for processors. // // This interface cannot be directly implemented. Implementations must // use the NewProcessorFactory to implement it. -type Factory = component.ProcessorFactory //nolint:staticcheck +type Factory interface { + component.Factory + + // CreateTracesProcessor creates a TracesProcessor based on this config. + // If the processor type does not support tracing or if the config is not valid, + // an error will be returned instead. + CreateTracesProcessor(ctx context.Context, set CreateSettings, cfg component.Config, nextConsumer consumer.Traces) (Traces, error) + + // TracesProcessorStability gets the stability level of the TracesProcessor. + TracesProcessorStability() component.StabilityLevel + + // CreateMetricsProcessor creates a MetricsProcessor based on this config. + // If the processor type does not support metrics or if the config is not valid, + // an error will be returned instead. + CreateMetricsProcessor(ctx context.Context, set CreateSettings, cfg component.Config, nextConsumer consumer.Metrics) (Metrics, error) + + // MetricsProcessorStability gets the stability level of the MetricsProcessor. + MetricsProcessorStability() component.StabilityLevel + + // CreateLogsProcessor creates a LogsProcessor based on the config. + // If the processor type does not support logs or if the config is not valid, + // an error will be returned instead. + CreateLogsProcessor(ctx context.Context, set CreateSettings, cfg component.Config, nextConsumer consumer.Logs) (Logs, error) + + // LogsProcessorStability gets the stability level of the LogsProcessor. + LogsProcessorStability() component.StabilityLevel +} // FactoryOption apply changes to Options. type FactoryOption interface {