Skip to content

Commit

Permalink
[service] remove deprecated types (open-telemetry#11361)
Browse files Browse the repository at this point in the history
#### Description
Removes deprecated types

#### Link to tracking issue
Related to
open-telemetry#9429
  • Loading branch information
TylerHelmuth authored and jackgopack4 committed Oct 8, 2024
1 parent d4a3ac6 commit f72070c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 91 deletions.
25 changes: 25 additions & 0 deletions .chloggen/service-remove-deprecated-funcs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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: service

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove deprecated `pipelines.ConfigWithPipelineID` and `Config.PipelinesWithPipelineID`. Use `pipelines.Config` and `Config.Pipelines` instead.

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

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# 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]
37 changes: 0 additions & 37 deletions otelcol/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,43 +118,6 @@ func (cfg *Config) Validate() error {
}
}

// Check that all pipelines reference only configured components.
// nolint
for pipelineID, pipeline := range cfg.Service.PipelinesWithPipelineID {
// Validate pipeline receiver name references.
for _, ref := range pipeline.Receivers {
// Check that the name referenced in the pipeline's receivers exists in the top-level receivers.
if _, ok := cfg.Receivers[ref]; ok {
continue
}

if _, ok := cfg.Connectors[ref]; ok {
continue
}
return fmt.Errorf("service::pipelines::%s: references receiver %q which is not configured", pipelineID, ref)
}

// Validate pipeline processor name references.
for _, ref := range pipeline.Processors {
// Check that the name referenced in the pipeline's processors exists in the top-level processors.
if cfg.Processors[ref] == nil {
return fmt.Errorf("service::pipelines::%s: references processor %q which is not configured", pipelineID, ref)
}
}

// Validate pipeline exporter name references.
for _, ref := range pipeline.Exporters {
// Check that the name referenced in the pipeline's Exporters exists in the top-level Exporters.
if _, ok := cfg.Exporters[ref]; ok {
continue
}
if _, ok := cfg.Connectors[ref]; ok {
continue
}
return fmt.Errorf("service::pipelines::%s: references exporter %q which is not configured", pipelineID, ref)
}
}

// Check that all pipelines reference only configured components.
for pipelineID, pipeline := range cfg.Service.Pipelines {
// Validate pipeline receiver name references.
Expand Down
19 changes: 2 additions & 17 deletions service/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,11 @@ type Config struct {

// Pipelines are the set of data pipelines configured for the service.
Pipelines pipelines.Config `mapstructure:"pipelines"`

// Pipelines are the set of data pipelines configured for the service.
//
// Deprecated: [v0.111.0] Use Pipelines instead.
PipelinesWithPipelineID pipelines.ConfigWithPipelineID `mapstructure:"-"` // nolint
}

func (cfg *Config) Validate() error {
if len(cfg.Pipelines) > 0 && len(cfg.PipelinesWithPipelineID) > 0 {
return fmt.Errorf("service::pipelines config validation failed: cannot configure both Pipelines and PipelinesWithPipelineID")
}

if len(cfg.PipelinesWithPipelineID) > 0 {
if err := cfg.PipelinesWithPipelineID.Validate(); err != nil {
return fmt.Errorf("service::pipelines config validation failed: %w", err)
}
} else {
if err := cfg.Pipelines.Validate(); err != nil {
return fmt.Errorf("service::pipelines config validation failed: %w", err)
}
if err := cfg.Pipelines.Validate(); err != nil {
return fmt.Errorf("service::pipelines config validation failed: %w", err)
}

if err := cfg.Telemetry.Validate(); err != nil {
Expand Down
28 changes: 0 additions & 28 deletions service/pipelines/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,6 @@ func (cfg Config) Validate() error {
return nil
}

// Deprecated: [v0.111.0] Use Config instead
type ConfigWithPipelineID map[pipeline.ID]*PipelineConfig

func (cfg ConfigWithPipelineID) Validate() error {
// Must have at least one pipeline.
if len(cfg) == 0 {
return errMissingServicePipelines
}

// Check that all pipelines have at least one receiver and one exporter, and they reference
// only configured components.
for pipelineID, p := range cfg {
switch pipelineID.Signal() {
case pipeline.SignalTraces, pipeline.SignalMetrics, pipeline.SignalLogs, componentprofiles.SignalProfiles:
// Continue
default:
return fmt.Errorf("pipeline %q: unknown signal %q", pipelineID.String(), pipelineID.Signal())
}

// Validate pipeline has at least one receiver.
if err := p.Validate(); err != nil {
return fmt.Errorf("pipeline %q: %w", pipelineID.String(), err)
}
}

return nil
}

// PipelineConfig defines the configuration of a Pipeline.
type PipelineConfig struct {
Receivers []component.ID `mapstructure:"receivers"`
Expand Down
9 changes: 0 additions & 9 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"go.opentelemetry.io/collector/service/internal/proctelemetry"
"go.opentelemetry.io/collector/service/internal/resource"
"go.opentelemetry.io/collector/service/internal/status"
"go.opentelemetry.io/collector/service/pipelines"
"go.opentelemetry.io/collector/service/telemetry"
)

Expand Down Expand Up @@ -305,14 +304,6 @@ func (srv *Service) initExtensions(ctx context.Context, cfg extensions.Config) e

// Creates the pipeline graph.
func (srv *Service) initGraph(ctx context.Context, cfg Config) error {
// nolint
if len(cfg.PipelinesWithPipelineID) > 0 {
cfg.Pipelines = make(pipelines.Config, len(cfg.PipelinesWithPipelineID))
for k, v := range cfg.PipelinesWithPipelineID {
cfg.Pipelines[k] = v
}
}

var err error
if srv.host.Pipelines, err = graph.Build(ctx, graph.Settings{
Telemetry: srv.telemetrySettings,
Expand Down

0 comments on commit f72070c

Please sign in to comment.