From 0954f2232873fd783e7d375acb9ab8cc0af3c900 Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:38:16 -0700 Subject: [PATCH] Updated deprecated usage --- .../internal/scraper/cpuscraper/factory.go | 3 +-- .../internal/scraper/diskscraper/factory.go | 3 +-- .../internal/scraper/filesystemscraper/factory.go | 3 +-- .../internal/scraper/loadscraper/factory.go | 3 +-- .../internal/scraper/memoryscraper/factory.go | 3 +-- .../internal/scraper/networkscraper/factory.go | 3 +-- .../internal/scraper/pagingscraper/factory.go | 3 +-- .../internal/scraper/processesscraper/factory.go | 3 +-- .../internal/scraper/processscraper/factory.go | 3 +-- .../internal/scraper/systemscraper/factory.go | 3 +-- receiver/kafkametricsreceiver/broker_scraper.go | 3 +-- receiver/kafkametricsreceiver/consumer_scraper.go | 3 +-- receiver/kafkametricsreceiver/receiver_test.go | 4 ++-- receiver/kafkametricsreceiver/topic_scraper.go | 3 +-- receiver/splunkenterprisereceiver/factory.go | 2 +- 15 files changed, 16 insertions(+), 29 deletions(-) diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/factory.go index 2686d11d0824..a9680057fc10 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/factory.go @@ -43,8 +43,7 @@ func (f *Factory) CreateMetricsScraper( cfg := config.(*Config) s := newCPUScraper(ctx, settings, cfg) - return scraperhelper.NewScraper( - scraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), ) diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/factory.go index 7fa835eca0ce..e69f5b220779 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/factory.go @@ -46,8 +46,7 @@ func (f *Factory) CreateMetricsScraper( return nil, err } - return scraperhelper.NewScraper( - scraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), ) diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/factory.go index 48355074b2ff..ee266b51d815 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/factory.go @@ -71,6 +71,5 @@ func (f *Factory) CreateMetricsScraper( return nil, err } - return scraperhelper.NewScraper( - scraperType, s.scrape, scraperhelper.WithStart(s.start)) + return scraperhelper.NewScraperWithoutType(s.scrape, scraperhelper.WithStart(s.start)) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/loadscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/loadscraper/factory.go index 49f87899d8d0..f1f4e5e4839c 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/loadscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/loadscraper/factory.go @@ -43,8 +43,7 @@ func (f *Factory) CreateMetricsScraper( cfg := config.(*Config) s := newLoadScraper(ctx, settings, cfg) - return scraperhelper.NewScraper( - scraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), scraperhelper.WithShutdown(s.shutdown), diff --git a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/factory.go index 6c4024e4a3dc..34c97fadbe34 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/factory.go @@ -43,6 +43,5 @@ func (f *Factory) CreateMetricsScraper( cfg := config.(*Config) s := newMemoryScraper(ctx, settings, cfg) - return scraperhelper.NewScraper( - scraperType, s.scrape, scraperhelper.WithStart(s.start)) + return scraperhelper.NewScraperWithoutType(s.scrape, scraperhelper.WithStart(s.start)) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/factory.go index f42ecf8c1f78..a96db4a72afe 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/factory.go @@ -46,8 +46,7 @@ func (f *Factory) CreateMetricsScraper( return nil, err } - return scraperhelper.NewScraper( - scraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), ) diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/factory.go index 22ac5b217791..f854b53b4346 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/factory.go @@ -43,8 +43,7 @@ func (f *Factory) CreateMetricsScraper( cfg := config.(*Config) s := newPagingScraper(ctx, settings, cfg) - return scraperhelper.NewScraper( - scraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), ) diff --git a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/factory.go index 8c5b3df7fbf2..4c3e2847d164 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/factory.go @@ -43,8 +43,7 @@ func (f *Factory) CreateMetricsScraper( cfg := config.(*Config) s := newProcessesScraper(ctx, settings, cfg) - return scraperhelper.NewScraper( - scraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), ) diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go index cae4a6b88202..6cfe883b0cb6 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go @@ -63,8 +63,7 @@ func (f *Factory) CreateMetricsScraper( return nil, err } - return scraperhelper.NewScraper( - scraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), ) diff --git a/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go index 0eac31bc0bd2..3d35748b2617 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go @@ -48,8 +48,7 @@ func (f *Factory) CreateMetricsScraper( uptimeScraper := newUptimeScraper(ctx, settings, cfg.(*Config)) - return scraperhelper.NewScraper( - scraperType, + return scraperhelper.NewScraperWithoutType( uptimeScraper.scrape, scraperhelper.WithStart(uptimeScraper.start), ) diff --git a/receiver/kafkametricsreceiver/broker_scraper.go b/receiver/kafkametricsreceiver/broker_scraper.go index 444c68c30813..7f04fbcc16be 100644 --- a/receiver/kafkametricsreceiver/broker_scraper.go +++ b/receiver/kafkametricsreceiver/broker_scraper.go @@ -110,8 +110,7 @@ func createBrokerScraper(_ context.Context, cfg Config, saramaConfig *sarama.Con config: cfg, saramaConfig: saramaConfig, } - return scraperhelper.NewScraper( - brokersScraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), scraperhelper.WithShutdown(s.shutdown), diff --git a/receiver/kafkametricsreceiver/consumer_scraper.go b/receiver/kafkametricsreceiver/consumer_scraper.go index bcd86435cc61..4ef36f08bac5 100644 --- a/receiver/kafkametricsreceiver/consumer_scraper.go +++ b/receiver/kafkametricsreceiver/consumer_scraper.go @@ -181,8 +181,7 @@ func createConsumerScraper(_ context.Context, cfg Config, saramaConfig *sarama.C config: cfg, saramaConfig: saramaConfig, } - return scraperhelper.NewScraper( - consumersScraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), scraperhelper.WithShutdown(s.shutdown), diff --git a/receiver/kafkametricsreceiver/receiver_test.go b/receiver/kafkametricsreceiver/receiver_test.go index c67d7150d5bb..e63f16248e1a 100644 --- a/receiver/kafkametricsreceiver/receiver_test.go +++ b/receiver/kafkametricsreceiver/receiver_test.go @@ -32,7 +32,7 @@ func TestNewReceiver_invalid_scraper_error(t *testing.T) { c := createDefaultConfig().(*Config) c.Scrapers = []string{"brokers", "cpu"} mockScraper := func(context.Context, Config, *sarama.Config, receiver.Settings) (scraperhelper.Scraper, error) { - return scraperhelper.NewScraper(brokersScraperType, func(context.Context) (pmetric.Metrics, error) { + return scraperhelper.NewScraperWithoutType(func(context.Context) (pmetric.Metrics, error) { return pmetric.Metrics{}, nil }) } @@ -63,7 +63,7 @@ func TestNewReceiver(t *testing.T) { c := createDefaultConfig().(*Config) c.Scrapers = []string{"brokers"} mockScraper := func(context.Context, Config, *sarama.Config, receiver.Settings) (scraperhelper.Scraper, error) { - return scraperhelper.NewScraper(brokersScraperType, func(context.Context) (pmetric.Metrics, error) { + return scraperhelper.NewScraperWithoutType(func(context.Context) (pmetric.Metrics, error) { return pmetric.Metrics{}, nil }) } diff --git a/receiver/kafkametricsreceiver/topic_scraper.go b/receiver/kafkametricsreceiver/topic_scraper.go index 80d1e2fc2572..96a1e72865dd 100644 --- a/receiver/kafkametricsreceiver/topic_scraper.go +++ b/receiver/kafkametricsreceiver/topic_scraper.go @@ -180,8 +180,7 @@ func createTopicsScraper(_ context.Context, cfg Config, saramaConfig *sarama.Con saramaConfig: saramaConfig, config: cfg, } - return scraperhelper.NewScraper( - topicsScraperType, + return scraperhelper.NewScraperWithoutType( s.scrape, scraperhelper.WithStart(s.start), scraperhelper.WithShutdown(s.shutdown), diff --git a/receiver/splunkenterprisereceiver/factory.go b/receiver/splunkenterprisereceiver/factory.go index 8a8a5a0592ab..e69b2fa29d81 100644 --- a/receiver/splunkenterprisereceiver/factory.go +++ b/receiver/splunkenterprisereceiver/factory.go @@ -61,7 +61,7 @@ func createMetricsReceiver( cfg := baseCfg.(*Config) splunkScraper := newSplunkMetricsScraper(params, cfg) - scraper, err := scraperhelper.NewScraper(metadata.Type, + scraper, err := scraperhelper.NewScraperWithoutType( splunkScraper.scrape, scraperhelper.WithStart(splunkScraper.start)) if err != nil {