-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate processorprofiles module in favor of xprocessor (#11883)
to allow adding more experimental data types Updates #11778
- Loading branch information
Showing
30 changed files
with
427 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.