Skip to content

Commit

Permalink
Remove ottlconfig package
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-bradley committed Oct 4, 2022
1 parent fab4a13 commit cf15995
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .chloggen/ottl-statements-rename.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ change_type: breaking
component: pkg/ottl

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Rename the `Queries` signal configuration field to `Statements`.
note: Rename the `Queries` signal configuration field to `Statements` and remove the `ottlconfig` package.

# One or more tracking issues related to the change
issues: [14680]
Expand Down
27 changes: 0 additions & 27 deletions pkg/ottl/ottlconfig/config.go

This file was deleted.

13 changes: 11 additions & 2 deletions processor/transformprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottldatapoints"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottllogs"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottltraces"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlconfig"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor/internal/logs"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor/internal/metrics"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor/internal/traces"
Expand All @@ -32,7 +31,17 @@ import (
type Config struct {
config.ProcessorSettings `mapstructure:",squash"`

ottlconfig.Config `mapstructure:",squash"`
OTTLConfig `mapstructure:",squash"`
}

type OTTLConfig struct {
Traces SignalConfig `mapstructure:"traces"`
Metrics SignalConfig `mapstructure:"metrics"`
Logs SignalConfig `mapstructure:"logs"`
}

type SignalConfig struct {
Statements []string `mapstructure:"statements"`
}

var _ config.Processor = (*Config)(nil)
Expand Down
10 changes: 4 additions & 6 deletions processor/transformprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlconfig"
)

func TestLoadConfig(t *testing.T) {
Expand All @@ -38,20 +36,20 @@ func TestLoadConfig(t *testing.T) {
id: config.NewComponentIDWithName(typeStr, ""),
expected: &Config{
ProcessorSettings: config.NewProcessorSettings(config.NewComponentID(typeStr)),
Config: ottlconfig.Config{
Traces: ottlconfig.SignalConfig{
OTTLConfig: OTTLConfig{
Traces: SignalConfig{
Statements: []string{
`set(name, "bear") where attributes["http.path"] == "/animal"`,
`keep_keys(attributes, "http.method", "http.path")`,
},
},
Metrics: ottlconfig.SignalConfig{
Metrics: SignalConfig{
Statements: []string{
`set(metric.name, "bear") where attributes["http.path"] == "/animal"`,
`keep_keys(attributes, "http.method", "http.path")`,
},
},
Logs: ottlconfig.SignalConfig{
Logs: SignalConfig{
Statements: []string{
`set(body, "bear") where attributes["http.path"] == "/animal"`,
`keep_keys(attributes, "http.method", "http.path")`,
Expand Down
9 changes: 4 additions & 5 deletions processor/transformprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/processor/processorhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlconfig"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor/internal/logs"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor/internal/metrics"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor/internal/traces"
Expand All @@ -49,14 +48,14 @@ func NewFactory() component.ProcessorFactory {
func createDefaultConfig() config.Processor {
return &Config{
ProcessorSettings: config.NewProcessorSettings(config.NewComponentID(typeStr)),
Config: ottlconfig.Config{
Logs: ottlconfig.SignalConfig{
OTTLConfig: OTTLConfig{
Logs: SignalConfig{
Statements: []string{},
},
Traces: ottlconfig.SignalConfig{
Traces: SignalConfig{
Statements: []string{},
},
Metrics: ottlconfig.SignalConfig{
Metrics: SignalConfig{
Statements: []string{},
},
},
Expand Down
10 changes: 4 additions & 6 deletions processor/transformprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import (
"go.opentelemetry.io/collector/pdata/plog"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlconfig"
)

func TestFactory_Type(t *testing.T) {
Expand All @@ -40,14 +38,14 @@ func TestFactory_CreateDefaultConfig(t *testing.T) {
cfg := factory.CreateDefaultConfig()
assert.Equal(t, cfg, &Config{
ProcessorSettings: config.NewProcessorSettings(config.NewComponentID(typeStr)),
Config: ottlconfig.Config{
Traces: ottlconfig.SignalConfig{
OTTLConfig: OTTLConfig{
Traces: SignalConfig{
Statements: []string{},
},
Metrics: ottlconfig.SignalConfig{
Metrics: SignalConfig{
Statements: []string{},
},
Logs: ottlconfig.SignalConfig{
Logs: SignalConfig{
Statements: []string{},
},
},
Expand Down

0 comments on commit cf15995

Please sign in to comment.