Skip to content

Commit e7c74eb

Browse files
authored
Move configmodels to config (#2808)
Signed-off-by: Bogdan Drutu <[email protected]>
1 parent 4daf2a1 commit e7c74eb

File tree

189 files changed

+925
-933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+925
-933
lines changed

cmd/mdatagen/metrics.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
package {{ .Package }}
1818

1919
import (
20-
"go.opentelemetry.io/collector/config/configmodels"
20+
"go.opentelemetry.io/collector/config"
2121
"go.opentelemetry.io/collector/consumer/pdata"
2222
)
2323

2424
// Type is the component type name.
25-
const Type configmodels.Type = "{{ .Name }}"
25+
const Type config.Type = "{{ .Name }}"
2626

2727
// MetricIntf is an interface to generically interact with generated metric.
2828
type MetricIntf interface {

cmd/schemagen/schemagen/cli_all.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package schemagen
1616

1717
import (
1818
"go.opentelemetry.io/collector/component"
19-
"go.opentelemetry.io/collector/config/configmodels"
19+
"go.opentelemetry.io/collector/config"
2020
)
2121

2222
// createAllSchemaFiles creates config yaml schema files for all registered components
@@ -27,8 +27,8 @@ func createAllSchemaFiles(components component.Factories, env env) {
2727
}
2828
}
2929

30-
func getAllConfigs(components component.Factories) []configmodels.NamedEntity {
31-
var cfgs []configmodels.NamedEntity
30+
func getAllConfigs(components component.Factories) []config.NamedEntity {
31+
var cfgs []config.NamedEntity
3232
for _, f := range components.Receivers {
3333
cfgs = append(cfgs, f.CreateDefaultConfig())
3434
}

cmd/schemagen/schemagen/cli_single.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"os"
2020

2121
"go.opentelemetry.io/collector/component"
22-
"go.opentelemetry.io/collector/config/configmodels"
22+
"go.opentelemetry.io/collector/config"
2323
)
2424

2525
// createSingleSchemaFile creates a config schema yaml file for a single component
@@ -32,8 +32,8 @@ func createSingleSchemaFile(components component.Factories, componentType, compo
3232
createSchemaFile(cfg, env)
3333
}
3434

35-
func getConfig(components component.Factories, componentType, componentName string) (configmodels.NamedEntity, error) {
36-
t := configmodels.Type(componentName)
35+
func getConfig(components component.Factories, componentType, componentName string) (config.NamedEntity, error) {
36+
t := config.Type(componentName)
3737
switch componentType {
3838
case "receiver":
3939
c := components.Receivers[t]

component/component.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
"github.com/spf13/viper"
2121

22-
"go.opentelemetry.io/collector/config/configmodels"
22+
"go.opentelemetry.io/collector/config"
2323
)
2424

2525
// Component is either a receiver, exporter, processor or extension.
@@ -76,7 +76,7 @@ const (
7676
// Factory interface must be implemented by all component factories.
7777
type Factory interface {
7878
// Type gets the type of the component created by this factory.
79-
Type() configmodels.Type
79+
Type() config.Type
8080
}
8181

8282
// ConfigUnmarshaler interface is an optional interface that if implemented by a Factory,

component/componenttest/nop_exporter.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
"go.opentelemetry.io/collector/component"
2121
"go.opentelemetry.io/collector/component/componenthelper"
22-
"go.opentelemetry.io/collector/config/configmodels"
22+
"go.opentelemetry.io/collector/config"
2323
"go.opentelemetry.io/collector/consumer"
2424
"go.opentelemetry.io/collector/consumer/consumertest"
2525
)
@@ -35,13 +35,13 @@ func NewNopExporterFactory() component.ExporterFactory {
3535
}
3636

3737
// Type gets the type of the Exporter config created by this factory.
38-
func (f *nopExporterFactory) Type() configmodels.Type {
38+
func (f *nopExporterFactory) Type() config.Type {
3939
return "nop"
4040
}
4141

4242
// CreateDefaultConfig creates the default configuration for the Exporter.
43-
func (f *nopExporterFactory) CreateDefaultConfig() configmodels.Exporter {
44-
return &configmodels.ExporterSettings{
43+
func (f *nopExporterFactory) CreateDefaultConfig() config.Exporter {
44+
return &config.ExporterSettings{
4545
TypeVal: f.Type(),
4646
}
4747
}
@@ -50,7 +50,7 @@ func (f *nopExporterFactory) CreateDefaultConfig() configmodels.Exporter {
5050
func (f *nopExporterFactory) CreateTracesExporter(
5151
_ context.Context,
5252
_ component.ExporterCreateParams,
53-
_ configmodels.Exporter,
53+
_ config.Exporter,
5454
) (component.TracesExporter, error) {
5555
return nopExporterInstance, nil
5656
}
@@ -59,7 +59,7 @@ func (f *nopExporterFactory) CreateTracesExporter(
5959
func (f *nopExporterFactory) CreateMetricsExporter(
6060
_ context.Context,
6161
_ component.ExporterCreateParams,
62-
_ configmodels.Exporter,
62+
_ config.Exporter,
6363
) (component.MetricsExporter, error) {
6464
return nopExporterInstance, nil
6565
}
@@ -68,7 +68,7 @@ func (f *nopExporterFactory) CreateMetricsExporter(
6868
func (f *nopExporterFactory) CreateLogsExporter(
6969
_ context.Context,
7070
_ component.ExporterCreateParams,
71-
_ configmodels.Exporter,
71+
_ config.Exporter,
7272
) (component.LogsExporter, error) {
7373
return nopExporterInstance, nil
7474
}

component/componenttest/nop_exporter_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ import (
2222
"github.com/stretchr/testify/require"
2323

2424
"go.opentelemetry.io/collector/component"
25-
"go.opentelemetry.io/collector/config/configmodels"
25+
"go.opentelemetry.io/collector/config"
2626
"go.opentelemetry.io/collector/consumer/pdata"
2727
)
2828

2929
func TestNewNopExporterFactory(t *testing.T) {
3030
factory := NewNopExporterFactory()
3131
require.NotNil(t, factory)
32-
assert.Equal(t, configmodels.Type("nop"), factory.Type())
32+
assert.Equal(t, config.Type("nop"), factory.Type())
3333
cfg := factory.CreateDefaultConfig()
34-
assert.Equal(t, &configmodels.ExporterSettings{TypeVal: factory.Type()}, cfg)
34+
assert.Equal(t, &config.ExporterSettings{TypeVal: factory.Type()}, cfg)
3535

3636
traces, err := factory.CreateTracesExporter(context.Background(), component.ExporterCreateParams{}, cfg)
3737
require.NoError(t, err)

component/componenttest/nop_extension.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
"go.opentelemetry.io/collector/component"
2121
"go.opentelemetry.io/collector/component/componenthelper"
22-
"go.opentelemetry.io/collector/config/configmodels"
22+
"go.opentelemetry.io/collector/config"
2323
)
2424

2525
// nopExtensionFactory is factory for nopExtension.
@@ -33,13 +33,13 @@ func NewNopExtensionFactory() component.ExtensionFactory {
3333
}
3434

3535
// Type gets the type of the Extension config created by this factory.
36-
func (f *nopExtensionFactory) Type() configmodels.Type {
36+
func (f *nopExtensionFactory) Type() config.Type {
3737
return "nop"
3838
}
3939

4040
// CreateDefaultConfig creates the default configuration for the Extension.
41-
func (f *nopExtensionFactory) CreateDefaultConfig() configmodels.Extension {
42-
return &configmodels.ExtensionSettings{
41+
func (f *nopExtensionFactory) CreateDefaultConfig() config.Extension {
42+
return &config.ExtensionSettings{
4343
TypeVal: f.Type(),
4444
}
4545
}
@@ -48,7 +48,7 @@ func (f *nopExtensionFactory) CreateDefaultConfig() configmodels.Extension {
4848
func (f *nopExtensionFactory) CreateExtension(
4949
_ context.Context,
5050
_ component.ExtensionCreateParams,
51-
_ configmodels.Extension,
51+
_ config.Extension,
5252
) (component.Extension, error) {
5353
return nopExtensionInstance, nil
5454
}

component/componenttest/nop_extension_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ import (
2222
"github.com/stretchr/testify/require"
2323

2424
"go.opentelemetry.io/collector/component"
25-
"go.opentelemetry.io/collector/config/configmodels"
25+
"go.opentelemetry.io/collector/config"
2626
)
2727

2828
func TestNewNopExtensionFactory(t *testing.T) {
2929
factory := NewNopExtensionFactory()
3030
require.NotNil(t, factory)
31-
assert.Equal(t, configmodels.Type("nop"), factory.Type())
31+
assert.Equal(t, config.Type("nop"), factory.Type())
3232
cfg := factory.CreateDefaultConfig()
33-
assert.Equal(t, &configmodels.ExtensionSettings{TypeVal: factory.Type()}, cfg)
33+
assert.Equal(t, &config.ExtensionSettings{TypeVal: factory.Type()}, cfg)
3434

3535
traces, err := factory.CreateExtension(context.Background(), component.ExtensionCreateParams{}, cfg)
3636
require.NoError(t, err)

component/componenttest/nop_host.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package componenttest
1616

1717
import (
1818
"go.opentelemetry.io/collector/component"
19-
"go.opentelemetry.io/collector/config/configmodels"
19+
"go.opentelemetry.io/collector/config"
2020
)
2121

2222
// nopHost mocks a receiver.ReceiverHost for test purposes.
@@ -31,14 +31,14 @@ func NewNopHost() component.Host {
3131

3232
func (nh *nopHost) ReportFatalError(_ error) {}
3333

34-
func (nh *nopHost) GetFactory(_ component.Kind, _ configmodels.Type) component.Factory {
34+
func (nh *nopHost) GetFactory(_ component.Kind, _ config.Type) component.Factory {
3535
return nil
3636
}
3737

38-
func (nh *nopHost) GetExtensions() map[configmodels.NamedEntity]component.Extension {
38+
func (nh *nopHost) GetExtensions() map[config.NamedEntity]component.Extension {
3939
return nil
4040
}
4141

42-
func (nh *nopHost) GetExporters() map[configmodels.DataType]map[configmodels.NamedEntity]component.Exporter {
42+
func (nh *nopHost) GetExporters() map[config.DataType]map[config.NamedEntity]component.Exporter {
4343
return nil
4444
}

component/componenttest/nop_processor.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
"go.opentelemetry.io/collector/component"
2121
"go.opentelemetry.io/collector/component/componenthelper"
22-
"go.opentelemetry.io/collector/config/configmodels"
22+
"go.opentelemetry.io/collector/config"
2323
"go.opentelemetry.io/collector/consumer"
2424
"go.opentelemetry.io/collector/consumer/consumertest"
2525
)
@@ -35,13 +35,13 @@ func NewNopProcessorFactory() component.ProcessorFactory {
3535
}
3636

3737
// Type gets the type of the Processor config created by this factory.
38-
func (f *nopProcessorFactory) Type() configmodels.Type {
38+
func (f *nopProcessorFactory) Type() config.Type {
3939
return "nop"
4040
}
4141

4242
// CreateDefaultConfig creates the default configuration for the Processor.
43-
func (f *nopProcessorFactory) CreateDefaultConfig() configmodels.Processor {
44-
return &configmodels.ProcessorSettings{
43+
func (f *nopProcessorFactory) CreateDefaultConfig() config.Processor {
44+
return &config.ProcessorSettings{
4545
TypeVal: f.Type(),
4646
}
4747
}
@@ -50,7 +50,7 @@ func (f *nopProcessorFactory) CreateDefaultConfig() configmodels.Processor {
5050
func (f *nopProcessorFactory) CreateTracesProcessor(
5151
_ context.Context,
5252
_ component.ProcessorCreateParams,
53-
_ configmodels.Processor,
53+
_ config.Processor,
5454
_ consumer.Traces,
5555
) (component.TracesProcessor, error) {
5656
return nopProcessorInstance, nil
@@ -60,7 +60,7 @@ func (f *nopProcessorFactory) CreateTracesProcessor(
6060
func (f *nopProcessorFactory) CreateMetricsProcessor(
6161
_ context.Context,
6262
_ component.ProcessorCreateParams,
63-
_ configmodels.Processor,
63+
_ config.Processor,
6464
_ consumer.Metrics,
6565
) (component.MetricsProcessor, error) {
6666
return nopProcessorInstance, nil
@@ -70,7 +70,7 @@ func (f *nopProcessorFactory) CreateMetricsProcessor(
7070
func (f *nopProcessorFactory) CreateLogsProcessor(
7171
_ context.Context,
7272
_ component.ProcessorCreateParams,
73-
_ configmodels.Processor,
73+
_ config.Processor,
7474
_ consumer.Logs,
7575
) (component.LogsProcessor, error) {
7676
return nopProcessorInstance, nil

0 commit comments

Comments
 (0)