Skip to content

Commit

Permalink
Substitute CreateSettings and NewNopCreateSettings after deprecat…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
franciscovalentecastro committed Aug 7, 2024
1 parent 01b3e15 commit 49a5be4
Show file tree
Hide file tree
Showing 45 changed files with 78 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestAgentMetricsProcessor(t *testing.T) {
tmn := &consumertest.MetricsSink{}
rmp, err := processorhelper.NewMetricsProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
&Config{},
tmn,
amp.ProcessMetrics,
Expand Down
2 changes: 1 addition & 1 deletion processor/agentmetricsprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

func createMetricsProcessor(
ctx context.Context,
params processor.CreateSettings,
params processor.Settings,
cfg component.Config,
nextConsumer consumer.Metrics,
) (processor.Metrics, error) {
Expand Down
2 changes: 1 addition & 1 deletion processor/agentmetricsprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestCreateDefaultConfig(t *testing.T) {
}

func TestCreateProcessor(t *testing.T) {
mp, err := createMetricsProcessor(context.Background(), processor.CreateSettings{}, createDefaultConfig(), consumertest.NewNop())
mp, err := createMetricsProcessor(context.Background(), processor.Settings{}, createDefaultConfig(), consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, mp)
}
2 changes: 1 addition & 1 deletion processor/casttosumprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

func createMetricsProcessor(
ctx context.Context,
params processor.CreateSettings,
params processor.Settings,
cfg component.Config,
nextConsumer consumer.Metrics,
) (processor.Metrics, error) {
Expand Down
2 changes: 1 addition & 1 deletion processor/casttosumprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestCreateProcessor(t *testing.T) {
assert.NotNil(t, config)

for _, cfg := range config.Processors {
mp, err := createMetricsProcessor(context.Background(), processor.CreateSettings{}, cfg, consumertest.NewNop())
mp, err := createMetricsProcessor(context.Background(), processor.Settings{}, cfg, consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, mp)
}
Expand Down
2 changes: 1 addition & 1 deletion processor/casttosumprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestCastToSumProcessor(t *testing.T) {
tmn := &consumertest.MetricsSink{}
rmp, err := processorhelper.NewMetricsProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
cfg,
tmn,
nsp.ProcessMetrics,
Expand Down
2 changes: 1 addition & 1 deletion processor/modifyscopeprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

func createMetricsProcessor(
ctx context.Context,
params processor.CreateSettings,
params processor.Settings,
cfg component.Config,
nextConsumer consumer.Metrics,
) (processor.Metrics, error) {
Expand Down
2 changes: 1 addition & 1 deletion processor/modifyscopeprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestCreateDefaultConfig(t *testing.T) {
assert.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig()))
}
func TestCreateProcessor(t *testing.T) {
mp, err := createMetricsProcessor(context.Background(), processor.CreateSettings{}, createDefaultConfig(), consumertest.NewNop())
mp, err := createMetricsProcessor(context.Background(), processor.Settings{}, createDefaultConfig(), consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, mp)
}
2 changes: 1 addition & 1 deletion processor/modifyscopeprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestModifyScopeProcessor(t *testing.T) {
tmn := &consumertest.MetricsSink{}
rmp, err := processorhelper.NewMetricsProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
cfg,
tmn,
msp.ProcessMetrics,
Expand Down
2 changes: 1 addition & 1 deletion processor/normalizesumsprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

func createMetricsProcessor(
ctx context.Context,
params processor.CreateSettings,
params processor.Settings,
cfg component.Config,
nextConsumer consumer.Metrics,
) (processor.Metrics, error) {
Expand Down
2 changes: 1 addition & 1 deletion processor/normalizesumsprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestCreateDefaultConfig(t *testing.T) {
assert.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig()))
}
func TestCreateProcessor(t *testing.T) {
mp, err := createMetricsProcessor(context.Background(), processor.CreateSettings{}, createDefaultConfig(), consumertest.NewNop())
mp, err := createMetricsProcessor(context.Background(), processor.Settings{}, createDefaultConfig(), consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, mp)
}
2 changes: 1 addition & 1 deletion processor/normalizesumsprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestNormalizeSumsProcessor(t *testing.T) {
tmn := &consumertest.MetricsSink{}
rmp, err := processorhelper.NewMetricsProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
&Config{},
tmn,
nsp.ProcessMetrics,
Expand Down
10 changes: 5 additions & 5 deletions receiver/dcgmreceiver/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ func TestComponentLifecycle(t *testing.T) {

tests := []struct {
name string
createFn func(ctx context.Context, set receiver.CreateSettings, cfg component.Config) (component.Component, error)
createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error)
}{

{
name: "metrics",
createFn: func(ctx context.Context, set receiver.CreateSettings, cfg component.Config) (component.Component, error) {
createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) {
return factory.CreateMetricsReceiver(ctx, set, cfg, consumertest.NewNop())
},
},
Expand All @@ -70,19 +70,19 @@ func TestComponentLifecycle(t *testing.T) {

for _, test := range tests {
t.Run(test.name+"-shutdown", func(t *testing.T) {
c, err := test.createFn(context.Background(), receivertest.NewNopCreateSettings(), cfg)
c, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg)
require.NoError(t, err)
err = c.Shutdown(context.Background())
require.NoError(t, err)
})
t.Run(test.name+"-lifecycle", func(t *testing.T) {
firstRcvr, err := test.createFn(context.Background(), receivertest.NewNopCreateSettings(), cfg)
firstRcvr, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg)
require.NoError(t, err)
host := componenttest.NewNopHost()
require.NoError(t, err)
require.NoError(t, firstRcvr.Start(context.Background(), host))
require.NoError(t, firstRcvr.Shutdown(context.Background()))
secondRcvr, err := test.createFn(context.Background(), receivertest.NewNopCreateSettings(), cfg)
secondRcvr, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg)
require.NoError(t, err)
require.NoError(t, secondRcvr.Start(context.Background(), host))
require.NoError(t, secondRcvr.Shutdown(context.Background()))
Expand Down
2 changes: 1 addition & 1 deletion receiver/dcgmreceiver/factory_gpu_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

func createMetricsReceiver(
_ context.Context,
_ receiver.CreateSettings,
_ receiver.Settings,
_ component.Config,
_ consumer.Metrics,
) (receiver.Metrics, error) {
Expand Down
2 changes: 1 addition & 1 deletion receiver/dcgmreceiver/factory_gpu_off_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestCreateMetricsReceiverWithGPUSupportOff(t *testing.T) {
cfg := factory.CreateDefaultConfig()
receiver, err := factory.CreateMetricsReceiver(
context.Background(),
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
cfg,
consumertest.NewNop())

Expand Down
2 changes: 1 addition & 1 deletion receiver/dcgmreceiver/factory_gpu_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func init() {

func createMetricsReceiver(
_ context.Context,
params receiver.CreateSettings,
params receiver.Settings,
rConf component.Config,
consumer consumer.Metrics,
) (receiver.Metrics, error) {
Expand Down
2 changes: 1 addition & 1 deletion receiver/dcgmreceiver/factory_gpu_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestCreateMetricsReceiverOnLinux(t *testing.T) {

receiver, err := factory.CreateMetricsReceiver(
context.Background(),
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
receiverConfig,
consumertest.NewNop(),
)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions receiver/dcgmreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ import (

type dcgmScraper struct {
config *Config
settings receiver.CreateSettings
settings receiver.Settings
client *dcgmClient
mb *metadata.MetricsBuilder
}

func newDcgmScraper(config *Config, settings receiver.CreateSettings) *dcgmScraper {
func newDcgmScraper(config *Config, settings receiver.Settings) *dcgmScraper {
return &dcgmScraper{config: config, settings: settings}
}

Expand Down
10 changes: 5 additions & 5 deletions receiver/dcgmreceiver/scraper_gpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
)

func TestScrapeWithGpuPresent(t *testing.T) {
var settings receiver.CreateSettings
var settings receiver.Settings
settings.Logger = zaptest.NewLogger(t)

scraper := newDcgmScraper(createDefaultConfig().(*Config), settings)
Expand All @@ -59,7 +59,7 @@ func TestScrapeWithDelayedDcgmService(t *testing.T) {
return nil, fmt.Errorf("No DCGM client library *OR* No DCGM connection")
}

var settings receiver.CreateSettings
var settings receiver.Settings
settings.Logger = zaptest.NewLogger(t)

scraper := newDcgmScraper(createDefaultConfig().(*Config), settings)
Expand All @@ -86,7 +86,7 @@ func TestScrapeWithDelayedDcgmService(t *testing.T) {
}

func TestScrapeWithEmptyMetricsConfig(t *testing.T) {
var settings receiver.CreateSettings
var settings receiver.Settings
settings.Logger = zaptest.NewLogger(t)
emptyConfig := &Config{
ControllerConfig: scraperhelper.ControllerConfig{
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestScrapeOnPollingError(t *testing.T) {
return nil, fmt.Errorf("DCGM polling error")
}

var settings receiver.CreateSettings
var settings receiver.Settings
settings.Logger = zaptest.NewLogger(t)

scraper := newDcgmScraper(createDefaultConfig().(*Config), settings)
Expand All @@ -160,7 +160,7 @@ func TestScrapeOnProfilingPaused(t *testing.T) {
config := createDefaultConfig().(*Config)
config.CollectionInterval = 10 * time.Millisecond

var settings receiver.CreateSettings
var settings receiver.Settings
settings.Logger = zaptest.NewLogger(t)

scraper := newDcgmScraper(config, settings)
Expand Down
2 changes: 1 addition & 1 deletion receiver/dcgmreceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
)

func TestScraperWithoutDcgm(t *testing.T) {
var settings receiver.CreateSettings
var settings receiver.Settings
seenDcgmNotInstalledWarning := false
settings.Logger = zaptest.NewLogger(t, zaptest.WrapOptions(zap.Hooks(func(e zapcore.Entry) error {
if e.Level == zap.WarnLevel && strings.Contains(e.Message, "Unable to connect to DCGM daemon at localhost:5555 on libdcgm.so not Found; Is the DCGM daemon running") {
Expand Down
2 changes: 1 addition & 1 deletion receiver/mongodbreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func createDefaultConfig() component.Config {

func createMetricsReceiver(
_ context.Context,
params receiver.CreateSettings,
params receiver.Settings,
rConf component.Config,
consumer consumer.Metrics,
) (receiver.Metrics, error) {
Expand Down
2 changes: 1 addition & 1 deletion receiver/mongodbreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestCreateMetricsReceiver(t *testing.T) {
factory := NewFactory()
_, err := factory.CreateMetricsReceiver(
context.Background(),
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
&Config{
ControllerConfig: scraperhelper.ControllerConfig{
CollectionInterval: 10 * time.Second,
Expand Down
10 changes: 5 additions & 5 deletions receiver/mongodbreceiver/generated_component_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion receiver/mongodbreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type mongodbScraper struct {
mb *metadata.MetricsBuilder
}

func newMongodbScraper(settings receiver.CreateSettings, config *Config) *mongodbScraper {
func newMongodbScraper(settings receiver.Settings, config *Config) *mongodbScraper {
mbConfig := metadata.DefaultMetricsBuilderConfig()
mbConfig.Metrics = config.Metrics
return &mongodbScraper{
Expand Down
10 changes: 5 additions & 5 deletions receiver/nvmlreceiver/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ func TestComponentLifecycle(t *testing.T) {

tests := []struct {
name string
createFn func(ctx context.Context, set receiver.CreateSettings, cfg component.Config) (component.Component, error)
createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error)
}{

{
name: "metrics",
createFn: func(ctx context.Context, set receiver.CreateSettings, cfg component.Config) (component.Component, error) {
createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) {
return factory.CreateMetricsReceiver(ctx, set, cfg, consumertest.NewNop())
},
},
Expand All @@ -70,19 +70,19 @@ func TestComponentLifecycle(t *testing.T) {

for _, test := range tests {
t.Run(test.name+"-shutdown", func(t *testing.T) {
c, err := test.createFn(context.Background(), receivertest.NewNopCreateSettings(), cfg)
c, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg)
require.NoError(t, err)
err = c.Shutdown(context.Background())
require.NoError(t, err)
})
t.Run(test.name+"-lifecycle", func(t *testing.T) {
firstRcvr, err := test.createFn(context.Background(), receivertest.NewNopCreateSettings(), cfg)
firstRcvr, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg)
require.NoError(t, err)
host := componenttest.NewNopHost()
require.NoError(t, err)
require.NoError(t, firstRcvr.Start(context.Background(), host))
require.NoError(t, firstRcvr.Shutdown(context.Background()))
secondRcvr, err := test.createFn(context.Background(), receivertest.NewNopCreateSettings(), cfg)
secondRcvr, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg)
require.NoError(t, err)
require.NoError(t, secondRcvr.Start(context.Background(), host))
require.NoError(t, secondRcvr.Shutdown(context.Background()))
Expand Down
2 changes: 1 addition & 1 deletion receiver/nvmlreceiver/factory_gpu_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

func createMetricsReceiver(
_ context.Context,
_ receiver.CreateSettings,
_ receiver.Settings,
_ component.Config,
_ consumer.Metrics,
) (receiver.Metrics, error) {
Expand Down
Loading

0 comments on commit 49a5be4

Please sign in to comment.