Skip to content

Commit

Permalink
Updated deprecated usage
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHelmuth committed Nov 16, 2024
1 parent 0ca67d9 commit 0954f22
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ func (f *Factory) CreateMetricsScraper(
return nil, err
}

return scraperhelper.NewScraper(
scraperType,
return scraperhelper.NewScraperWithoutType(
s.scrape,
scraperhelper.WithStart(s.start),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ func (f *Factory) CreateMetricsScraper(
return nil, err
}

return scraperhelper.NewScraper(
scraperType,
return scraperhelper.NewScraperWithoutType(
s.scrape,
scraperhelper.WithStart(s.start),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ func (f *Factory) CreateMetricsScraper(
return nil, err
}

return scraperhelper.NewScraper(
scraperType,
return scraperhelper.NewScraperWithoutType(
s.scrape,
scraperhelper.WithStart(s.start),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
3 changes: 1 addition & 2 deletions receiver/kafkametricsreceiver/broker_scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 1 addition & 2 deletions receiver/kafkametricsreceiver/consumer_scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions receiver/kafkametricsreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
Expand Down Expand Up @@ -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
})
}
Expand Down
3 changes: 1 addition & 2 deletions receiver/kafkametricsreceiver/topic_scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion receiver/splunkenterprisereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0954f22

Please sign in to comment.