Skip to content

Commit

Permalink
Deprecate processorprofiles module in favor of xprocessor (#11883)
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 13, 2024
1 parent 9299a54 commit 324f5a2
Show file tree
Hide file tree
Showing 30 changed files with 427 additions and 154 deletions.
20 changes: 20 additions & 0 deletions .chloggen/deprecate-processorprofiles.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: processor

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate processorprofiles module in favor of xprocessor 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 @@ -35,5 +35,6 @@ connector/connectorprofiles @open-telemetry/collector-approve
exporter/exporterhelper/exporterhelperprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
exporter/exporterprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
processor/processorprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
processor/xprocessor @open-telemetry/collector-approvers @mx-psi @dmathieu
receiver/receiverprofiles @open-telemetry/collector-approvers @mx-psi @dmathieu
receiver/xreceiver @open-telemetry/collector-approvers @mx-psi @dmathieu
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 @@ -93,7 +93,7 @@ var replaceModules = []string{
"/processor/processortest",
"/processor/batchprocessor",
"/processor/memorylimiterprocessor",
"/processor/processorprofiles",
"/processor/xprocessor",
"/receiver",
"/receiver/nopreceiver",
"/receiver/otlpreceiver",
Expand Down
4 changes: 2 additions & 2 deletions cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.115.0 // indirect
go.opentelemetry.io/collector/receiver/xreceiver v0.115.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
Expand Down Expand Up @@ -105,7 +105,7 @@ replace go.opentelemetry.io/collector/receiver/xreceiver => ../../receiver/xrece

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

replace go.opentelemetry.io/collector/processor/processorprofiles => ../../processor/processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ../../processor/xprocessor

replace go.opentelemetry.io/collector/processor/processortest => ../../processor/processortest

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 @@ -97,7 +97,7 @@ replaces:
- go.opentelemetry.io/collector/processor/processortest => ../../processor/processortest
- go.opentelemetry.io/collector/processor/batchprocessor => ../../processor/batchprocessor
- go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor
- go.opentelemetry.io/collector/processor/processorprofiles => ../../processor/processorprofiles
- go.opentelemetry.io/collector/processor/xprocessor => ../../processor/xprocessor
- go.opentelemetry.io/collector/receiver => ../../receiver
- go.opentelemetry.io/collector/receiver/nopreceiver => ../../receiver/nopreceiver
- go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ require (
go.opentelemetry.io/collector/pdata/testdata v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processortest v0.115.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.115.0 // indirect
go.opentelemetry.io/collector/receiver/receivertest v0.115.0 // indirect
go.opentelemetry.io/collector/receiver/xreceiver v0.115.0 // indirect
go.opentelemetry.io/collector/semconv v0.115.0 // indirect
Expand Down Expand Up @@ -279,7 +279,7 @@ replace go.opentelemetry.io/collector/processor/batchprocessor => ../../processo

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/processor/processorprofiles => ../../processor/processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ../../processor/xprocessor

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

Expand Down
4 changes: 2 additions & 2 deletions internal/e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ require (
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processortest v0.115.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.115.0 // indirect
go.opentelemetry.io/collector/receiver/xreceiver v0.115.0 // indirect
go.opentelemetry.io/collector/semconv v0.115.0 // indirect
go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect
Expand Down Expand Up @@ -216,7 +216,7 @@ replace go.opentelemetry.io/collector/receiver/xreceiver => ../../receiver/xrece

replace go.opentelemetry.io/collector/receiver/receivertest => ../../receiver/receivertest

replace go.opentelemetry.io/collector/processor/processorprofiles => ../../processor/processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ../../processor/xprocessor

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

Expand Down
4 changes: 2 additions & 2 deletions otelcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ require (
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.115.0 // indirect
go.opentelemetry.io/collector/receiver/xreceiver v0.115.0 // indirect
go.opentelemetry.io/collector/semconv v0.115.0 // indirect
go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect
Expand Down Expand Up @@ -183,7 +183,7 @@ replace go.opentelemetry.io/collector/receiver/xreceiver => ../receiver/xreceive

replace go.opentelemetry.io/collector/receiver/receivertest => ../receiver/receivertest

replace go.opentelemetry.io/collector/processor/processorprofiles => ../processor/processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ../processor/xprocessor

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

Expand Down
4 changes: 2 additions & 2 deletions otelcol/otelcoltest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ require (
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline/pipelineprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.115.0 // indirect
go.opentelemetry.io/collector/receiver/xreceiver v0.115.0 // indirect
go.opentelemetry.io/collector/semconv v0.115.0 // indirect
go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect
Expand Down Expand Up @@ -178,7 +178,7 @@ replace go.opentelemetry.io/collector/receiver/xreceiver => ../../receiver/xrece

replace go.opentelemetry.io/collector/receiver/receivertest => ../../receiver/receivertest

replace go.opentelemetry.io/collector/processor/processorprofiles => ../../processor/processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ../../processor/xprocessor

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

Expand Down
4 changes: 2 additions & 2 deletions processor/batchprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
go.opentelemetry.io/collector/consumer/xconsumer v0.115.1-0.20241213185000-4593ba7de234 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.115.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.29.0 // indirect
Expand Down Expand Up @@ -87,7 +87,7 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus

replace go.opentelemetry.io/collector/processor/processorprofiles => ../processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ../xprocessor

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

Expand Down
4 changes: 2 additions & 2 deletions processor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
go.opentelemetry.io/collector/consumer/xconsumer v0.115.1-0.20241213185000-4593ba7de234 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.115.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
Expand Down Expand Up @@ -66,7 +66,7 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../consumer/consu

replace go.opentelemetry.io/collector/component/componentstatus => ../component/componentstatus

replace go.opentelemetry.io/collector/processor/processorprofiles => ./processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ./xprocessor

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

Expand Down
4 changes: 2 additions & 2 deletions processor/memorylimiterprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
go.opentelemetry.io/collector/consumer/xconsumer v0.115.1-0.20241213185000-4593ba7de234 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pdata/testdata v0.115.0 // indirect
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0 // indirect
go.opentelemetry.io/collector/processor/xprocessor v0.115.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
Expand Down Expand Up @@ -96,7 +96,7 @@ replace go.opentelemetry.io/collector/consumer/consumertest => ../../consumer/co

replace go.opentelemetry.io/collector/component/componentstatus => ../../component/componentstatus

replace go.opentelemetry.io/collector/processor/processorprofiles => ../processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ../xprocessor

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

Expand Down
4 changes: 2 additions & 2 deletions processor/processorhelper/processorhelperprofiles/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ require (
go.opentelemetry.io/collector/consumer/xconsumer v0.115.1-0.20241213185000-4593ba7de234
go.opentelemetry.io/collector/pdata/pprofile v0.115.0
go.opentelemetry.io/collector/processor v0.115.0
go.opentelemetry.io/collector/processor/processorprofiles v0.115.0
go.opentelemetry.io/collector/processor/processortest v0.115.0
go.opentelemetry.io/collector/processor/xprocessor v0.115.0
)

require (
Expand Down Expand Up @@ -72,4 +72,4 @@ replace go.opentelemetry.io/collector/component/componentstatus => ../../../comp

replace go.opentelemetry.io/collector/processor/processortest => ../../processortest

replace go.opentelemetry.io/collector/processor/processorprofiles => ../../processorprofiles
replace go.opentelemetry.io/collector/processor/xprocessor => ../../xprocessor
6 changes: 3 additions & 3 deletions processor/processorhelper/processorhelperprofiles/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"go.opentelemetry.io/collector/pdata/pprofile"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/processorhelper"
"go.opentelemetry.io/collector/processor/processorprofiles"
"go.opentelemetry.io/collector/processor/xprocessor"
)

// ProcessProfilesFunc is a helper function that processes the incoming data and returns the data to be sent to the next component.
Expand All @@ -25,15 +25,15 @@ type profiles struct {
xconsumer.Profiles
}

// NewProfiles creates a processorprofiles.Profiles that ensure context propagation.
// NewProfiles creates a xprocessor.Profiles that ensure context propagation.
func NewProfiles(
_ context.Context,
_ processor.Settings,
_ component.Config,
nextConsumer xconsumer.Profiles,
profilesFunc ProcessProfilesFunc,
options ...Option,
) (processorprofiles.Profiles, error) {
) (xprocessor.Profiles, error) {
if profilesFunc == nil {
return nil, errors.New("nil profilesFunc")
}
Expand Down
5 changes: 4 additions & 1 deletion processor/processorprofiles/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
go.opentelemetry.io/collector/component v0.115.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/pipeline v0.115.0
go.opentelemetry.io/collector/processor v0.115.0
go.opentelemetry.io/collector/processor/xprocessor v0.115.0
)

require (
Expand All @@ -22,6 +22,7 @@ require (
go.opentelemetry.io/collector/consumer v1.21.0 // indirect
go.opentelemetry.io/collector/pdata v1.21.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect
go.opentelemetry.io/collector/pipeline v0.115.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
Expand All @@ -38,6 +39,8 @@ require (

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

replace go.opentelemetry.io/collector/processor/xprocessor => ../xprocessor

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

replace go.opentelemetry.io/collector/pdata/pprofile => ../../pdata/pprofile
Expand Down
108 changes: 20 additions & 88 deletions processor/processorprofiles/processor.go
Original file line number Diff line number Diff line change
@@ -1,114 +1,46 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Deprecated: [0.116.0] Use go.opentelemetry.io/collector/processor/xprocessor instead.
package processorprofiles // import "go.opentelemetry.io/collector/processor/processorprofiles"

import (
"context"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer/xconsumer"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/processor"
)
import "go.opentelemetry.io/collector/processor/xprocessor"

// Factory is a component.Factory interface for processors.
//
// This interface cannot be directly implemented. Implementations must
// use the NewFactory to implement it.
type Factory interface {
processor.Factory

// CreateProfiles creates a Profiles processor 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.
CreateProfiles(ctx context.Context, set processor.Settings, cfg component.Config, next xconsumer.Profiles) (Profiles, error)

// ProfilesStability gets the stability level of the Profiles processor.
ProfilesStability() component.StabilityLevel
}
// Deprecated: [0.116.0] Use xprocessor.Factory instead.
type Factory = xprocessor.Factory

// Profiles is a processor that can consume profiles.
type Profiles interface {
component.Component
xconsumer.Profiles
}
// Deprecated: [0.116.0] Use xprocessor.Profiles instead.
type Profiles = xprocessor.Profiles

// CreateProfilesFunc is the equivalent of Factory.CreateProfiles().
// CreateProfilesFunc is the equivalent of Factory.CreateProfiles().
type CreateProfilesFunc func(context.Context, processor.Settings, component.Config, xconsumer.Profiles) (Profiles, error)

// CreateProfiles implements Factory.CreateProfiles.
func (f CreateProfilesFunc) CreateProfiles(ctx context.Context, set processor.Settings, cfg component.Config, next xconsumer.Profiles) (Profiles, error) {
if f == nil {
return nil, pipeline.ErrSignalNotSupported
}
return f(ctx, set, cfg, next)
}
// Deprecated: [0.116.0] Use xprocessor.CreateProfilesFunc instead.
type CreateProfilesFunc = xprocessor.CreateProfilesFunc

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

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

func (f factoryOptionFunc) applyOption(o *factoryOpts) {
f(o)
}

type factory struct {
processor.Factory
CreateProfilesFunc
profilesStabilityLevel component.StabilityLevel
}

func (f factory) ProfilesStability() component.StabilityLevel {
return f.profilesStabilityLevel
}

type factoryOpts struct {
opts []processor.FactoryOption
*factory
}
// Deprecated: [0.116.0] Use xprocessor.FactoryOption instead.
type FactoryOption = xprocessor.FactoryOption

// WithTraces overrides the default "error not supported" implementation for CreateTraces and the default "undefined" stability level.
func WithTraces(createTraces processor.CreateTracesFunc, sl component.StabilityLevel) FactoryOption {
return factoryOptionFunc(func(o *factoryOpts) {
o.opts = append(o.opts, processor.WithTraces(createTraces, sl))
})
}
// Deprecated: [0.116.0] Use xprocessor.WithTraces instead.
var WithTraces = xprocessor.WithTraces

// WithMetrics overrides the default "error not supported" implementation for CreateMetrics and the default "undefined" stability level.
func WithMetrics(createMetrics processor.CreateMetricsFunc, sl component.StabilityLevel) FactoryOption {
return factoryOptionFunc(func(o *factoryOpts) {
o.opts = append(o.opts, processor.WithMetrics(createMetrics, sl))
})
}
// Deprecated: [0.116.0] Use xprocessor.WithMetrics instead.
var WithMetrics = xprocessor.WithMetrics

// WithLogs overrides the default "error not supported" implementation for CreateLogs and the default "undefined" stability level.
func WithLogs(createLogs processor.CreateLogsFunc, sl component.StabilityLevel) FactoryOption {
return factoryOptionFunc(func(o *factoryOpts) {
o.opts = append(o.opts, processor.WithLogs(createLogs, sl))
})
}
// Deprecated: [0.116.0] Use xprocessor.WithLogs instead.
var WithLogs = xprocessor.WithLogs

// WithProfiles overrides the default "error not supported" implementation for CreateProfiles and the default "undefined" stability level.
func WithProfiles(createProfiles CreateProfilesFunc, sl component.StabilityLevel) FactoryOption {
return factoryOptionFunc(func(o *factoryOpts) {
o.profilesStabilityLevel = sl
o.CreateProfilesFunc = createProfiles
})
}
// Deprecated: [0.116.0] Use xprocessor.WithProfiles instead.
var WithProfiles = xprocessor.WithProfiles

// NewFactory returns a Factory.
func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory {
opts := factoryOpts{factory: &factory{}}
for _, opt := range options {
opt.applyOption(&opts)
}
opts.factory.Factory = processor.NewFactory(cfgType, createDefaultConfig, opts.opts...)
return opts.factory
}
// Deprecated: [0.116.0] Use xprocessor.NewFactory instead.
var NewFactory = xprocessor.NewFactory
Loading

0 comments on commit 324f5a2

Please sign in to comment.