Skip to content

Commit

Permalink
scraperhelper
Browse files Browse the repository at this point in the history
  • Loading branch information
shalper2 committed Dec 10, 2024
1 parent 7458859 commit 7482d1a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 35 deletions.
13 changes: 7 additions & 6 deletions receiver/windowsservicereceiver/factory_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/scraperhelper"
"go.opentelemetry.io/collector/scraper"
)

func createMetricsReceiver(
Expand All @@ -22,15 +21,17 @@ func createMetricsReceiver(
consumer consumer.Metrics,
) (receiver.Metrics, error) {
c := cfg.(*Config)
_stgs := scraper.Settings{}
s := newWindowsServiceScraper(params, c)

scp, err := scraper.NewMetrics(context.Background(), _stgs, s.scrape, scraper.WithStart(s.start), scraper.WithShutdown(s.shutdown))
scp, err := scraperhelper.NewScraperWithoutType(s.scrape,
scraperhelper.WithStart(s.start),
scraperhelper.WithShutdown(s.shutdown))
if err != nil {
return nil, err
}

scopt := scraperhelper.AddScraper(metadata.Type, scp)

return scraperhelper.NewScraperControllerReceiver(&c.ControllerConfig, params, consumer, scopt)
return scraperhelper.NewScraperControllerReceiver(&c.ControllerConfig,
params,
consumer,
scraperhelper.AddScraperWithType(metadata.Type, scp))
}
19 changes: 10 additions & 9 deletions receiver/windowsservicereceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ require (
go.opentelemetry.io/collector/component v0.114.0
go.opentelemetry.io/collector/component/componenttest v0.114.0
go.opentelemetry.io/collector/confmap v1.15.0
go.opentelemetry.io/collector/consumer v0.109.0
go.opentelemetry.io/collector/consumer/consumertest v0.109.0
go.opentelemetry.io/collector/consumer v0.114.0
go.opentelemetry.io/collector/consumer/consumertest v0.114.0
go.opentelemetry.io/collector/pdata v1.20.0
go.opentelemetry.io/collector/receiver v0.109.0
go.opentelemetry.io/collector/scraper v0.114.0
go.opentelemetry.io/collector/receiver v0.114.0
go.opentelemetry.io/collector/receiver/receivertest v0.114.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
golang.org/x/sys v0.27.0
Expand All @@ -34,20 +34,21 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/collector v0.109.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumerprofiles v0.109.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.109.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.114.0 // indirect
go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.114.0 // indirect
go.opentelemetry.io/collector/pipeline v0.114.0 // indirect
go.opentelemetry.io/collector/receiver/receiverprofiles v0.109.0 // indirect
go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
Expand Down
42 changes: 22 additions & 20 deletions receiver/windowsservicereceiver/go.sum

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

0 comments on commit 7482d1a

Please sign in to comment.