From 55d9f1d93ab5cfbb1279800d55da8c6e66416eeb Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Sun, 1 Dec 2024 20:22:18 -0600 Subject: [PATCH] update scrapers --- connector/datadogconnector/go.sum | 4 +-- exporter/datadogexporter/go.mod | 2 +- exporter/datadogexporter/go.sum | 4 +-- .../datadogexporter/integrationtest/go.sum | 4 +-- internal/sqlquery/scraper.go | 5 +-- internal/sqlquery/scraper_test.go | 32 ++++++++--------- .../generated_component_telemetry_test.go | 9 +++-- .../internal/metadata/generated_telemetry.go | 5 ++- .../metadata/generated_telemetry_test.go | 7 ++-- .../generated_component_telemetry_test.go | 9 +++-- .../internal/metadata/generated_telemetry.go | 5 ++- .../metadata/generated_telemetry_test.go | 7 ++-- .../generated_component_telemetry_test.go | 9 +++-- .../internal/metadata/generated_telemetry.go | 5 ++- .../metadata/generated_telemetry_test.go | 7 ++-- .../generated_component_telemetry_test.go | 9 +++-- .../internal/metadata/generated_telemetry.go | 5 ++- .../metadata/generated_telemetry_test.go | 7 ++-- .../factory_windows.go | 9 ++--- receiver/activedirectorydsreceiver/go.mod | 2 +- receiver/activedirectorydsreceiver/go.sum | 4 +-- receiver/aerospikereceiver/factory.go | 12 +++---- receiver/aerospikereceiver/go.mod | 2 +- receiver/aerospikereceiver/go.sum | 4 +-- receiver/apachereceiver/factory.go | 5 +-- receiver/apachereceiver/go.mod | 2 +- receiver/apachereceiver/go.sum | 4 +-- receiver/apachesparkreceiver/factory.go | 7 ++-- receiver/apachesparkreceiver/go.mod | 2 +- receiver/apachesparkreceiver/go.sum | 4 +-- receiver/azuremonitorreceiver/factory.go | 5 +-- receiver/azuremonitorreceiver/go.mod | 2 +- receiver/azuremonitorreceiver/go.sum | 4 +-- receiver/bigipreceiver/factory.go | 5 +-- receiver/bigipreceiver/go.mod | 2 +- receiver/bigipreceiver/go.sum | 4 +-- receiver/chronyreceiver/factory.go | 8 ++--- receiver/chronyreceiver/go.mod | 2 +- receiver/chronyreceiver/go.sum | 4 +-- receiver/couchdbreceiver/factory.go | 5 +-- receiver/couchdbreceiver/go.mod | 2 +- receiver/couchdbreceiver/go.sum | 4 +-- receiver/dockerstatsreceiver/factory.go | 5 +-- receiver/dockerstatsreceiver/go.mod | 2 +- receiver/dockerstatsreceiver/go.sum | 4 +-- receiver/elasticsearchreceiver/factory.go | 5 +-- receiver/elasticsearchreceiver/go.mod | 2 +- receiver/elasticsearchreceiver/go.sum | 4 +-- receiver/expvarreceiver/factory.go | 7 ++-- receiver/expvarreceiver/go.mod | 2 +- receiver/expvarreceiver/go.sum | 4 +-- receiver/filestatsreceiver/factory.go | 5 +-- receiver/filestatsreceiver/go.mod | 2 +- receiver/filestatsreceiver/go.sum | 4 +-- receiver/filestatsreceiver/scraper.go | 8 ++--- receiver/flinkmetricsreceiver/factory.go | 5 +-- receiver/flinkmetricsreceiver/go.mod | 2 +- receiver/flinkmetricsreceiver/go.sum | 4 +-- .../generated_component_telemetry_test.go | 9 +++-- .../internal/metadata/generated_telemetry.go | 5 ++- .../metadata/generated_telemetry_test.go | 7 ++-- receiver/githubreceiver/factory.go | 7 ++-- receiver/githubreceiver/go.mod | 2 +- receiver/githubreceiver/go.sum | 4 +-- receiver/githubreceiver/internal/scraper.go | 4 +-- .../internal/scraper/githubscraper/factory.go | 12 +++---- .../scraper/githubscraper/github_scraper.go | 1 - .../googlecloudmonitoringreceiver/factory.go | 7 ++-- receiver/googlecloudmonitoringreceiver/go.mod | 2 +- receiver/googlecloudmonitoringreceiver/go.sum | 4 +-- .../googlecloudspannerreceiver/factory.go | 7 ++-- receiver/googlecloudspannerreceiver/go.mod | 2 +- receiver/googlecloudspannerreceiver/go.sum | 4 +-- receiver/haproxyreceiver/factory.go | 11 ++++-- receiver/haproxyreceiver/go.mod | 2 +- receiver/haproxyreceiver/go.sum | 4 +-- receiver/haproxyreceiver/scraper.go | 12 +++---- receiver/haproxyreceiver/scraper_test.go | 4 +-- receiver/hostmetricsreceiver/go.mod | 2 +- receiver/hostmetricsreceiver/go.sum | 4 +-- .../scraper/cpuscraper/cpu_scraper.go | 12 +++---- .../scraper/cpuscraper/cpu_scraper_linux.go | 6 ++-- .../scraper/cpuscraper/cpu_scraper_others.go | 6 ++-- .../scraper/cpuscraper/cpu_scraper_test.go | 8 ++--- .../internal/scraper/cpuscraper/factory.go | 17 +++++----- .../internal/scraper/diskscraper/config.go | 2 +- .../diskscraper/disk_scraper_others.go | 24 ++++++------- .../disk_scraper_others_fallback.go | 2 +- .../diskscraper/disk_scraper_others_linux.go | 6 ++-- .../diskscraper/disk_scraper_others_test.go | 4 +-- .../scraper/diskscraper/disk_scraper_test.go | 6 ++-- .../diskscraper/disk_scraper_windows.go | 22 ++++++------ .../diskscraper/disk_scraper_windows_test.go | 8 ++--- .../internal/scraper/diskscraper/factory.go | 15 ++++---- .../scraper/filesystemscraper/factory.go | 14 ++++---- .../filesystemscraper/filesystem_scraper.go | 12 +++---- .../filesystem_scraper_others.go | 4 +-- .../filesystem_scraper_test.go | 4 +-- .../filesystem_scraper_unix.go | 4 +-- .../internal/scraper/loadscraper/factory.go | 10 +++--- .../scraper/loadscraper/load_scraper.go | 12 +++---- .../internal/scraper/memoryscraper/factory.go | 6 ++-- .../scraper/memoryscraper/memory_scraper.go | 12 +++---- .../memoryscraper/memory_scraper_linux.go | 8 ++--- .../memoryscraper/memory_scraper_others.go | 6 ++-- .../memoryscraper/memory_scraper_test.go | 4 +-- .../memoryscraper/memory_scraper_windows.go | 6 ++-- .../scraper/networkscraper/factory.go | 8 ++--- .../scraper/networkscraper/network_linux.go | 2 +- .../scraper/networkscraper/network_others.go | 2 +- .../scraper/networkscraper/network_scraper.go | 28 +++++++-------- .../networkscraper/network_scraper_test.go | 6 ++-- .../internal/scraper/pagingscraper/factory.go | 8 ++--- .../pagingscraper/paging_scraper_others.go | 22 ++++++------ .../paging_scraper_others_test.go | 2 +- .../pagingscraper/paging_scraper_test.go | 8 ++--- .../pagingscraper/paging_scraper_windows.go | 20 +++++------ .../paging_scraper_windows_test.go | 4 +-- .../scraper/processesscraper/factory.go | 8 ++--- .../processesscraper/processes_scraper.go | 10 +++--- .../processes_scraper_fallback.go | 2 +- .../processes_scraper_unix.go | 2 +- .../scraper/processscraper/factory.go | 8 ++--- .../scraper/processscraper/process_scraper.go | 34 +++++++++---------- .../processscraper/process_scraper_darwin.go | 4 +-- .../processscraper/process_scraper_linux.go | 4 +-- .../processscraper/process_scraper_others.go | 4 +-- .../processscraper/process_scraper_test.go | 2 +- .../processscraper/process_scraper_windows.go | 4 +-- .../internal/scraper/systemscraper/factory.go | 10 +++--- .../scraper/systemscraper/system_scraper.go | 10 +++--- receiver/httpcheckreceiver/factory.go | 5 +-- receiver/httpcheckreceiver/go.mod | 2 +- receiver/httpcheckreceiver/go.sum | 4 +-- receiver/iisreceiver/factory_windows.go | 9 ++--- receiver/iisreceiver/go.mod | 2 +- receiver/iisreceiver/go.sum | 4 +-- receiver/k8sclusterreceiver/e2e_test.go | 7 ++-- .../kafkametricsreceiver/broker_scraper.go | 10 +++--- .../kafkametricsreceiver/consumer_scraper.go | 10 +++--- receiver/kafkametricsreceiver/go.mod | 2 +- receiver/kafkametricsreceiver/go.sum | 4 +-- receiver/kafkametricsreceiver/receiver.go | 5 +-- .../kafkametricsreceiver/receiver_test.go | 17 +++++----- .../kafkametricsreceiver/topic_scraper.go | 10 +++--- .../generated_component_telemetry_test.go | 9 +++-- .../internal/metadata/generated_telemetry.go | 5 ++- .../metadata/generated_telemetry_test.go | 7 ++-- receiver/kubeletstatsreceiver/factory.go | 6 ++-- receiver/kubeletstatsreceiver/go.mod | 2 +- receiver/kubeletstatsreceiver/go.sum | 4 +-- receiver/kubeletstatsreceiver/scraper.go | 11 +++--- receiver/memcachedreceiver/factory.go | 7 ++-- receiver/memcachedreceiver/go.mod | 2 +- receiver/memcachedreceiver/go.sum | 4 +-- receiver/mongodbatlasreceiver/factory.go | 6 ++-- receiver/mongodbatlasreceiver/go.mod | 2 +- receiver/mongodbatlasreceiver/go.sum | 4 +-- receiver/mongodbatlasreceiver/receiver.go | 6 ++-- receiver/mongodbreceiver/factory.go | 12 ++++--- receiver/mongodbreceiver/go.mod | 2 +- receiver/mongodbreceiver/go.sum | 4 +-- receiver/mysqlreceiver/factory.go | 9 ++--- receiver/mysqlreceiver/go.mod | 2 +- receiver/mysqlreceiver/go.sum | 4 +-- receiver/nginxreceiver/factory.go | 7 ++-- receiver/nginxreceiver/go.mod | 2 +- receiver/nginxreceiver/go.sum | 4 +-- receiver/nsxtreceiver/factory.go | 9 ++--- receiver/nsxtreceiver/go.mod | 2 +- receiver/nsxtreceiver/go.sum | 4 +-- receiver/nsxtreceiver/scraper.go | 22 ++++++------ receiver/ntpreceiver/factory.go | 8 +++-- receiver/ntpreceiver/go.mod | 2 +- receiver/ntpreceiver/go.sum | 4 +-- receiver/ntpreceiver/receiver.go | 8 ++--- receiver/oracledbreceiver/factory.go | 6 ++-- receiver/oracledbreceiver/go.mod | 2 +- receiver/oracledbreceiver/go.sum | 4 +-- receiver/oracledbreceiver/scraper.go | 16 +++++---- receiver/oracledbreceiver/scraper_test.go | 4 +-- .../metadata/generated_telemetry_test.go | 3 +- receiver/podmanreceiver/go.mod | 2 +- receiver/podmanreceiver/go.sum | 4 +-- receiver/podmanreceiver/receiver.go | 5 +-- receiver/postgresqlreceiver/factory.go | 5 +-- receiver/postgresqlreceiver/go.mod | 2 +- receiver/postgresqlreceiver/go.sum | 4 +-- receiver/rabbitmqreceiver/factory.go | 5 +-- receiver/rabbitmqreceiver/go.mod | 2 +- receiver/rabbitmqreceiver/go.sum | 4 +-- receiver/redisreceiver/factory.go | 2 +- receiver/redisreceiver/go.mod | 2 +- receiver/redisreceiver/go.sum | 4 +-- receiver/redisreceiver/redis_scraper.go | 10 +++--- receiver/redisreceiver/redis_scraper_test.go | 2 +- receiver/riakreceiver/factory.go | 7 ++-- receiver/riakreceiver/go.mod | 2 +- receiver/riakreceiver/go.sum | 4 +-- receiver/saphanareceiver/factory.go | 6 ++-- receiver/saphanareceiver/go.mod | 2 +- receiver/saphanareceiver/go.sum | 4 +-- receiver/saphanareceiver/scraper.go | 6 ++-- receiver/saphanareceiver/scraper_test.go | 4 +-- receiver/snmpreceiver/factory.go | 5 +-- receiver/snmpreceiver/go.mod | 2 +- receiver/snmpreceiver/go.sum | 4 +-- receiver/snowflakereceiver/factory.go | 8 +++-- receiver/snowflakereceiver/go.mod | 2 +- receiver/snowflakereceiver/go.sum | 4 +-- .../generated_component_telemetry_test.go | 9 +++-- .../internal/metadata/generated_telemetry.go | 5 ++- .../metadata/generated_telemetry_test.go | 7 ++-- receiver/splunkenterprisereceiver/factory.go | 7 ++-- receiver/splunkenterprisereceiver/go.mod | 2 +- receiver/splunkenterprisereceiver/go.sum | 4 +-- receiver/sqlserverreceiver/factory.go | 9 ++--- receiver/sqlserverreceiver/factory_windows.go | 9 ++--- receiver/sqlserverreceiver/go.mod | 2 +- receiver/sqlserverreceiver/go.sum | 4 +-- receiver/sshcheckreceiver/factory.go | 5 +-- receiver/sshcheckreceiver/go.mod | 2 +- receiver/sshcheckreceiver/go.sum | 4 +-- .../generated_component_telemetry_test.go | 9 +++-- .../internal/metadata/generated_telemetry.go | 5 ++- .../metadata/generated_telemetry_test.go | 7 ++-- receiver/tlscheckreceiver/factory.go | 5 +-- receiver/tlscheckreceiver/go.mod | 2 +- receiver/tlscheckreceiver/go.sum | 4 +-- receiver/tlscheckreceiver/scraper.go | 8 ++--- receiver/vcenterreceiver/factory.go | 9 ++--- receiver/vcenterreceiver/go.mod | 2 +- receiver/vcenterreceiver/go.sum | 4 +-- .../factory_windows.go | 13 +++---- receiver/windowsperfcountersreceiver/go.mod | 2 +- receiver/windowsperfcountersreceiver/go.sum | 4 +-- .../windowsperfcounters_scraper.go | 16 ++++----- .../windowsperfcounters_scraper_test.go | 6 ++-- receiver/zookeeperreceiver/factory.go | 7 ++-- receiver/zookeeperreceiver/go.mod | 2 +- receiver/zookeeperreceiver/go.sum | 4 +-- 241 files changed, 745 insertions(+), 724 deletions(-) diff --git a/connector/datadogconnector/go.sum b/connector/datadogconnector/go.sum index 219396d46492..3d05ce8a8b2b 100644 --- a/connector/datadogconnector/go.sum +++ b/connector/datadogconnector/go.sum @@ -980,8 +980,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be h1:qQxHHmhM/UoWf+uApuEn732ONV5eEdjfYMLO1QO0I6s= diff --git a/exporter/datadogexporter/go.mod b/exporter/datadogexporter/go.mod index 0ab14c69b088..a2c57a5f2345 100644 --- a/exporter/datadogexporter/go.mod +++ b/exporter/datadogexporter/go.mod @@ -362,7 +362,7 @@ require ( go.opentelemetry.io/collector/processor/processortest v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect go.opentelemetry.io/contrib/config v0.10.0 // indirect diff --git a/exporter/datadogexporter/go.sum b/exporter/datadogexporter/go.sum index 7bf6ee0b0267..36a71d0138a8 100644 --- a/exporter/datadogexporter/go.sum +++ b/exporter/datadogexporter/go.sum @@ -1135,8 +1135,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be h1:qQxHHmhM/UoWf+uApuEn732ONV5eEdjfYMLO1QO0I6s= diff --git a/exporter/datadogexporter/integrationtest/go.sum b/exporter/datadogexporter/integrationtest/go.sum index b1facc8a8b54..c4004f17a909 100644 --- a/exporter/datadogexporter/integrationtest/go.sum +++ b/exporter/datadogexporter/integrationtest/go.sum @@ -1119,8 +1119,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be h1:qQxHHmhM/UoWf+uApuEn732ONV5eEdjfYMLO1QO0I6s= diff --git a/internal/sqlquery/scraper.go b/internal/sqlquery/scraper.go index 31eafbef2161..014d5869c5e7 100644 --- a/internal/sqlquery/scraper.go +++ b/internal/sqlquery/scraper.go @@ -8,6 +8,7 @@ import ( "database/sql" "errors" "fmt" + "go.opentelemetry.io/collector/scraper" "time" "go.opentelemetry.io/collector/component" @@ -37,7 +38,7 @@ type Scraper struct { Db *sql.DB } -var _ scraperhelper.Scraper = (*Scraper)(nil) +var _ scraper.Metrics = (*Scraper)(nil) func NewScraper(id component.ID, query Query, scrapeCfg scraperhelper.ControllerConfig, logger *zap.Logger, telemetry TelemetryConfig, dbProviderFunc DbProviderFunc, clientProviderFunc ClientProviderFunc) *Scraper { return &Scraper{ @@ -67,7 +68,7 @@ func (s *Scraper) Start(context.Context, component.Host) error { return nil } -func (s *Scraper) Scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *Scraper) ScrapeMetrics(ctx context.Context) (pmetric.Metrics, error) { out := pmetric.NewMetrics() rows, err := s.Client.QueryRows(ctx) if err != nil { diff --git a/internal/sqlquery/scraper_test.go b/internal/sqlquery/scraper_test.go index f7883589f9f9..6969fc0d5b17 100644 --- a/internal/sqlquery/scraper_test.go +++ b/internal/sqlquery/scraper_test.go @@ -35,7 +35,7 @@ func TestScraper_ClientErrorOnScrape(t *testing.T) { scrpr := Scraper{ Client: client, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) require.Error(t, err) } @@ -57,7 +57,7 @@ func TestScraper_RowToMetricErrorOnScrape_Float(t *testing.T) { }}, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) assert.Error(t, err) } @@ -79,7 +79,7 @@ func TestScraper_RowToMetricErrorOnScrape_Int(t *testing.T) { }}, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) assert.Error(t, err) } @@ -102,7 +102,7 @@ func TestScraper_RowToMetricMultiErrorsOnScrape(t *testing.T) { }}, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) assert.Error(t, err) } @@ -135,7 +135,7 @@ func TestScraper_SingleRow_MultiMetrics(t *testing.T) { }, }, } - metrics, err := scrpr.Scrape(context.Background()) + metrics, err := scrpr.ScrapeMetrics(context.Background()) require.NoError(t, err) rms := metrics.ResourceMetrics() assert.Equal(t, 1, rms.Len()) @@ -204,7 +204,7 @@ func TestScraper_MultiRow(t *testing.T) { }, }, } - metrics, err := scrpr.Scrape(context.Background()) + metrics, err := scrpr.ScrapeMetrics(context.Background()) require.NoError(t, err) ms := metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics() { @@ -270,7 +270,7 @@ func TestScraper_MultiResults_DeltaSum(t *testing.T) { } func assertTransactionCount(t *testing.T, scrpr Scraper, expected int, agg pmetric.AggregationTemporality) { - metrics, err := scrpr.Scrape(context.Background()) + metrics, err := scrpr.ScrapeMetrics(context.Background()) require.NoError(t, err) metric := metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0) assert.Equal(t, "transaction.count", metric.Name()) @@ -301,7 +301,7 @@ func TestScraper_Float(t *testing.T) { }}, }, } - metrics, err := scrpr.Scrape(context.Background()) + metrics, err := scrpr.ScrapeMetrics(context.Background()) require.NoError(t, err) metric := metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0) assert.Equal(t, 123.4, metric.Gauge().DataPoints().At(0).DoubleValue()) @@ -324,7 +324,7 @@ func TestScraper_DescriptionAndUnit(t *testing.T) { }}, }, } - metrics, err := scrpr.Scrape(context.Background()) + metrics, err := scrpr.ScrapeMetrics(context.Background()) require.NoError(t, err) z := metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0) assert.Equal(t, "my-unit", z.Unit()) @@ -346,7 +346,7 @@ func TestScraper_FakeDB_Warnings(t *testing.T) { }}, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) require.NoError(t, err) } @@ -365,7 +365,7 @@ func TestScraper_FakeDB_MultiRows_Warnings(t *testing.T) { }}, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) // No error is expected because we're not actually asking for metrics from the // NULL column. Instead the errors from the NULL reads should just log warnings. assert.NoError(t, err) @@ -393,7 +393,7 @@ func TestScraper_FakeDB_MultiRows_Error(t *testing.T) { }, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) // We expect an error here not directly because of the NULL values but because // the column was also requested in Query.Metrics[1] but wasn't found. It's just // a partial scrape error though so it shouldn't cause a Scraper shutdown. @@ -424,7 +424,7 @@ func TestScraper_StartAndTSColumn(t *testing.T) { }}, }, } - metrics, err := scrpr.Scrape(context.Background()) + metrics, err := scrpr.ScrapeMetrics(context.Background()) require.NoError(t, err) metric := metrics.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().At(0) assert.Equal(t, pcommon.Timestamp(1682417791), metric.Sum().DataPoints().At(0).StartTimestamp()) @@ -453,7 +453,7 @@ func TestScraper_StartAndTS_ErrorOnColumnNotFound(t *testing.T) { }}, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) assert.Error(t, err) } @@ -479,7 +479,7 @@ func TestScraper_CollectRowToMetricsErrors(t *testing.T) { }}, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) assert.ErrorContains(t, err, "rowToMetric: start_ts_column not found") assert.ErrorContains(t, err, "rowToMetric: ts_column not found") assert.ErrorContains(t, err, "rowToMetric: value_column 'mycol_na' not found in result set") @@ -507,6 +507,6 @@ func TestScraper_StartAndTS_ErrorOnParse(t *testing.T) { }}, }, } - _, err := scrpr.Scrape(context.Background()) + _, err := scrpr.ScrapeMetrics(context.Background()) assert.Error(t, err) } diff --git a/processor/deltatocumulativeprocessor/generated_component_telemetry_test.go b/processor/deltatocumulativeprocessor/generated_component_telemetry_test.go index e0df34fcd619..c51f05429ce0 100644 --- a/processor/deltatocumulativeprocessor/generated_component_telemetry_test.go +++ b/processor/deltatocumulativeprocessor/generated_component_telemetry_test.go @@ -7,16 +7,15 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processortest" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type componentTestTelemetry struct { diff --git a/processor/deltatocumulativeprocessor/internal/metadata/generated_telemetry.go b/processor/deltatocumulativeprocessor/internal/metadata/generated_telemetry.go index 0e093d55f26f..8ff94a6627e7 100644 --- a/processor/deltatocumulativeprocessor/internal/metadata/generated_telemetry.go +++ b/processor/deltatocumulativeprocessor/internal/metadata/generated_telemetry.go @@ -6,12 +6,11 @@ import ( "context" "errors" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" ) func Meter(settings component.TelemetrySettings) metric.Meter { diff --git a/processor/deltatocumulativeprocessor/internal/metadata/generated_telemetry_test.go b/processor/deltatocumulativeprocessor/internal/metadata/generated_telemetry_test.go index 487afe393eef..9c74d2146ac5 100644 --- a/processor/deltatocumulativeprocessor/internal/metadata/generated_telemetry_test.go +++ b/processor/deltatocumulativeprocessor/internal/metadata/generated_telemetry_test.go @@ -6,16 +6,15 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/processor/filterprocessor/generated_component_telemetry_test.go b/processor/filterprocessor/generated_component_telemetry_test.go index a0437762e184..d7590457c595 100644 --- a/processor/filterprocessor/generated_component_telemetry_test.go +++ b/processor/filterprocessor/generated_component_telemetry_test.go @@ -7,16 +7,15 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processortest" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type componentTestTelemetry struct { diff --git a/processor/filterprocessor/internal/metadata/generated_telemetry.go b/processor/filterprocessor/internal/metadata/generated_telemetry.go index e09ff3e3a6b7..e1fde85d1dea 100644 --- a/processor/filterprocessor/internal/metadata/generated_telemetry.go +++ b/processor/filterprocessor/internal/metadata/generated_telemetry.go @@ -5,12 +5,11 @@ package metadata import ( "errors" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" ) func Meter(settings component.TelemetrySettings) metric.Meter { diff --git a/processor/filterprocessor/internal/metadata/generated_telemetry_test.go b/processor/filterprocessor/internal/metadata/generated_telemetry_test.go index 0d7e36d7743c..f95f1cbd6c11 100644 --- a/processor/filterprocessor/internal/metadata/generated_telemetry_test.go +++ b/processor/filterprocessor/internal/metadata/generated_telemetry_test.go @@ -6,16 +6,15 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/processor/groupbyattrsprocessor/generated_component_telemetry_test.go b/processor/groupbyattrsprocessor/generated_component_telemetry_test.go index 740256a16f4e..71cb381ca940 100644 --- a/processor/groupbyattrsprocessor/generated_component_telemetry_test.go +++ b/processor/groupbyattrsprocessor/generated_component_telemetry_test.go @@ -7,16 +7,15 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processortest" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type componentTestTelemetry struct { diff --git a/processor/groupbyattrsprocessor/internal/metadata/generated_telemetry.go b/processor/groupbyattrsprocessor/internal/metadata/generated_telemetry.go index 4510d7aac459..e19cc13ecf01 100644 --- a/processor/groupbyattrsprocessor/internal/metadata/generated_telemetry.go +++ b/processor/groupbyattrsprocessor/internal/metadata/generated_telemetry.go @@ -5,12 +5,11 @@ package metadata import ( "errors" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" ) func Meter(settings component.TelemetrySettings) metric.Meter { diff --git a/processor/groupbyattrsprocessor/internal/metadata/generated_telemetry_test.go b/processor/groupbyattrsprocessor/internal/metadata/generated_telemetry_test.go index d943d9062622..3237c783fb2e 100644 --- a/processor/groupbyattrsprocessor/internal/metadata/generated_telemetry_test.go +++ b/processor/groupbyattrsprocessor/internal/metadata/generated_telemetry_test.go @@ -6,16 +6,15 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/processor/groupbytraceprocessor/generated_component_telemetry_test.go b/processor/groupbytraceprocessor/generated_component_telemetry_test.go index 7c7fd252435e..ff151528e1a7 100644 --- a/processor/groupbytraceprocessor/generated_component_telemetry_test.go +++ b/processor/groupbytraceprocessor/generated_component_telemetry_test.go @@ -7,16 +7,15 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/processor/processortest" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type componentTestTelemetry struct { diff --git a/processor/groupbytraceprocessor/internal/metadata/generated_telemetry.go b/processor/groupbytraceprocessor/internal/metadata/generated_telemetry.go index 8872905ca7b8..95a738424f27 100644 --- a/processor/groupbytraceprocessor/internal/metadata/generated_telemetry.go +++ b/processor/groupbytraceprocessor/internal/metadata/generated_telemetry.go @@ -5,12 +5,11 @@ package metadata import ( "errors" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" ) func Meter(settings component.TelemetrySettings) metric.Meter { diff --git a/processor/groupbytraceprocessor/internal/metadata/generated_telemetry_test.go b/processor/groupbytraceprocessor/internal/metadata/generated_telemetry_test.go index 5d00ebf09e34..da1f0d224103 100644 --- a/processor/groupbytraceprocessor/internal/metadata/generated_telemetry_test.go +++ b/processor/groupbytraceprocessor/internal/metadata/generated_telemetry_test.go @@ -6,16 +6,15 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/receiver/activedirectorydsreceiver/factory_windows.go b/receiver/activedirectorydsreceiver/factory_windows.go index 38da7b87cb85..2603c6c89640 100644 --- a/receiver/activedirectorydsreceiver/factory_windows.go +++ b/receiver/activedirectorydsreceiver/factory_windows.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/activedirectorydsreceiver/internal/metadata" ) @@ -31,10 +32,10 @@ func createMetricsReceiver( } adds := newActiveDirectoryDSScraper(c.MetricsBuilderConfig, params) - scraper, err := scraperhelper.NewScraperWithoutType( + s, err := scraper.NewMetrics( adds.scrape, - scraperhelper.WithStart(adds.start), - scraperhelper.WithShutdown(adds.shutdown), + scraper.WithStart(adds.start), + scraper.WithShutdown(adds.shutdown), ) if err != nil { return nil, err @@ -44,6 +45,6 @@ func createMetricsReceiver( &c.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/activedirectorydsreceiver/go.mod b/receiver/activedirectorydsreceiver/go.mod index fe4e788b8fb4..d174a622e898 100644 --- a/receiver/activedirectorydsreceiver/go.mod +++ b/receiver/activedirectorydsreceiver/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -46,7 +47,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/activedirectorydsreceiver/go.sum b/receiver/activedirectorydsreceiver/go.sum index 44360e93c707..a3c5cfcc3544 100644 --- a/receiver/activedirectorydsreceiver/go.sum +++ b/receiver/activedirectorydsreceiver/go.sum @@ -80,8 +80,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/aerospikereceiver/factory.go b/receiver/aerospikereceiver/factory.go index 50d4f2e92c12..174ea8b55732 100644 --- a/receiver/aerospikereceiver/factory.go +++ b/receiver/aerospikereceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/aerospikereceiver/internal/metadata" ) @@ -38,15 +39,14 @@ func createMetricsReceiver( consumer consumer.Metrics, ) (receiver.Metrics, error) { cfg := rConf.(*Config) - receiver, err := newAerospikeReceiver(params, cfg, consumer) + r, err := newAerospikeReceiver(params, cfg, consumer) if err != nil { return nil, err } - scraper, err := scraperhelper.NewScraperWithoutType( - receiver.scrape, - scraperhelper.WithStart(receiver.start), - scraperhelper.WithShutdown(receiver.shutdown), + s, err := scraper.NewMetrics(r.scrape, + scraper.WithStart(r.start), + scraper.WithShutdown(r.shutdown), ) if err != nil { return nil, err @@ -54,7 +54,7 @@ func createMetricsReceiver( return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/aerospikereceiver/go.mod b/receiver/aerospikereceiver/go.mod index 968c64ac09b7..033dcd82262a 100644 --- a/receiver/aerospikereceiver/go.mod +++ b/receiver/aerospikereceiver/go.mod @@ -21,6 +21,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -87,7 +88,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/aerospikereceiver/go.sum b/receiver/aerospikereceiver/go.sum index ba9f8db06fad..c61e6004166d 100644 --- a/receiver/aerospikereceiver/go.sum +++ b/receiver/aerospikereceiver/go.sum @@ -180,8 +180,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/apachereceiver/factory.go b/receiver/apachereceiver/factory.go index cc7798aceaa6..776372a289d3 100644 --- a/receiver/apachereceiver/factory.go +++ b/receiver/apachereceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/apachereceiver/internal/metadata" ) @@ -78,13 +79,13 @@ func createMetricsReceiver( } ns := newApacheScraper(params, cfg, serverName, port) - scraper, err := scraperhelper.NewScraperWithoutType(ns.scrape, scraperhelper.WithStart(ns.start)) + s, err := scraper.NewMetrics(ns.scrape, scraper.WithStart(ns.start)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/apachereceiver/go.mod b/receiver/apachereceiver/go.mod index f5174f1ecb0d..2739581b291a 100644 --- a/receiver/apachereceiver/go.mod +++ b/receiver/apachereceiver/go.mod @@ -20,6 +20,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -92,7 +93,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/apachereceiver/go.sum b/receiver/apachereceiver/go.sum index aa13d37b197b..77ebfa99baa7 100644 --- a/receiver/apachereceiver/go.sum +++ b/receiver/apachereceiver/go.sum @@ -190,8 +190,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/apachesparkreceiver/factory.go b/receiver/apachesparkreceiver/factory.go index 07d852654c97..3094d37b0092 100644 --- a/receiver/apachesparkreceiver/factory.go +++ b/receiver/apachesparkreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/apachesparkreceiver/internal/metadata" ) @@ -52,12 +53,12 @@ func createMetricsReceiver( } sparkScraper := newSparkScraper(params.Logger, sparkConfig, params) - scraper, err := scraperhelper.NewScraperWithoutType(sparkScraper.scrape, - scraperhelper.WithStart(sparkScraper.start)) + s, err := scraper.NewMetrics(sparkScraper.scrape, + scraper.WithStart(sparkScraper.start)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver(&sparkConfig.ControllerConfig, params, - consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + consumer, scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/apachesparkreceiver/go.mod b/receiver/apachesparkreceiver/go.mod index dbc77a160a80..9da05988345f 100644 --- a/receiver/apachesparkreceiver/go.mod +++ b/receiver/apachesparkreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -93,7 +94,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/apachesparkreceiver/go.sum b/receiver/apachesparkreceiver/go.sum index aa13d37b197b..77ebfa99baa7 100644 --- a/receiver/apachesparkreceiver/go.sum +++ b/receiver/apachesparkreceiver/go.sum @@ -190,8 +190,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/azuremonitorreceiver/factory.go b/receiver/azuremonitorreceiver/factory.go index 6fc984360321..d5054b43d5c6 100644 --- a/receiver/azuremonitorreceiver/factory.go +++ b/receiver/azuremonitorreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azuremonitorreceiver/internal/metadata" ) @@ -55,10 +56,10 @@ func createMetricsReceiver(_ context.Context, params receiver.Settings, rConf co } azureScraper := newScraper(cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType(azureScraper.scrape, scraperhelper.WithStart(azureScraper.start)) + s, err := scraper.NewMetrics(azureScraper.scrape, scraper.WithStart(azureScraper.start)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/azuremonitorreceiver/go.mod b/receiver/azuremonitorreceiver/go.mod index 5e7e5381e4c3..d98dfcbc1ba3 100644 --- a/receiver/azuremonitorreceiver/go.mod +++ b/receiver/azuremonitorreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -53,7 +54,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/azuremonitorreceiver/go.sum b/receiver/azuremonitorreceiver/go.sum index f25dd34a0213..7f777ea6cce9 100644 --- a/receiver/azuremonitorreceiver/go.sum +++ b/receiver/azuremonitorreceiver/go.sum @@ -112,8 +112,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/bigipreceiver/factory.go b/receiver/bigipreceiver/factory.go index 719335e912bc..412877668d9c 100644 --- a/receiver/bigipreceiver/factory.go +++ b/receiver/bigipreceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/bigipreceiver/internal/metadata" ) @@ -49,10 +50,10 @@ func createMetricsReceiver(_ context.Context, params receiver.Settings, rConf co } bigipScraper := newScraper(params.Logger, cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType(bigipScraper.scrape, scraperhelper.WithStart(bigipScraper.start)) + s, err := scraper.NewMetrics(bigipScraper.scrape, scraper.WithStart(bigipScraper.start)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/bigipreceiver/go.mod b/receiver/bigipreceiver/go.mod index e19d3f7a4649..dd0e707d9b06 100644 --- a/receiver/bigipreceiver/go.mod +++ b/receiver/bigipreceiver/go.mod @@ -20,6 +20,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -94,7 +95,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/bigipreceiver/go.sum b/receiver/bigipreceiver/go.sum index aa13d37b197b..77ebfa99baa7 100644 --- a/receiver/bigipreceiver/go.sum +++ b/receiver/bigipreceiver/go.sum @@ -190,8 +190,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/chronyreceiver/factory.go b/receiver/chronyreceiver/factory.go index a0e0a1216c08..ae9ba3591a5c 100644 --- a/receiver/chronyreceiver/factory.go +++ b/receiver/chronyreceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver/internal/chrony" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/chronyreceiver/internal/metadata" @@ -36,9 +37,8 @@ func newMetricsReceiver( } s := newScraper(ctx, cfg, set) - scraper, err := scraperhelper.NewScraperWithoutType( - s.scrape, - scraperhelper.WithStart(func(_ context.Context, _ component.Host) error { + sc, err := scraper.NewMetrics(s.scrape, + scraper.WithStart(func(_ context.Context, _ component.Host) error { chronyc, err := chrony.New(cfg.Endpoint, cfg.Timeout) s.client = chronyc return err @@ -52,6 +52,6 @@ func newMetricsReceiver( &cfg.ControllerConfig, set, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, sc), ) } diff --git a/receiver/chronyreceiver/go.mod b/receiver/chronyreceiver/go.mod index 9ff98f1124da..edf759a6d202 100644 --- a/receiver/chronyreceiver/go.mod +++ b/receiver/chronyreceiver/go.mod @@ -15,6 +15,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -44,7 +45,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/chronyreceiver/go.sum b/receiver/chronyreceiver/go.sum index bd381cf28893..08a3cbdd04cf 100644 --- a/receiver/chronyreceiver/go.sum +++ b/receiver/chronyreceiver/go.sum @@ -87,8 +87,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/couchdbreceiver/factory.go b/receiver/couchdbreceiver/factory.go index 7bb46e7ea043..f89780dff291 100644 --- a/receiver/couchdbreceiver/factory.go +++ b/receiver/couchdbreceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/couchdbreceiver/internal/metadata" ) @@ -45,13 +46,13 @@ func createMetricsReceiver( ) (receiver.Metrics, error) { cfg := rConf.(*Config) ns := newCouchdbScraper(params, cfg) - scraper, err := scraperhelper.NewScraperWithoutType(ns.scrape, scraperhelper.WithStart(ns.start)) + s, err := scraper.NewMetrics(ns.scrape, scraper.WithStart(ns.start)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/couchdbreceiver/go.mod b/receiver/couchdbreceiver/go.mod index a50d1827cae2..cab32d04da2a 100644 --- a/receiver/couchdbreceiver/go.mod +++ b/receiver/couchdbreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -61,7 +62,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect diff --git a/receiver/couchdbreceiver/go.sum b/receiver/couchdbreceiver/go.sum index 709cd2bc0af3..3cb7e77d34bb 100644 --- a/receiver/couchdbreceiver/go.sum +++ b/receiver/couchdbreceiver/go.sum @@ -116,8 +116,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/dockerstatsreceiver/factory.go b/receiver/dockerstatsreceiver/factory.go index aca784c2fbfd..56cf2cb1f0e5 100644 --- a/receiver/dockerstatsreceiver/factory.go +++ b/receiver/dockerstatsreceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/dockerstatsreceiver/internal/metadata" @@ -47,10 +48,10 @@ func createMetricsReceiver( dockerConfig := config.(*Config) dsr := newMetricsReceiver(params, dockerConfig) - scrp, err := scraperhelper.NewScraperWithoutType(dsr.scrapeV2, scraperhelper.WithStart(dsr.start), scraperhelper.WithShutdown(dsr.shutdown)) + scrp, err := scraper.NewMetrics(dsr.scrapeV2, scraper.WithStart(dsr.start), scraper.WithShutdown(dsr.shutdown)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&dsr.config.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scrp)) + return scraperhelper.NewScraperControllerReceiver(&dsr.config.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, scrp)) } diff --git a/receiver/dockerstatsreceiver/go.mod b/receiver/dockerstatsreceiver/go.mod index 44450bed3993..afe4ccce5aa0 100644 --- a/receiver/dockerstatsreceiver/go.mod +++ b/receiver/dockerstatsreceiver/go.mod @@ -21,6 +21,7 @@ require ( go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 @@ -85,7 +86,6 @@ require ( go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/dockerstatsreceiver/go.sum b/receiver/dockerstatsreceiver/go.sum index aadd5e7056a6..d6a01c14ae79 100644 --- a/receiver/dockerstatsreceiver/go.sum +++ b/receiver/dockerstatsreceiver/go.sum @@ -166,8 +166,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= diff --git a/receiver/elasticsearchreceiver/factory.go b/receiver/elasticsearchreceiver/factory.go index 262bead93ea9..1482addf99a0 100644 --- a/receiver/elasticsearchreceiver/factory.go +++ b/receiver/elasticsearchreceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/elasticsearchreceiver/internal/metadata" ) @@ -63,7 +64,7 @@ func createMetricsReceiver( } es := newElasticSearchScraper(params, c) - scraper, err := scraperhelper.NewScraperWithoutType(es.scrape, scraperhelper.WithStart(es.start)) + s, err := scraper.NewMetrics(es.scrape, scraper.WithStart(es.start)) if err != nil { return nil, err } @@ -72,6 +73,6 @@ func createMetricsReceiver( &c.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/elasticsearchreceiver/go.mod b/receiver/elasticsearchreceiver/go.mod index 5318beff6fe1..8918a023d5af 100644 --- a/receiver/elasticsearchreceiver/go.mod +++ b/receiver/elasticsearchreceiver/go.mod @@ -22,6 +22,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -94,7 +95,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/elasticsearchreceiver/go.sum b/receiver/elasticsearchreceiver/go.sum index c9229e95aacd..87f16df6ba73 100644 --- a/receiver/elasticsearchreceiver/go.sum +++ b/receiver/elasticsearchreceiver/go.sum @@ -192,8 +192,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/expvarreceiver/factory.go b/receiver/expvarreceiver/factory.go index dcd1efb8223c..e60059a7583e 100644 --- a/receiver/expvarreceiver/factory.go +++ b/receiver/expvarreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/expvarreceiver/internal/metadata" ) @@ -38,9 +39,9 @@ func newMetricsReceiver( cfg := rCfg.(*Config) expVar := newExpVarScraper(cfg, set) - scraper, err := scraperhelper.NewScraperWithoutType( + s, err := scraper.NewMetrics( expVar.scrape, - scraperhelper.WithStart(expVar.start), + scraper.WithStart(expVar.start), ) if err != nil { return nil, err @@ -50,7 +51,7 @@ func newMetricsReceiver( &cfg.ControllerConfig, set, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/expvarreceiver/go.mod b/receiver/expvarreceiver/go.mod index a532e018acce..f4208a0ae7f0 100644 --- a/receiver/expvarreceiver/go.mod +++ b/receiver/expvarreceiver/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -58,7 +59,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect diff --git a/receiver/expvarreceiver/go.sum b/receiver/expvarreceiver/go.sum index 03d2908e5bde..916e3374066d 100644 --- a/receiver/expvarreceiver/go.sum +++ b/receiver/expvarreceiver/go.sum @@ -112,8 +112,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/filestatsreceiver/factory.go b/receiver/filestatsreceiver/factory.go index 64c928852ff5..3dfcd5bee1ed 100644 --- a/receiver/filestatsreceiver/factory.go +++ b/receiver/filestatsreceiver/factory.go @@ -10,6 +10,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filestatsreceiver/internal/metadata" ) @@ -38,11 +39,11 @@ func newReceiver( fileStatsConfig := cfg.(*Config) mp := newScraper(fileStatsConfig, settings) - s, err := scraperhelper.NewScraperWithoutType(mp.scrape) + s, err := scraper.NewMetrics(mp.scrape) if err != nil { return nil, err } - opt := scraperhelper.AddScraperWithType(metadata.Type, s) + opt := scraperhelper.AddScraper(metadata.Type, s) return scraperhelper.NewScraperControllerReceiver( &fileStatsConfig.ControllerConfig, diff --git a/receiver/filestatsreceiver/go.mod b/receiver/filestatsreceiver/go.mod index 746e7f45a19e..12e193297ad2 100644 --- a/receiver/filestatsreceiver/go.mod +++ b/receiver/filestatsreceiver/go.mod @@ -17,6 +17,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -82,7 +83,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/filestatsreceiver/go.sum b/receiver/filestatsreceiver/go.sum index 77d20c4f7777..5adb2c68d077 100644 --- a/receiver/filestatsreceiver/go.sum +++ b/receiver/filestatsreceiver/go.sum @@ -164,8 +164,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/filestatsreceiver/scraper.go b/receiver/filestatsreceiver/scraper.go index 68189640ff7c..27e7e225b6b1 100644 --- a/receiver/filestatsreceiver/scraper.go +++ b/receiver/filestatsreceiver/scraper.go @@ -19,13 +19,13 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filestatsreceiver/internal/metadata" ) -type scraper struct { +type fsScraper struct { include string logger *zap.Logger mb *metadata.MetricsBuilder } -func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { +func (s *fsScraper) scrape(_ context.Context) (pmetric.Metrics, error) { matches, err := doublestar.FilepathGlob(s.include) if err != nil { return pmetric.NewMetrics(), err @@ -60,8 +60,8 @@ func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { return s.mb.Emit(), nil } -func newScraper(cfg *Config, settings receiver.Settings) *scraper { - return &scraper{ +func newScraper(cfg *Config, settings receiver.Settings) *fsScraper { + return &fsScraper{ include: cfg.Include, logger: settings.TelemetrySettings.Logger, mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, settings), diff --git a/receiver/flinkmetricsreceiver/factory.go b/receiver/flinkmetricsreceiver/factory.go index eed2efff27ba..c28dc8d9c837 100644 --- a/receiver/flinkmetricsreceiver/factory.go +++ b/receiver/flinkmetricsreceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/flinkmetricsreceiver/internal/metadata" ) @@ -53,13 +54,13 @@ func createMetricsReceiver( return nil, errConfigNotflinkmetrics } ns := newflinkScraper(cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType(ns.scrape, scraperhelper.WithStart(ns.start)) + s, err := scraper.NewMetrics(ns.scrape, scraper.WithStart(ns.start)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/flinkmetricsreceiver/go.mod b/receiver/flinkmetricsreceiver/go.mod index afd410ccb09e..0e539bb71fc2 100644 --- a/receiver/flinkmetricsreceiver/go.mod +++ b/receiver/flinkmetricsreceiver/go.mod @@ -18,6 +18,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -60,7 +61,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect diff --git a/receiver/flinkmetricsreceiver/go.sum b/receiver/flinkmetricsreceiver/go.sum index 709cd2bc0af3..3cb7e77d34bb 100644 --- a/receiver/flinkmetricsreceiver/go.sum +++ b/receiver/flinkmetricsreceiver/go.sum @@ -116,8 +116,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/fluentforwardreceiver/generated_component_telemetry_test.go b/receiver/fluentforwardreceiver/generated_component_telemetry_test.go index b9e56469e632..98b355ee3d2e 100644 --- a/receiver/fluentforwardreceiver/generated_component_telemetry_test.go +++ b/receiver/fluentforwardreceiver/generated_component_telemetry_test.go @@ -7,16 +7,15 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type componentTestTelemetry struct { diff --git a/receiver/fluentforwardreceiver/internal/metadata/generated_telemetry.go b/receiver/fluentforwardreceiver/internal/metadata/generated_telemetry.go index bca1ba18d6a3..8cd2f95142f6 100644 --- a/receiver/fluentforwardreceiver/internal/metadata/generated_telemetry.go +++ b/receiver/fluentforwardreceiver/internal/metadata/generated_telemetry.go @@ -5,12 +5,11 @@ package metadata import ( "errors" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" ) func Meter(settings component.TelemetrySettings) metric.Meter { diff --git a/receiver/fluentforwardreceiver/internal/metadata/generated_telemetry_test.go b/receiver/fluentforwardreceiver/internal/metadata/generated_telemetry_test.go index 06d4cc292c5f..c6ecc8bd9cd8 100644 --- a/receiver/fluentforwardreceiver/internal/metadata/generated_telemetry_test.go +++ b/receiver/fluentforwardreceiver/internal/metadata/generated_telemetry_test.go @@ -6,16 +6,15 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/receiver/githubreceiver/factory.go b/receiver/githubreceiver/factory.go index 28c9ceb7b556..65839b4fad4e 100644 --- a/receiver/githubreceiver/factory.go +++ b/receiver/githubreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal/metadata" @@ -100,7 +101,7 @@ func createAddScraperOpts( return nil, fmt.Errorf("failed to create scraper %q: %w", key, err) } - scraperControllerOptions = append(scraperControllerOptions, scraperhelper.AddScraperWithType(metadata.Type, githubScraper)) + scraperControllerOptions = append(scraperControllerOptions, scraperhelper.AddScraper(metadata.Type, githubScraper)) } return scraperControllerOptions, nil @@ -112,13 +113,13 @@ func createGitHubScraper( key string, cfg internal.Config, factories map[string]internal.ScraperFactory, -) (scraper scraperhelper.Scraper, err error) { +) (s scraper.Metrics, err error) { factory := factories[key] if factory == nil { return nil, fmt.Errorf("factory not found for scraper %q", key) } - scraper, err = factory.CreateMetricsScraper(ctx, params, cfg) + s, err = factory.CreateMetricsScraper(ctx, params, cfg) if err != nil { return nil, err } diff --git a/receiver/githubreceiver/go.mod b/receiver/githubreceiver/go.mod index d066739bc7a4..8901616f8245 100644 --- a/receiver/githubreceiver/go.mod +++ b/receiver/githubreceiver/go.mod @@ -21,6 +21,7 @@ require ( go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 @@ -106,7 +107,6 @@ require ( go.opentelemetry.io/collector/processor/processorprofiles v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/processor/processortest v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect go.opentelemetry.io/contrib/config v0.10.0 // indirect diff --git a/receiver/githubreceiver/go.sum b/receiver/githubreceiver/go.sum index 1cdca4e087e0..a57a3cf85031 100644 --- a/receiver/githubreceiver/go.sum +++ b/receiver/githubreceiver/go.sum @@ -222,8 +222,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be h1:qQxHHmhM/UoWf+uApuEn732ONV5eEdjfYMLO1QO0I6s= diff --git a/receiver/githubreceiver/internal/scraper.go b/receiver/githubreceiver/internal/scraper.go index 869e20639aef..9789999fc7b8 100644 --- a/receiver/githubreceiver/internal/scraper.go +++ b/receiver/githubreceiver/internal/scraper.go @@ -7,14 +7,14 @@ import ( "context" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" ) type ScraperFactory interface { // Create the default configuration for the sub sccraper. CreateDefaultConfig() Config // Create a scraper based on the configuration passed or return an error if not valid. - CreateMetricsScraper(ctx context.Context, params receiver.Settings, cfg Config) (scraperhelper.Scraper, error) + CreateMetricsScraper(ctx context.Context, params receiver.Settings, cfg Config) (scraper.Metrics, error) } type Config any diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/factory.go b/receiver/githubreceiver/internal/scraper/githubscraper/factory.go index b14485822b7e..eb82e1c5c6f4 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/factory.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/factory.go @@ -9,7 +9,7 @@ import ( "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver/internal/metadata" @@ -33,15 +33,15 @@ func (f *Factory) CreateDefaultConfig() internal.Config { } func (f *Factory) CreateMetricsScraper( - ctx context.Context, + _ context.Context, params receiver.Settings, cfg internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { conf := cfg.(*Config) - s := newGitHubScraper(ctx, params, conf) + s := newGitHubScraper(params, conf) - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), + scraper.WithStart(s.start), ) } diff --git a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go index 927a444322ad..70bf35f059fa 100644 --- a/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go +++ b/receiver/githubreceiver/internal/scraper/githubscraper/github_scraper.go @@ -39,7 +39,6 @@ func (ghs *githubScraper) start(ctx context.Context, host component.Host) (err e } func newGitHubScraper( - _ context.Context, settings receiver.Settings, cfg *Config, ) *githubScraper { diff --git a/receiver/googlecloudmonitoringreceiver/factory.go b/receiver/googlecloudmonitoringreceiver/factory.go index 94ab3bb7e699..28ca898339e3 100644 --- a/receiver/googlecloudmonitoringreceiver/factory.go +++ b/receiver/googlecloudmonitoringreceiver/factory.go @@ -10,6 +10,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver/internal/metadata" ) @@ -40,12 +41,12 @@ func createMetricsReceiver( rCfg := baseCfg.(*Config) r := newGoogleCloudMonitoringReceiver(rCfg, settings.Logger) - scraper, err := scraperhelper.NewScraperWithoutType(r.Scrape, scraperhelper.WithStart(r.Start), - scraperhelper.WithShutdown(r.Shutdown)) + s, err := scraper.NewMetrics(r.Scrape, scraper.WithStart(r.Start), + scraper.WithShutdown(r.Shutdown)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver(&rCfg.ControllerConfig, settings, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper)) + scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/googlecloudmonitoringreceiver/go.mod b/receiver/googlecloudmonitoringreceiver/go.mod index 5c82cf3b024d..518adfd2c7eb 100644 --- a/receiver/googlecloudmonitoringreceiver/go.mod +++ b/receiver/googlecloudmonitoringreceiver/go.mod @@ -12,6 +12,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/zap v1.27.0 golang.org/x/oauth2 v0.23.0 google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 @@ -29,7 +30,6 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/collector/consumer/consumererror v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect diff --git a/receiver/googlecloudmonitoringreceiver/go.sum b/receiver/googlecloudmonitoringreceiver/go.sum index 1941415d8a33..6a5afa730c23 100644 --- a/receiver/googlecloudmonitoringreceiver/go.sum +++ b/receiver/googlecloudmonitoringreceiver/go.sum @@ -134,8 +134,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= diff --git a/receiver/googlecloudspannerreceiver/factory.go b/receiver/googlecloudspannerreceiver/factory.go index abadefcb06ce..f3b28aa4f33a 100644 --- a/receiver/googlecloudspannerreceiver/factory.go +++ b/receiver/googlecloudspannerreceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudspannerreceiver/internal/metadata" ) @@ -49,12 +50,12 @@ func createMetricsReceiver( rCfg := baseCfg.(*Config) r := newGoogleCloudSpannerReceiver(settings.Logger, rCfg) - scraper, err := scraperhelper.NewScraperWithoutType(r.Scrape, scraperhelper.WithStart(r.Start), - scraperhelper.WithShutdown(r.Shutdown)) + s, err := scraper.NewMetrics(r.Scrape, scraper.WithStart(r.Start), + scraper.WithShutdown(r.Shutdown)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver(&rCfg.ControllerConfig, settings, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper)) + scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/googlecloudspannerreceiver/go.mod b/receiver/googlecloudspannerreceiver/go.mod index 8d5d4149f32b..597d75479d65 100644 --- a/receiver/googlecloudspannerreceiver/go.mod +++ b/receiver/googlecloudspannerreceiver/go.mod @@ -15,6 +15,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -69,7 +70,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/detectors/gcp v1.29.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect diff --git a/receiver/googlecloudspannerreceiver/go.sum b/receiver/googlecloudspannerreceiver/go.sum index 93f29f3680fd..2d2dc5170f2a 100644 --- a/receiver/googlecloudspannerreceiver/go.sum +++ b/receiver/googlecloudspannerreceiver/go.sum @@ -974,8 +974,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/detectors/gcp v1.29.0 h1:TiaiXB4DpGD3sdzNlYQxruQngn5Apwzi1X0DRhuGvDQ= go.opentelemetry.io/contrib/detectors/gcp v1.29.0/go.mod h1:GW2aWZNwR2ZxDLdv8OyC2G8zkRoQBuURgV7RPQgcPoU= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= diff --git a/receiver/haproxyreceiver/factory.go b/receiver/haproxyreceiver/factory.go index 463a2760c0c0..d88476d0693f 100644 --- a/receiver/haproxyreceiver/factory.go +++ b/receiver/haproxyreceiver/factory.go @@ -10,6 +10,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/haproxyreceiver/internal/metadata" ) @@ -30,14 +31,18 @@ func newDefaultConfig() component.Config { } func newReceiver( - _ context.Context, + ctx context.Context, settings receiver.Settings, cfg component.Config, consumer consumer.Metrics, ) (receiver.Metrics, error) { haProxyCfg := cfg.(*Config) mp := newScraper(haProxyCfg, settings) - s, err := scraperhelper.NewScraperWithoutType(mp.scrape, scraperhelper.WithStart(mp.start)) + s, err := scraper.NewMetrics(ctx, scraper.Settings{ + ID: settings.ID, + TelemetrySettings: settings.TelemetrySettings, + BuildInfo: settings.BuildInfo, + }, mp.scrape, scraper.WithStart(mp.start)) if err != nil { return nil, err } @@ -46,6 +51,6 @@ func newReceiver( &haProxyCfg.ControllerConfig, settings, consumer, - scraperhelper.AddScraperWithType(metadata.Type, s), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/haproxyreceiver/go.mod b/receiver/haproxyreceiver/go.mod index 4a663f3d7616..9d0b34c62a9d 100644 --- a/receiver/haproxyreceiver/go.mod +++ b/receiver/haproxyreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -93,7 +94,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/haproxyreceiver/go.sum b/receiver/haproxyreceiver/go.sum index aa13d37b197b..77ebfa99baa7 100644 --- a/receiver/haproxyreceiver/go.sum +++ b/receiver/haproxyreceiver/go.sum @@ -190,8 +190,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/haproxyreceiver/scraper.go b/receiver/haproxyreceiver/scraper.go index 25bcbfa3557c..0430a67d39c5 100644 --- a/receiver/haproxyreceiver/scraper.go +++ b/receiver/haproxyreceiver/scraper.go @@ -29,7 +29,7 @@ import ( var showStatsCommand = []byte("show stat\n") -type scraper struct { +type haproxyScraper struct { cfg *Config httpClient *http.Client logger *zap.Logger @@ -37,7 +37,7 @@ type scraper struct { telemetrySettings component.TelemetrySettings } -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *haproxyScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { var records []map[string]string if u, notURLerr := url.Parse(s.cfg.Endpoint); notURLerr == nil && strings.HasPrefix(u.Scheme, "http") { resp, err := s.httpClient.Get(s.cfg.Endpoint + ";csv") @@ -256,7 +256,7 @@ func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { return s.mb.Emit(), nil } -func (s *scraper) readStats(buf []byte) ([]map[string]string, error) { +func (s *haproxyScraper) readStats(buf []byte) ([]map[string]string, error) { reader := csv.NewReader(bytes.NewReader(bytes.TrimSpace(buf))) headers, err := reader.Read() if err != nil { @@ -280,14 +280,14 @@ func (s *scraper) readStats(buf []byte) ([]map[string]string, error) { return results, err } -func (s *scraper) start(ctx context.Context, host component.Host) error { +func (s *haproxyScraper) start(ctx context.Context, host component.Host) error { var err error s.httpClient, err = s.cfg.ClientConfig.ToClient(ctx, host, s.telemetrySettings) return err } -func newScraper(cfg *Config, settings receiver.Settings) *scraper { - return &scraper{ +func newScraper(cfg *Config, settings receiver.Settings) *haproxyScraper { + return &haproxyScraper{ logger: settings.TelemetrySettings.Logger, mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, settings), cfg: cfg, diff --git a/receiver/haproxyreceiver/scraper_test.go b/receiver/haproxyreceiver/scraper_test.go index ed6001750d22..80908233916e 100644 --- a/receiver/haproxyreceiver/scraper_test.go +++ b/receiver/haproxyreceiver/scraper_test.go @@ -55,7 +55,7 @@ func Test_scraper_readStats(t *testing.T) { require.NoError(t, err) require.NotNil(t, m) - expectedFile := filepath.Join("testdata", "scraper", "expected.yaml") + expectedFile := filepath.Join("testdata", "haproxyScraper", "expected.yaml") expectedMetrics, err := golden.ReadMetrics(expectedFile) require.NoError(t, err) require.NoError(t, pmetrictest.CompareMetrics(expectedMetrics, m, pmetrictest.IgnoreStartTimestamp(), @@ -99,7 +99,7 @@ func Test_scraper_readStatsWithIncompleteValues(t *testing.T) { require.NoError(t, err) require.NotNil(t, m) - expectedFile := filepath.Join("testdata", "scraper", "30252_expected.yaml") + expectedFile := filepath.Join("testdata", "haproxyScraper", "30252_expected.yaml") expectedMetrics, err := golden.ReadMetrics(expectedFile) require.NoError(t, err) require.NoError(t, pmetrictest.CompareMetrics(expectedMetrics, m, pmetrictest.IgnoreStartTimestamp(), diff --git a/receiver/hostmetricsreceiver/go.mod b/receiver/hostmetricsreceiver/go.mod index 5a9e1fbf2346..c7cd5b879823 100644 --- a/receiver/hostmetricsreceiver/go.mod +++ b/receiver/hostmetricsreceiver/go.mod @@ -25,6 +25,7 @@ require ( go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 @@ -125,7 +126,6 @@ require ( go.opentelemetry.io/collector/processor/processorprofiles v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/processor/processortest v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect go.opentelemetry.io/contrib/config v0.10.0 // indirect diff --git a/receiver/hostmetricsreceiver/go.sum b/receiver/hostmetricsreceiver/go.sum index f635a90ad765..bbeaa46237e8 100644 --- a/receiver/hostmetricsreceiver/go.sum +++ b/receiver/hostmetricsreceiver/go.sum @@ -275,8 +275,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be h1:qQxHHmhM/UoWf+uApuEn732ONV5eEdjfYMLO1QO0I6s= diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper.go index 85edc10ccb10..f113d8ffd130 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper.go @@ -26,8 +26,8 @@ const ( hzInAMHz = 1_000_000 ) -// scraper for CPU Metrics -type scraper struct { +// cpuScraper for CPU Metrics +type cpuScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -45,11 +45,11 @@ type cpuInfo struct { } // newCPUScraper creates a set of CPU related metrics -func newCPUScraper(_ context.Context, settings receiver.Settings, cfg *Config) *scraper { - return &scraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, times: cpu.TimesWithContext, ucal: &ucal.CPUUtilizationCalculator{}, now: time.Now} +func newCPUScraper(_ context.Context, settings receiver.Settings, cfg *Config) *cpuScraper { + return &cpuScraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, times: cpu.TimesWithContext, ucal: &ucal.CPUUtilizationCalculator{}, now: time.Now} } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *cpuScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -59,7 +59,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *cpuScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) now := pcommon.NewTimestampFromTime(s.now()) cpuTimes, err := s.times(ctx, true /*percpu=*/) diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_linux.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_linux.go index 66f1625e36fa..fe94ae6755d4 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_linux.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_linux.go @@ -15,7 +15,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal" ) -func (s *scraper) recordCPUTimeStateDataPoints(now pcommon.Timestamp, cpuTime cpu.TimesStat) { +func (s *cpuScraper) recordCPUTimeStateDataPoints(now pcommon.Timestamp, cpuTime cpu.TimesStat) { s.mb.RecordSystemCPUTimeDataPoint(now, cpuTime.User, cpuTime.CPU, metadata.AttributeStateUser) s.mb.RecordSystemCPUTimeDataPoint(now, cpuTime.System, cpuTime.CPU, metadata.AttributeStateSystem) s.mb.RecordSystemCPUTimeDataPoint(now, cpuTime.Idle, cpuTime.CPU, metadata.AttributeStateIdle) @@ -26,7 +26,7 @@ func (s *scraper) recordCPUTimeStateDataPoints(now pcommon.Timestamp, cpuTime cp s.mb.RecordSystemCPUTimeDataPoint(now, cpuTime.Iowait, cpuTime.CPU, metadata.AttributeStateWait) } -func (s *scraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { +func (s *cpuScraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { s.mb.RecordSystemCPUUtilizationDataPoint(now, cpuUtilization.User, cpuUtilization.CPU, metadata.AttributeStateUser) s.mb.RecordSystemCPUUtilizationDataPoint(now, cpuUtilization.System, cpuUtilization.CPU, metadata.AttributeStateSystem) s.mb.RecordSystemCPUUtilizationDataPoint(now, cpuUtilization.Idle, cpuUtilization.CPU, metadata.AttributeStateIdle) @@ -37,7 +37,7 @@ func (s *scraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization uca s.mb.RecordSystemCPUUtilizationDataPoint(now, cpuUtilization.Iowait, cpuUtilization.CPU, metadata.AttributeStateWait) } -func (s *scraper) getCPUInfo() ([]cpuInfo, error) { +func (s *cpuScraper) getCPUInfo() ([]cpuInfo, error) { var cpuInfos []cpuInfo fs, err := procfs.NewDefaultFS() if err != nil { diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_others.go index 3da080ecc8bf..cd63a5d8b562 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_others.go @@ -13,21 +13,21 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/ucal" ) -func (s *scraper) recordCPUTimeStateDataPoints(now pcommon.Timestamp, cpuTime cpu.TimesStat) { +func (s *cpuScraper) recordCPUTimeStateDataPoints(now pcommon.Timestamp, cpuTime cpu.TimesStat) { s.mb.RecordSystemCPUTimeDataPoint(now, cpuTime.User, cpuTime.CPU, metadata.AttributeStateUser) s.mb.RecordSystemCPUTimeDataPoint(now, cpuTime.System, cpuTime.CPU, metadata.AttributeStateSystem) s.mb.RecordSystemCPUTimeDataPoint(now, cpuTime.Idle, cpuTime.CPU, metadata.AttributeStateIdle) s.mb.RecordSystemCPUTimeDataPoint(now, cpuTime.Irq, cpuTime.CPU, metadata.AttributeStateInterrupt) } -func (s *scraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { +func (s *cpuScraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { s.mb.RecordSystemCPUUtilizationDataPoint(now, cpuUtilization.User, cpuUtilization.CPU, metadata.AttributeStateUser) s.mb.RecordSystemCPUUtilizationDataPoint(now, cpuUtilization.System, cpuUtilization.CPU, metadata.AttributeStateSystem) s.mb.RecordSystemCPUUtilizationDataPoint(now, cpuUtilization.Idle, cpuUtilization.CPU, metadata.AttributeStateIdle) s.mb.RecordSystemCPUUtilizationDataPoint(now, cpuUtilization.Irq, cpuUtilization.CPU, metadata.AttributeStateInterrupt) } -func (s *scraper) getCPUInfo() ([]cpuInfo, error) { +func (s *cpuScraper) getCPUInfo() ([]cpuInfo, error) { var cpuInfos []cpuInfo return cpuInfos, nil } diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go index 9429d36159a0..89777eaa9323 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper_test.go @@ -87,7 +87,7 @@ func TestScrape(t *testing.T) { assert.EqualError(t, err, test.initializationErr) return } - require.NoError(t, err, "Failed to initialize cpu scraper: %v", err) + require.NoError(t, err, "Failed to initialize cpu cpuScraper: %v", err) md, err := scraper.scrape(context.Background()) if test.expectedErr != "" { @@ -175,7 +175,7 @@ func TestScrape_CpuUtilization(t *testing.T) { scraper := newCPUScraper(context.Background(), receivertest.NewNopSettings(), &Config{MetricsBuilderConfig: settings}) err := scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize cpu scraper: %v", err) + require.NoError(t, err, "Failed to initialize cpu cpuScraper: %v", err) _, err = scraper.scrape(context.Background()) require.NoError(t, err, "Failed to scrape metrics: %v", err) @@ -216,7 +216,7 @@ func TestScrape_CpuUtilizationError(t *testing.T) { return []cpu.TimesStat{{CPU: "1", System: 1, User: 2}}, nil } err := scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize cpu scraper: %v", err) + require.NoError(t, err, "Failed to initialize cpu cpuScraper: %v", err) _, err = scraper.scrape(context.Background()) // Force error not finding CPU info @@ -290,7 +290,7 @@ func TestScrape_CpuUtilizationStandard(t *testing.T) { } err := cpuScraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize cpu scraper: %v", err) + require.NoError(t, err, "Failed to initialize cpu cpuScraper: %v", err) md, err := cpuScraper.scrape(context.Background()) require.NoError(t, err) diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/factory.go index bab24b125b55..e0eafe1e6bba 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/factory.go @@ -7,20 +7,20 @@ import ( "context" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata" ) -// This file implements Factory for CPU scraper. +// This file implements Factory for CPU cpuScraper. const ( // TypeStr the value of "type" key in configuration. TypeStr = "cpu" ) -// Factory is the Factory for scraper. +// Factory is the Factory for cpuScraper. type Factory struct{} // CreateDefaultConfig creates the default configuration for the Scraper. @@ -30,17 +30,16 @@ func (f *Factory) CreateDefaultConfig() internal.Config { } } -// CreateMetricsScraper creates a scraper based on provided config. +// CreateMetricsScraper creates a cpuScraper based on provided config. func (f *Factory) CreateMetricsScraper( - ctx context.Context, + _ context.Context, settings receiver.Settings, config internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { cfg := config.(*Config) s := newCPUScraper(ctx, settings, cfg) - return scraperhelper.NewScraperWithoutType( - s.scrape, - scraperhelper.WithStart(s.start), + return scraper.NewMetrics(s.scrape, + scraper.WithStart(s.start), ) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/config.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/config.go index 29048bd3188e..b59fdb70a9d4 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/config.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/config.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package diskscraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/diskscraper" +package diskscraper // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/diskScraper/diskscraper" import ( "github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter/filterset" diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others.go index 43e4ccda36ca..0ca84691ca90 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others.go @@ -29,7 +29,7 @@ const ( ) // scraper for Disk Metrics -type scraper struct { +type diskScraper struct { settings receiver.Settings config *Config startTime pcommon.Timestamp @@ -43,8 +43,8 @@ type scraper struct { } // newDiskScraper creates a Disk Scraper -func newDiskScraper(_ context.Context, settings receiver.Settings, cfg *Config) (*scraper, error) { - scraper := &scraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, ioCounters: disk.IOCountersWithContext} +func newDiskScraper(_ context.Context, settings receiver.Settings, cfg *Config) (*diskScraper, error) { + scraper := &diskScraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, ioCounters: disk.IOCountersWithContext} var err error @@ -65,7 +65,7 @@ func newDiskScraper(_ context.Context, settings receiver.Settings, cfg *Config) return scraper, nil } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *diskScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -77,7 +77,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *diskScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) now := pcommon.NewTimestampFromTime(time.Now()) @@ -101,40 +101,40 @@ func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { return s.mb.Emit(), nil } -func (s *scraper) recordDiskIOMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { +func (s *diskScraper) recordDiskIOMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { for device, ioCounter := range ioCounters { s.mb.RecordSystemDiskIoDataPoint(now, int64(ioCounter.ReadBytes), device, metadata.AttributeDirectionRead) s.mb.RecordSystemDiskIoDataPoint(now, int64(ioCounter.WriteBytes), device, metadata.AttributeDirectionWrite) } } -func (s *scraper) recordDiskOperationsMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { +func (s *diskScraper) recordDiskOperationsMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { for device, ioCounter := range ioCounters { s.mb.RecordSystemDiskOperationsDataPoint(now, int64(ioCounter.ReadCount), device, metadata.AttributeDirectionRead) s.mb.RecordSystemDiskOperationsDataPoint(now, int64(ioCounter.WriteCount), device, metadata.AttributeDirectionWrite) } } -func (s *scraper) recordDiskIOTimeMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { +func (s *diskScraper) recordDiskIOTimeMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { for device, ioCounter := range ioCounters { s.mb.RecordSystemDiskIoTimeDataPoint(now, float64(ioCounter.IoTime)/1e3, device) } } -func (s *scraper) recordDiskOperationTimeMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { +func (s *diskScraper) recordDiskOperationTimeMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { for device, ioCounter := range ioCounters { s.mb.RecordSystemDiskOperationTimeDataPoint(now, float64(ioCounter.ReadTime)/1e3, device, metadata.AttributeDirectionRead) s.mb.RecordSystemDiskOperationTimeDataPoint(now, float64(ioCounter.WriteTime)/1e3, device, metadata.AttributeDirectionWrite) } } -func (s *scraper) recordDiskPendingOperationsMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { +func (s *diskScraper) recordDiskPendingOperationsMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { for device, ioCounter := range ioCounters { s.mb.RecordSystemDiskPendingOperationsDataPoint(now, int64(ioCounter.IopsInProgress), device) } } -func (s *scraper) filterByDevice(ioCounters map[string]disk.IOCountersStat) map[string]disk.IOCountersStat { +func (s *diskScraper) filterByDevice(ioCounters map[string]disk.IOCountersStat) map[string]disk.IOCountersStat { if s.includeFS == nil && s.excludeFS == nil { return ioCounters } @@ -147,7 +147,7 @@ func (s *scraper) filterByDevice(ioCounters map[string]disk.IOCountersStat) map[ return ioCounters } -func (s *scraper) includeDevice(deviceName string) bool { +func (s *diskScraper) includeDevice(deviceName string) bool { return (s.includeFS == nil || s.includeFS.Matches(deviceName)) && (s.excludeFS == nil || !s.excludeFS.Matches(deviceName)) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_fallback.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_fallback.go index 8d86417ca692..d0f4e1617fbe 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_fallback.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_fallback.go @@ -12,5 +12,5 @@ import ( const systemSpecificMetricsLen = 0 -func (s *scraper) recordSystemSpecificDataPoints(_ pcommon.Timestamp, _ map[string]disk.IOCountersStat) { +func (s *diskScraper) recordSystemSpecificDataPoints(_ pcommon.Timestamp, _ map[string]disk.IOCountersStat) { } diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_linux.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_linux.go index 2e21ee3b8cf0..a75e3392234d 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_linux.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_linux.go @@ -14,18 +14,18 @@ import ( const systemSpecificMetricsLen = 2 -func (s *scraper) recordSystemSpecificDataPoints(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { +func (s *diskScraper) recordSystemSpecificDataPoints(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { s.recordDiskWeightedIOTimeMetric(now, ioCounters) s.recordDiskMergedMetric(now, ioCounters) } -func (s *scraper) recordDiskWeightedIOTimeMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { +func (s *diskScraper) recordDiskWeightedIOTimeMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { for device, ioCounter := range ioCounters { s.mb.RecordSystemDiskWeightedIoTimeDataPoint(now, float64(ioCounter.WeightedIO)/1e3, device) } } -func (s *scraper) recordDiskMergedMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { +func (s *diskScraper) recordDiskMergedMetric(now pcommon.Timestamp, ioCounters map[string]disk.IOCountersStat) { for device, ioCounter := range ioCounters { s.mb.RecordSystemDiskMergedDataPoint(now, int64(ioCounter.MergedReadCount), device, metadata.AttributeDirectionRead) s.mb.RecordSystemDiskMergedDataPoint(now, int64(ioCounter.MergedWriteCount), device, metadata.AttributeDirectionWrite) diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_test.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_test.go index 0e80f0d0fcbf..39901b0305c6 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others_test.go @@ -38,14 +38,14 @@ func TestScrape_Others(t *testing.T) { for _, test := range testCases { t.Run(test.name, func(t *testing.T) { scraper, err := newDiskScraper(context.Background(), receivertest.NewNopSettings(), &Config{}) - require.NoError(t, err, "Failed to create disk scraper: %v", err) + require.NoError(t, err, "Failed to create disk diskScraper: %v", err) if test.ioCountersFunc != nil { scraper.ioCounters = test.ioCountersFunc } err = scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize disk scraper: %v", err) + require.NoError(t, err, "Failed to initialize disk diskScraper: %v", err) _, err = scraper.scrape(context.Background()) assert.EqualError(t, err, test.expectedErr) diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_test.go index 622c30ce3aa8..77cb00111322 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_test.go @@ -29,7 +29,7 @@ func TestScrape(t *testing.T) { initializationErr string expectMetrics int expectedStartTime pcommon.Timestamp - mutateScraper func(*scraper) + mutateScraper func(*diskScraper) } testCases := []testCase{ @@ -98,7 +98,7 @@ func TestScrape(t *testing.T) { require.Regexp(t, test.newErrRegex, err) return } - require.NoError(t, err, "Failed to create disk scraper: %v", err) + require.NoError(t, err, "Failed to create disk diskScraper: %v", err) if test.bootTimeFunc != nil { scraper.bootTime = test.bootTimeFunc @@ -109,7 +109,7 @@ func TestScrape(t *testing.T) { assert.EqualError(t, err, test.initializationErr) return } - require.NoError(t, err, "Failed to initialize disk scraper: %v", err) + require.NoError(t, err, "Failed to initialize disk diskScraper: %v", err) md, err := scraper.scrape(context.Background()) require.NoError(t, err, "Failed to scrape metrics: %v", err) diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows.go index 99d7385d454e..8637ee23e895 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows.go @@ -40,8 +40,8 @@ const ( queueLength = "Current Disk Queue Length" ) -// scraper for Disk Metrics -type scraper struct { +// diskScraper for Disk Metrics +type diskScraper struct { settings receiver.Settings config *Config startTime pcommon.Timestamp @@ -57,8 +57,8 @@ type scraper struct { } // newDiskScraper creates a Disk Scraper -func newDiskScraper(_ context.Context, settings receiver.Settings, cfg *Config) (*scraper, error) { - scraper := &scraper{settings: settings, config: cfg, perfCounterScraper: &perfcounters.PerfLibScraper{}, bootTime: host.BootTimeWithContext} +func newDiskScraper(_ context.Context, settings receiver.Settings, cfg *Config) (*diskScraper, error) { + scraper := &diskScraper{settings: settings, config: cfg, perfCounterScraper: &perfcounters.PerfLibScraper{}, bootTime: host.BootTimeWithContext} var err error @@ -79,7 +79,7 @@ func newDiskScraper(_ context.Context, settings receiver.Settings, cfg *Config) return scraper, nil } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *diskScraper) start(ctx context.Context, _ component.Host) error { bootTime, err := s.bootTime(ctx) if err != nil { return err @@ -96,7 +96,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { +func (s *diskScraper) scrape(_ context.Context) (pmetric.Metrics, error) { if s.skipScrape { return pmetric.NewMetrics(), nil } @@ -132,35 +132,35 @@ func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { return s.mb.Emit(), nil } -func (s *scraper) recordDiskIOMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { +func (s *diskScraper) recordDiskIOMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { for _, logicalDiskCounter := range logicalDiskCounterValues { s.mb.RecordSystemDiskIoDataPoint(now, logicalDiskCounter.Values[readBytesPerSec], logicalDiskCounter.InstanceName, metadata.AttributeDirectionRead) s.mb.RecordSystemDiskIoDataPoint(now, logicalDiskCounter.Values[writeBytesPerSec], logicalDiskCounter.InstanceName, metadata.AttributeDirectionWrite) } } -func (s *scraper) recordDiskOperationsMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { +func (s *diskScraper) recordDiskOperationsMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { for _, logicalDiskCounter := range logicalDiskCounterValues { s.mb.RecordSystemDiskOperationsDataPoint(now, logicalDiskCounter.Values[readsPerSec], logicalDiskCounter.InstanceName, metadata.AttributeDirectionRead) s.mb.RecordSystemDiskOperationsDataPoint(now, logicalDiskCounter.Values[writesPerSec], logicalDiskCounter.InstanceName, metadata.AttributeDirectionWrite) } } -func (s *scraper) recordDiskIOTimeMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { +func (s *diskScraper) recordDiskIOTimeMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { for _, logicalDiskCounter := range logicalDiskCounterValues { // disk active time = system boot time - disk idle time s.mb.RecordSystemDiskIoTimeDataPoint(now, float64(now-s.startTime)/1e9-float64(logicalDiskCounter.Values[idleTime])/1e7, logicalDiskCounter.InstanceName) } } -func (s *scraper) recordDiskOperationTimeMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { +func (s *diskScraper) recordDiskOperationTimeMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { for _, logicalDiskCounter := range logicalDiskCounterValues { s.mb.RecordSystemDiskOperationTimeDataPoint(now, float64(logicalDiskCounter.Values[avgDiskSecsPerRead])/1e7, logicalDiskCounter.InstanceName, metadata.AttributeDirectionRead) s.mb.RecordSystemDiskOperationTimeDataPoint(now, float64(logicalDiskCounter.Values[avgDiskSecsPerWrite])/1e7, logicalDiskCounter.InstanceName, metadata.AttributeDirectionWrite) } } -func (s *scraper) recordDiskPendingOperationsMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { +func (s *diskScraper) recordDiskPendingOperationsMetric(now pcommon.Timestamp, logicalDiskCounterValues []*perfcounters.CounterValues) { for _, logicalDiskCounter := range logicalDiskCounterValues { s.mb.RecordSystemDiskPendingOperationsDataPoint(now, logicalDiskCounter.Values[queueLength], logicalDiskCounter.InstanceName) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows_test.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows_test.go index 96973abdba1a..925905c52c91 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows_test.go @@ -49,12 +49,12 @@ func TestScrape_Error(t *testing.T) { for _, test := range testCases { t.Run(test.name, func(t *testing.T) { scraper, err := newDiskScraper(context.Background(), receivertest.NewNopSettings(), &Config{}) - require.NoError(t, err, "Failed to create disk scraper: %v", err) + require.NoError(t, err, "Failed to create disk diskScraper: %v", err) scraper.perfCounterScraper = perfcounters.NewMockPerfCounterScraperError(test.scrapeErr, test.getObjectErr, test.getValuesErr, nil) err = scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize disk scraper: %v", err) + require.NoError(t, err, "Failed to initialize disk diskScraper: %v", err) _, err = scraper.scrape(context.Background()) assert.EqualError(t, err, test.expectedErr) @@ -93,12 +93,12 @@ func TestStart_Error(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { scraper, err := newDiskScraper(context.Background(), receivertest.NewNopSettings(), &Config{}) - require.NoError(t, err, "Failed to create disk scraper: %v", err) + require.NoError(t, err, "Failed to create disk diskScraper: %v", err) scraper.perfCounterScraper = perfcounters.NewMockPerfCounterScraperError(nil, nil, nil, tc.initError) err = scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize disk scraper: %v", err) + require.NoError(t, err, "Failed to initialize disk diskScraper: %v", err) require.Equal(t, tc.expectedSkipScrape, scraper.skipScrape) }) diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/factory.go index bc6185c5ec0d..46561df864b1 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/factory.go @@ -7,20 +7,20 @@ import ( "context" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/diskscraper/internal/metadata" ) -// This file implements Factory for Disk scraper. +// This file implements Factory for Disk diskScraper. const ( // TypeStr the value of "type" key in configuration. TypeStr = "disk" ) -// Factory is the Factory for scraper. +// Factory is the Factory for diskScraper. type Factory struct{} // CreateDefaultConfig creates the default configuration for the Scraper. @@ -30,20 +30,19 @@ func (f *Factory) CreateDefaultConfig() internal.Config { } } -// CreateMetricsScraper creates a scraper based on provided config. +// CreateMetricsScraper creates a diskScraper based on provided config. func (f *Factory) CreateMetricsScraper( ctx context.Context, settings receiver.Settings, config internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { cfg := config.(*Config) s, err := newDiskScraper(ctx, settings, cfg) if err != nil { return nil, err } - return scraperhelper.NewScraperWithoutType( - s.scrape, - scraperhelper.WithStart(s.start), + return scraper.NewMetrics(s.scrape, + scraper.WithStart(s.start), ) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/factory.go index a752fcb2ad71..2e93c68e4665 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/factory.go @@ -8,23 +8,23 @@ import ( "os" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/internal/metadata" ) -// This file implements Factory for FileSystem scraper. +// This file implements Factory for FileSystem filesystemsScraper. const ( // TypeStr the value of "type" key in configuration. TypeStr = "filesystem" ) -// Factory is the Factory for scraper. +// Factory is the Factory for filesystemsScraper. type Factory struct{} -// Type gets the type of the scraper config created by this Factory. +// Type gets the type of the filesystemsScraper config created by this Factory. func (f *Factory) Type() string { return TypeStr } @@ -36,12 +36,12 @@ func (f *Factory) CreateDefaultConfig() internal.Config { } } -// CreateMetricsScraper creates a scraper based on provided config. +// CreateMetricsScraper creates a filesystemsScraper based on provided config. func (f *Factory) CreateMetricsScraper( ctx context.Context, settings receiver.Settings, config internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { cfg := config.(*Config) if cfg.RootPath == "" { @@ -67,5 +67,5 @@ func (f *Factory) CreateMetricsScraper( return nil, err } - return scraperhelper.NewScraperWithoutType(s.scrape, scraperhelper.WithStart(s.start)) + return scraper.NewMetrics(s.scrape, scraper.WithStart(s.start)) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper.go index 305f62797f63..b7818706cb3d 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper.go @@ -28,8 +28,8 @@ const ( metricsLen = standardMetricsLen + systemSpecificMetricsLen ) -// scraper for FileSystem Metrics -type scraper struct { +// filesystemsScraper for FileSystem Metrics +type filesystemsScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -47,17 +47,17 @@ type deviceUsage struct { } // newFileSystemScraper creates a FileSystem Scraper -func newFileSystemScraper(_ context.Context, settings receiver.Settings, cfg *Config) (*scraper, error) { +func newFileSystemScraper(_ context.Context, settings receiver.Settings, cfg *Config) (*filesystemsScraper, error) { fsFilter, err := cfg.createFilter() if err != nil { return nil, err } - scraper := &scraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, partitions: disk.PartitionsWithContext, usage: disk.UsageWithContext, fsFilter: *fsFilter} + scraper := &filesystemsScraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, partitions: disk.PartitionsWithContext, usage: disk.UsageWithContext, fsFilter: *fsFilter} return scraper, nil } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *filesystemsScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -68,7 +68,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *filesystemsScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) now := pcommon.NewTimestampFromTime(time.Now()) diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_others.go index 42e0e559f731..aa1914259a22 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_others.go @@ -13,7 +13,7 @@ import ( const fileSystemStatesLen = 2 -func (s *scraper) recordFileSystemUsageMetric(now pcommon.Timestamp, deviceUsages []*deviceUsage) { +func (s *filesystemsScraper) recordFileSystemUsageMetric(now pcommon.Timestamp, deviceUsages []*deviceUsage) { for _, deviceUsage := range deviceUsages { s.mb.RecordSystemFilesystemUsageDataPoint( now, int64(deviceUsage.usage.Used), @@ -34,5 +34,5 @@ func (s *scraper) recordFileSystemUsageMetric(now pcommon.Timestamp, deviceUsage const systemSpecificMetricsLen = 0 -func (s *scraper) recordSystemSpecificMetrics(_ pcommon.Timestamp, _ []*deviceUsage) { +func (s *filesystemsScraper) recordSystemSpecificMetrics(_ pcommon.Timestamp, _ []*deviceUsage) { } diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go index 03aeb058d77e..fec9bcae21a5 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_test.go @@ -400,7 +400,7 @@ func TestScrape(t *testing.T) { require.Regexp(t, test.newErrRegex, err) return } - require.NoError(t, err, "Failed to create file system scraper: %v", err) + require.NoError(t, err, "Failed to create file system filesystemsScraper: %v", err) if test.partitionsFunc != nil { scraper.partitions = test.partitionsFunc @@ -417,7 +417,7 @@ func TestScrape(t *testing.T) { assert.EqualError(t, err, test.initializationErr) return } - require.NoError(t, err, "Failed to initialize file system scraper: %v", err) + require.NoError(t, err, "Failed to initialize file system filesystemsScraper: %v", err) md, err := scraper.scrape(context.Background()) if test.expectedErr != "" { diff --git a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_unix.go b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_unix.go index 1ece4e18b277..26b1e9de4f3d 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_unix.go +++ b/receiver/hostmetricsreceiver/internal/scraper/filesystemscraper/filesystem_scraper_unix.go @@ -13,7 +13,7 @@ import ( const fileSystemStatesLen = 3 -func (s *scraper) recordFileSystemUsageMetric(now pcommon.Timestamp, deviceUsages []*deviceUsage) { +func (s *filesystemsScraper) recordFileSystemUsageMetric(now pcommon.Timestamp, deviceUsages []*deviceUsage) { for _, deviceUsage := range deviceUsages { s.mb.RecordSystemFilesystemUsageDataPoint( now, int64(deviceUsage.usage.Used), @@ -39,7 +39,7 @@ func (s *scraper) recordFileSystemUsageMetric(now pcommon.Timestamp, deviceUsage const systemSpecificMetricsLen = 1 -func (s *scraper) recordSystemSpecificMetrics(now pcommon.Timestamp, deviceUsages []*deviceUsage) { +func (s *filesystemsScraper) recordSystemSpecificMetrics(now pcommon.Timestamp, deviceUsages []*deviceUsage) { for _, deviceUsage := range deviceUsages { s.mb.RecordSystemFilesystemInodesUsageDataPoint( now, int64(deviceUsage.usage.InodesUsed), deviceUsage.partition.Device, diff --git a/receiver/hostmetricsreceiver/internal/scraper/loadscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/loadscraper/factory.go index 1d1aa9dc5ac7..1ee38bef7842 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/loadscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/loadscraper/factory.go @@ -7,7 +7,7 @@ import ( "context" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/internal/metadata" @@ -35,13 +35,13 @@ func (f *Factory) CreateMetricsScraper( ctx context.Context, settings receiver.Settings, config internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { cfg := config.(*Config) s := newLoadScraper(ctx, settings, cfg) - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), - scraperhelper.WithShutdown(s.shutdown), + scraper.WithStart(s.start), + scraper.WithShutdown(s.shutdown), ) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper.go index 3262efb78a10..38f943af99e0 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper.go @@ -26,7 +26,7 @@ import ( const metricsLen = 3 // scraper for Load Metrics -type scraper struct { +type loadScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -38,12 +38,12 @@ type scraper struct { } // newLoadScraper creates a set of Load related metrics -func newLoadScraper(_ context.Context, settings receiver.Settings, cfg *Config) *scraper { - return &scraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, load: getSampledLoadAverages} +func newLoadScraper(_ context.Context, settings receiver.Settings, cfg *Config) *loadScraper { + return &loadScraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, load: getSampledLoadAverages} } // start -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *loadScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -69,7 +69,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { } // shutdown -func (s *scraper) shutdown(ctx context.Context) error { +func (s *loadScraper) shutdown(ctx context.Context) error { if s.skipScrape { // We skipped scraping because the sampler failed to start, // so it doesn't need to be shut down. @@ -79,7 +79,7 @@ func (s *scraper) shutdown(ctx context.Context) error { } // scrape -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *loadScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { if s.skipScrape { return pmetric.NewMetrics(), nil } diff --git a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/factory.go index 919214e1aa4d..231fbf8afce6 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/factory.go @@ -7,7 +7,7 @@ import ( "context" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/internal/metadata" @@ -35,9 +35,9 @@ func (f *Factory) CreateMetricsScraper( ctx context.Context, settings receiver.Settings, config internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { cfg := config.(*Config) s := newMemoryScraper(ctx, settings, cfg) - return scraperhelper.NewScraperWithoutType(s.scrape, scraperhelper.WithStart(s.start)) + return scraper.NewMetrics(s.scrape, scraper.WithStart(s.start)) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper.go index 72df7f7aa543..39dc0d9ff3ad 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper.go @@ -26,7 +26,7 @@ const metricsLen = 2 var ErrInvalidTotalMem = errors.New("invalid total memory") // scraper for Memory Metrics -type scraper struct { +type memoryScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -38,11 +38,11 @@ type scraper struct { } // newMemoryScraper creates a Memory Scraper -func newMemoryScraper(_ context.Context, settings receiver.Settings, cfg *Config) *scraper { - return &scraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, virtualMemory: mem.VirtualMemoryWithContext} +func newMemoryScraper(_ context.Context, settings receiver.Settings, cfg *Config) *memoryScraper { + return &memoryScraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, virtualMemory: mem.VirtualMemoryWithContext} } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *memoryScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.envMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -53,11 +53,11 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) recordMemoryLimitMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordMemoryLimitMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.mb.RecordSystemMemoryLimitDataPoint(now, int64(memInfo.Total)) } -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *memoryScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { ctx = context.WithValue(ctx, common.EnvKey, s.envMap) now := pcommon.NewTimestampFromTime(time.Now()) diff --git a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_linux.go b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_linux.go index abe1e5024a47..1a6aa11d3136 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_linux.go +++ b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_linux.go @@ -12,7 +12,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/internal/metadata" ) -func (s *scraper) recordMemoryUsageMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordMemoryUsageMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Used), metadata.AttributeStateUsed) s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Free), metadata.AttributeStateFree) s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Buffers), metadata.AttributeStateBuffered) @@ -21,7 +21,7 @@ func (s *scraper) recordMemoryUsageMetric(now pcommon.Timestamp, memInfo *mem.Vi s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Sunreclaim), metadata.AttributeStateSlabUnreclaimable) } -func (s *scraper) recordMemoryUtilizationMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordMemoryUtilizationMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Used)/float64(memInfo.Total), metadata.AttributeStateUsed) s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Free)/float64(memInfo.Total), metadata.AttributeStateFree) s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Buffers)/float64(memInfo.Total), metadata.AttributeStateBuffered) @@ -30,10 +30,10 @@ func (s *scraper) recordMemoryUtilizationMetric(now pcommon.Timestamp, memInfo * s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Sunreclaim)/float64(memInfo.Total), metadata.AttributeStateSlabUnreclaimable) } -func (s *scraper) recordLinuxMemoryAvailableMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordLinuxMemoryAvailableMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.mb.RecordSystemLinuxMemoryAvailableDataPoint(now, int64(memInfo.Available)) } -func (s *scraper) recordSystemSpecificMetrics(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordSystemSpecificMetrics(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.recordLinuxMemoryAvailableMetric(now, memInfo) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_others.go index 5b3288432049..0a628bb3d78e 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_others.go @@ -12,17 +12,17 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/internal/metadata" ) -func (s *scraper) recordMemoryUsageMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordMemoryUsageMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Used), metadata.AttributeStateUsed) s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Free), metadata.AttributeStateFree) s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Inactive), metadata.AttributeStateInactive) } -func (s *scraper) recordMemoryUtilizationMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordMemoryUtilizationMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Used)/float64(memInfo.Total), metadata.AttributeStateUsed) s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Free)/float64(memInfo.Total), metadata.AttributeStateFree) s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Inactive)/float64(memInfo.Total), metadata.AttributeStateInactive) } -func (s *scraper) recordSystemSpecificMetrics(_ pcommon.Timestamp, _ *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordSystemSpecificMetrics(_ pcommon.Timestamp, _ *mem.VirtualMemoryStat) { } diff --git a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_test.go index 291e4b221b62..cad5583c7bf6 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_test.go @@ -100,7 +100,7 @@ func TestScrape(t *testing.T) { assert.EqualError(t, err, test.initializationErr) return } - require.NoError(t, err, "Failed to initialize memory scraper: %v", err) + require.NoError(t, err, "Failed to initialize memory memoryScraper: %v", err) md, err := scraper.scrape(context.Background()) if test.expectedErr != "" { assert.EqualError(t, err, test.expectedErr) @@ -171,7 +171,7 @@ func TestScrape_MemoryUtilization(t *testing.T) { } err := scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize memory scraper: %v", err) + require.NoError(t, err, "Failed to initialize memory memoryScraper: %v", err) md, err := scraper.scrape(context.Background()) if test.expectedErr != nil { diff --git a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_windows.go b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_windows.go index d40d13e1044c..f43d9a5f3300 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/memory_scraper_windows.go @@ -12,15 +12,15 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/memoryscraper/internal/metadata" ) -func (s *scraper) recordMemoryUsageMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordMemoryUsageMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Used), metadata.AttributeStateUsed) s.mb.RecordSystemMemoryUsageDataPoint(now, int64(memInfo.Free), metadata.AttributeStateFree) } -func (s *scraper) recordMemoryUtilizationMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordMemoryUtilizationMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) { s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Used)/float64(memInfo.Total), metadata.AttributeStateUsed) s.mb.RecordSystemMemoryUtilizationDataPoint(now, float64(memInfo.Free)/float64(memInfo.Total), metadata.AttributeStateFree) } -func (s *scraper) recordSystemSpecificMetrics(_ pcommon.Timestamp, _ *mem.VirtualMemoryStat) { +func (s *memoryScraper) recordSystemSpecificMetrics(_ pcommon.Timestamp, _ *mem.VirtualMemoryStat) { } diff --git a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/factory.go index a72b54abbd1e..2f5b5b1d87f0 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/factory.go @@ -7,7 +7,7 @@ import ( "context" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/networkscraper/internal/metadata" @@ -35,15 +35,15 @@ func (f *Factory) CreateMetricsScraper( ctx context.Context, settings receiver.Settings, config internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { cfg := config.(*Config) s, err := newNetworkScraper(ctx, settings, cfg) if err != nil { return nil, err } - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), + scraper.WithStart(s.start), ) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_linux.go b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_linux.go index 29fca3f48ebd..20361cb70d27 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_linux.go +++ b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_linux.go @@ -29,7 +29,7 @@ var allTCPStates = []string{ "TIME_WAIT", } -func (s *scraper) recordNetworkConntrackMetrics() error { +func (s *networkScraper) recordNetworkConntrackMetrics() error { if !s.config.MetricsBuilderConfig.Metrics.SystemNetworkConntrackCount.Enabled && !s.config.MetricsBuilderConfig.Metrics.SystemNetworkConntrackMax.Enabled { return nil } diff --git a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_others.go b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_others.go index 673a5e8f961d..5d2f6575f527 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_others.go @@ -20,6 +20,6 @@ var allTCPStates = []string{ "TIME_WAIT", } -func (s *scraper) recordNetworkConntrackMetrics() error { +func (s *networkScraper) recordNetworkConntrackMetrics() error { return nil } diff --git a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper.go index f6f3064dcabd..2bf77f05a61f 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper.go @@ -27,7 +27,7 @@ const ( ) // scraper for Network Metrics -type scraper struct { +type networkScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -43,8 +43,8 @@ type scraper struct { } // newNetworkScraper creates a set of Network related metrics -func newNetworkScraper(_ context.Context, settings receiver.Settings, cfg *Config) (*scraper, error) { - scraper := &scraper{ +func newNetworkScraper(_ context.Context, settings receiver.Settings, cfg *Config) (*networkScraper, error) { + scraper := &networkScraper{ settings: settings, config: cfg, bootTime: host.BootTimeWithContext, @@ -72,7 +72,7 @@ func newNetworkScraper(_ context.Context, settings receiver.Settings, cfg *Confi return scraper, nil } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *networkScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -84,7 +84,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { +func (s *networkScraper) scrape(_ context.Context) (pmetric.Metrics, error) { var errors scrapererror.ScrapeErrors err := s.recordNetworkCounterMetrics() @@ -105,7 +105,7 @@ func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { return s.mb.Emit(), errors.Combine() } -func (s *scraper) recordNetworkCounterMetrics() error { +func (s *networkScraper) recordNetworkCounterMetrics() error { ctx := context.WithValue(context.Background(), common.EnvKey, s.config.EnvMap) now := pcommon.NewTimestampFromTime(time.Now()) @@ -128,35 +128,35 @@ func (s *scraper) recordNetworkCounterMetrics() error { return nil } -func (s *scraper) recordNetworkPacketsMetric(now pcommon.Timestamp, ioCountersSlice []net.IOCountersStat) { +func (s *networkScraper) recordNetworkPacketsMetric(now pcommon.Timestamp, ioCountersSlice []net.IOCountersStat) { for _, ioCounters := range ioCountersSlice { s.mb.RecordSystemNetworkPacketsDataPoint(now, int64(ioCounters.PacketsSent), ioCounters.Name, metadata.AttributeDirectionTransmit) s.mb.RecordSystemNetworkPacketsDataPoint(now, int64(ioCounters.PacketsRecv), ioCounters.Name, metadata.AttributeDirectionReceive) } } -func (s *scraper) recordNetworkDroppedPacketsMetric(now pcommon.Timestamp, ioCountersSlice []net.IOCountersStat) { +func (s *networkScraper) recordNetworkDroppedPacketsMetric(now pcommon.Timestamp, ioCountersSlice []net.IOCountersStat) { for _, ioCounters := range ioCountersSlice { s.mb.RecordSystemNetworkDroppedDataPoint(now, int64(ioCounters.Dropout), ioCounters.Name, metadata.AttributeDirectionTransmit) s.mb.RecordSystemNetworkDroppedDataPoint(now, int64(ioCounters.Dropin), ioCounters.Name, metadata.AttributeDirectionReceive) } } -func (s *scraper) recordNetworkErrorPacketsMetric(now pcommon.Timestamp, ioCountersSlice []net.IOCountersStat) { +func (s *networkScraper) recordNetworkErrorPacketsMetric(now pcommon.Timestamp, ioCountersSlice []net.IOCountersStat) { for _, ioCounters := range ioCountersSlice { s.mb.RecordSystemNetworkErrorsDataPoint(now, int64(ioCounters.Errout), ioCounters.Name, metadata.AttributeDirectionTransmit) s.mb.RecordSystemNetworkErrorsDataPoint(now, int64(ioCounters.Errin), ioCounters.Name, metadata.AttributeDirectionReceive) } } -func (s *scraper) recordNetworkIOMetric(now pcommon.Timestamp, ioCountersSlice []net.IOCountersStat) { +func (s *networkScraper) recordNetworkIOMetric(now pcommon.Timestamp, ioCountersSlice []net.IOCountersStat) { for _, ioCounters := range ioCountersSlice { s.mb.RecordSystemNetworkIoDataPoint(now, int64(ioCounters.BytesSent), ioCounters.Name, metadata.AttributeDirectionTransmit) s.mb.RecordSystemNetworkIoDataPoint(now, int64(ioCounters.BytesRecv), ioCounters.Name, metadata.AttributeDirectionReceive) } } -func (s *scraper) recordNetworkConnectionsMetrics() error { +func (s *networkScraper) recordNetworkConnectionsMetrics() error { if !s.config.Metrics.SystemNetworkConnections.Enabled { return nil } @@ -187,13 +187,13 @@ func getTCPConnectionStatusCounts(connections []net.ConnectionStat) map[string]i return tcpStatuses } -func (s *scraper) recordNetworkConnectionsMetric(now pcommon.Timestamp, connectionStateCounts map[string]int64) { +func (s *networkScraper) recordNetworkConnectionsMetric(now pcommon.Timestamp, connectionStateCounts map[string]int64) { for connectionState, count := range connectionStateCounts { s.mb.RecordSystemNetworkConnectionsDataPoint(now, count, metadata.AttributeProtocolTcp, connectionState) } } -func (s *scraper) filterByInterface(ioCounters []net.IOCountersStat) []net.IOCountersStat { +func (s *networkScraper) filterByInterface(ioCounters []net.IOCountersStat) []net.IOCountersStat { if s.includeFS == nil && s.excludeFS == nil { return ioCounters } @@ -207,7 +207,7 @@ func (s *scraper) filterByInterface(ioCounters []net.IOCountersStat) []net.IOCou return filteredIOCounters } -func (s *scraper) includeInterface(interfaceName string) bool { +func (s *networkScraper) includeInterface(interfaceName string) bool { return (s.includeFS == nil || s.includeFS.Matches(interfaceName)) && (s.excludeFS == nil || !s.excludeFS.Matches(interfaceName)) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper_test.go index c4204a574e67..d63dcf523305 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper_test.go @@ -37,7 +37,7 @@ func TestScrape(t *testing.T) { initializationErr string expectedErr string expectedErrCount int - mutateScraper func(*scraper) + mutateScraper func(*networkScraper) } testCases := []testCase{ @@ -150,7 +150,7 @@ func TestScrape(t *testing.T) { require.Regexp(t, test.newErrRegex, err) return } - require.NoError(t, err, "Failed to create network scraper: %v", err) + require.NoError(t, err, "Failed to create network networkScraper: %v", err) if test.bootTimeFunc != nil { scraper.bootTime = test.bootTimeFunc @@ -170,7 +170,7 @@ func TestScrape(t *testing.T) { assert.EqualError(t, err, test.initializationErr) return } - require.NoError(t, err, "Failed to initialize network scraper: %v", err) + require.NoError(t, err, "Failed to initialize network networkScraper: %v", err) md, err := scraper.scrape(context.Background()) if test.expectedErr != "" { diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/factory.go index 91962b687d03..f0f0ce18dbe3 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/factory.go @@ -7,7 +7,7 @@ import ( "context" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/internal/metadata" @@ -35,12 +35,12 @@ func (f *Factory) CreateMetricsScraper( ctx context.Context, settings receiver.Settings, config internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { cfg := config.(*Config) s := newPagingScraper(ctx, settings, cfg) - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), + scraper.WithStart(s.start), ) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go index 49a6bbc9188e..a6eaf32d0109 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go @@ -28,7 +28,7 @@ const ( ) // scraper for Paging Metrics -type scraper struct { +type pagingScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -40,8 +40,8 @@ type scraper struct { } // newPagingScraper creates a Paging Scraper -func newPagingScraper(_ context.Context, settings receiver.Settings, cfg *Config) *scraper { - return &scraper{ +func newPagingScraper(_ context.Context, settings receiver.Settings, cfg *Config) *pagingScraper { + return &pagingScraper{ settings: settings, config: cfg, bootTime: host.BootTimeWithContext, @@ -50,7 +50,7 @@ func newPagingScraper(_ context.Context, settings receiver.Settings, cfg *Config } } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *pagingScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -61,7 +61,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { +func (s *pagingScraper) scrape(_ context.Context) (pmetric.Metrics, error) { var errors scrapererror.ScrapeErrors err := s.scrapePagingUsageMetric() @@ -77,7 +77,7 @@ func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { return s.mb.Emit(), errors.Combine() } -func (s *scraper) scrapePagingUsageMetric() error { +func (s *pagingScraper) scrapePagingUsageMetric() error { now := pcommon.NewTimestampFromTime(time.Now()) pageFileStats, err := s.getPageFileStats() if err != nil { @@ -89,7 +89,7 @@ func (s *scraper) scrapePagingUsageMetric() error { return nil } -func (s *scraper) recordPagingUsageDataPoints(now pcommon.Timestamp, pageFileStats []*pageFileStats) { +func (s *pagingScraper) recordPagingUsageDataPoints(now pcommon.Timestamp, pageFileStats []*pageFileStats) { for _, pageFile := range pageFileStats { s.mb.RecordSystemPagingUsageDataPoint(now, int64(pageFile.usedBytes), pageFile.deviceName, metadata.AttributeStateUsed) s.mb.RecordSystemPagingUsageDataPoint(now, int64(pageFile.freeBytes), pageFile.deviceName, metadata.AttributeStateFree) @@ -99,7 +99,7 @@ func (s *scraper) recordPagingUsageDataPoints(now pcommon.Timestamp, pageFileSta } } -func (s *scraper) recordPagingUtilizationDataPoints(now pcommon.Timestamp, pageFileStats []*pageFileStats) { +func (s *pagingScraper) recordPagingUtilizationDataPoints(now pcommon.Timestamp, pageFileStats []*pageFileStats) { for _, pageFile := range pageFileStats { s.mb.RecordSystemPagingUtilizationDataPoint(now, float64(pageFile.usedBytes)/float64(pageFile.totalBytes), pageFile.deviceName, metadata.AttributeStateUsed) s.mb.RecordSystemPagingUtilizationDataPoint(now, float64(pageFile.freeBytes)/float64(pageFile.totalBytes), pageFile.deviceName, metadata.AttributeStateFree) @@ -109,7 +109,7 @@ func (s *scraper) recordPagingUtilizationDataPoints(now pcommon.Timestamp, pageF } } -func (s *scraper) scrapePagingMetrics() error { +func (s *pagingScraper) scrapePagingMetrics() error { ctx := context.WithValue(context.Background(), common.EnvKey, s.config.EnvMap) now := pcommon.NewTimestampFromTime(time.Now()) swap, err := s.swapMemory(ctx) @@ -122,14 +122,14 @@ func (s *scraper) scrapePagingMetrics() error { return nil } -func (s *scraper) recordPagingOperationsDataPoints(now pcommon.Timestamp, swap *mem.SwapMemoryStat) { +func (s *pagingScraper) recordPagingOperationsDataPoints(now pcommon.Timestamp, swap *mem.SwapMemoryStat) { s.mb.RecordSystemPagingOperationsDataPoint(now, int64(swap.Sin), metadata.AttributeDirectionPageIn, metadata.AttributeTypeMajor) s.mb.RecordSystemPagingOperationsDataPoint(now, int64(swap.Sout), metadata.AttributeDirectionPageOut, metadata.AttributeTypeMajor) s.mb.RecordSystemPagingOperationsDataPoint(now, int64(swap.PgIn), metadata.AttributeDirectionPageIn, metadata.AttributeTypeMinor) s.mb.RecordSystemPagingOperationsDataPoint(now, int64(swap.PgOut), metadata.AttributeDirectionPageOut, metadata.AttributeTypeMinor) } -func (s *scraper) recordPageFaultsDataPoints(now pcommon.Timestamp, swap *mem.SwapMemoryStat) { +func (s *pagingScraper) recordPageFaultsDataPoints(now pcommon.Timestamp, swap *mem.SwapMemoryStat) { s.mb.RecordSystemPagingFaultsDataPoint(now, int64(swap.PgMajFault), metadata.AttributeTypeMajor) s.mb.RecordSystemPagingFaultsDataPoint(now, int64(swap.PgFault-swap.PgMajFault), metadata.AttributeTypeMinor) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others_test.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others_test.go index 959aa2a2214b..1e4c48683102 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others_test.go @@ -60,7 +60,7 @@ func TestScrape_Errors(t *testing.T) { } err := scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize paging scraper: %v", err) + require.NoError(t, err, "Failed to initialize paging pagingScraper: %v", err) _, err = scraper.scrape(context.Background()) assert.EqualError(t, err, test.expectedError) diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go index 631c308f65c0..be740f92afe7 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go @@ -26,7 +26,7 @@ func TestScrape(t *testing.T) { config *Config expectedStartTime pcommon.Timestamp initializationErr string - mutateScraper func(*scraper) + mutateScraper func(*pagingScraper) } config := metadata.DefaultMetricsBuilderConfig() @@ -44,7 +44,7 @@ func TestScrape(t *testing.T) { { name: "Validate Start Time", config: &Config{MetricsBuilderConfig: config}, - mutateScraper: func(s *scraper) { + mutateScraper: func(s *pagingScraper) { s.bootTime = func(context.Context) (uint64, error) { return 100, nil } }, expectedStartTime: 100 * 1e9, @@ -52,7 +52,7 @@ func TestScrape(t *testing.T) { { name: "Boot Time Error", config: &Config{MetricsBuilderConfig: config}, - mutateScraper: func(s *scraper) { + mutateScraper: func(s *pagingScraper) { s.bootTime = func(context.Context) (uint64, error) { return 0, errors.New("err1") } }, initializationErr: "err1", @@ -71,7 +71,7 @@ func TestScrape(t *testing.T) { assert.EqualError(t, err, test.initializationErr) return } - require.NoError(t, err, "Failed to initialize paging scraper: %v", err) + require.NoError(t, err, "Failed to initialize paging pagingScraper: %v", err) md, err := scraper.scrape(context.Background()) require.NoError(t, err) diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows.go index 0eab5150a47b..adaf1e4f3108 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows.go @@ -33,7 +33,7 @@ const ( ) // scraper for Paging Metrics -type scraper struct { +type pagingScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -47,8 +47,8 @@ type scraper struct { } // newPagingScraper creates a Paging Scraper -func newPagingScraper(_ context.Context, settings receiver.Settings, cfg *Config) *scraper { - return &scraper{ +func newPagingScraper(_ context.Context, settings receiver.Settings, cfg *Config) *pagingScraper { + return &pagingScraper{ settings: settings, config: cfg, perfCounterScraper: &perfcounters.PerfLibScraper{}, @@ -57,7 +57,7 @@ func newPagingScraper(_ context.Context, settings receiver.Settings, cfg *Config } } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *pagingScraper) start(ctx context.Context, _ component.Host) error { bootTime, err := s.bootTime(ctx) if err != nil { return err @@ -72,7 +72,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(context.Context) (pmetric.Metrics, error) { +func (s *pagingScraper) scrape(context.Context) (pmetric.Metrics, error) { if s.skipScrape { return pmetric.NewMetrics(), nil } @@ -92,7 +92,7 @@ func (s *scraper) scrape(context.Context) (pmetric.Metrics, error) { return s.mb.Emit(), errors.Combine() } -func (s *scraper) scrapePagingUsageMetric() error { +func (s *pagingScraper) scrapePagingUsageMetric() error { now := pcommon.NewTimestampFromTime(time.Now()) pageFiles, err := s.pageFileStats() if err != nil { @@ -105,21 +105,21 @@ func (s *scraper) scrapePagingUsageMetric() error { return nil } -func (s *scraper) recordPagingUsageDataPoints(now pcommon.Timestamp, pageFiles []*pageFileStats) { +func (s *pagingScraper) recordPagingUsageDataPoints(now pcommon.Timestamp, pageFiles []*pageFileStats) { for _, pageFile := range pageFiles { s.mb.RecordSystemPagingUsageDataPoint(now, int64(pageFile.usedBytes), pageFile.deviceName, metadata.AttributeStateUsed) s.mb.RecordSystemPagingUsageDataPoint(now, int64(pageFile.freeBytes), pageFile.deviceName, metadata.AttributeStateFree) } } -func (s *scraper) recordPagingUtilizationDataPoints(now pcommon.Timestamp, pageFiles []*pageFileStats) { +func (s *pagingScraper) recordPagingUtilizationDataPoints(now pcommon.Timestamp, pageFiles []*pageFileStats) { for _, pageFile := range pageFiles { s.mb.RecordSystemPagingUtilizationDataPoint(now, float64(pageFile.usedBytes)/float64(pageFile.totalBytes), pageFile.deviceName, metadata.AttributeStateUsed) s.mb.RecordSystemPagingUtilizationDataPoint(now, float64(pageFile.freeBytes)/float64(pageFile.totalBytes), pageFile.deviceName, metadata.AttributeStateFree) } } -func (s *scraper) scrapePagingOperationsMetric() error { +func (s *pagingScraper) scrapePagingOperationsMetric() error { now := pcommon.NewTimestampFromTime(time.Now()) counters, err := s.perfCounterScraper.Scrape() @@ -143,7 +143,7 @@ func (s *scraper) scrapePagingOperationsMetric() error { return nil } -func (s *scraper) recordPagingOperationsDataPoints(now pcommon.Timestamp, memoryCounterValues *perfcounters.CounterValues) { +func (s *pagingScraper) recordPagingOperationsDataPoints(now pcommon.Timestamp, memoryCounterValues *perfcounters.CounterValues) { s.mb.RecordSystemPagingOperationsDataPoint(now, memoryCounterValues.Values[pageReadsPerSec], metadata.AttributeDirectionPageIn, metadata.AttributeTypeMajor) s.mb.RecordSystemPagingOperationsDataPoint(now, memoryCounterValues.Values[pageWritesPerSec], metadata.AttributeDirectionPageOut, metadata.AttributeTypeMajor) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows_test.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows_test.go index 28357601dfd5..095cac0f31ea 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows_test.go @@ -106,7 +106,7 @@ func TestScrape_Errors(t *testing.T) { scraper.perfCounterScraper = perfcounters.NewMockPerfCounterScraperError(test.scrapeErr, test.getObjectErr, test.getValuesErr, nil) err := scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize paging scraper: %v", err) + require.NoError(t, err, "Failed to initialize paging pagingScraper: %v", err) md, err := scraper.scrape(context.Background()) if test.expectedErr != "" { @@ -166,7 +166,7 @@ func TestStart_Error(t *testing.T) { scraper.perfCounterScraper = perfcounters.NewMockPerfCounterScraperError(nil, nil, nil, tc.initError) err := scraper.start(context.Background(), componenttest.NewNopHost()) - require.NoError(t, err, "Failed to initialize paging scraper: %v", err) + require.NoError(t, err, "Failed to initialize paging pagingScraper: %v", err) require.Equal(t, tc.expectedSkipScrape, scraper.skipScrape) }) diff --git a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/factory.go index 9c89f9264529..6f7511b34ff5 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/factory.go @@ -7,7 +7,7 @@ import ( "context" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processesscraper/internal/metadata" @@ -35,12 +35,12 @@ func (f *Factory) CreateMetricsScraper( ctx context.Context, settings receiver.Settings, config internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { cfg := config.(*Config) s := newProcessesScraper(ctx, settings, cfg) - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), + scraper.WithStart(s.start), ) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper.go index 2658e53aca43..f8b04f536e4d 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper.go @@ -32,7 +32,7 @@ var metricsLength = func() int { }() // scraper for Processes Metrics -type scraper struct { +type processesScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -54,8 +54,8 @@ type processesMetadata struct { } // newProcessesScraper creates a set of Processes related metrics -func newProcessesScraper(_ context.Context, settings receiver.Settings, cfg *Config) *scraper { - return &scraper{ +func newProcessesScraper(_ context.Context, settings receiver.Settings, cfg *Config) *processesScraper { + return &processesScraper{ settings: settings, config: cfg, getMiscStats: load.MiscWithContext, @@ -72,7 +72,7 @@ func newProcessesScraper(_ context.Context, settings receiver.Settings, cfg *Con } } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *processesScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -83,7 +83,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { +func (s *processesScraper) scrape(_ context.Context) (pmetric.Metrics, error) { now := pcommon.NewTimestampFromTime(time.Now()) md := pmetric.NewMetrics() diff --git a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_fallback.go b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_fallback.go index d7b14679f5e5..f0c5a0ee325e 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_fallback.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_fallback.go @@ -10,6 +10,6 @@ const ( enableProcessesCreated = false ) -func (s *scraper) getProcessesMetadata() (processesMetadata, error) { +func (s *processesScraper) getProcessesMetadata() (processesMetadata, error) { return processesMetadata{}, nil } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_unix.go b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_unix.go index 9b4042d6e5f6..c9389ce5d62b 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_unix.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processesscraper/processes_scraper_unix.go @@ -20,7 +20,7 @@ const ( enableProcessesCreated = runtime.GOOS == "openbsd" || runtime.GOOS == "linux" ) -func (s *scraper) getProcessesMetadata() (processesMetadata, error) { +func (s *processesScraper) getProcessesMetadata() (processesMetadata, error) { ctx := context.WithValue(context.Background(), common.EnvKey, s.config.EnvMap) processes, err := s.getProcesses() if err != nil { diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go index 0bccf33cd30b..18b8dac96092 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/factory.go @@ -10,7 +10,7 @@ import ( "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/metadata" @@ -49,7 +49,7 @@ func (f *Factory) CreateMetricsScraper( _ context.Context, settings receiver.Settings, cfg internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { if runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin" { return nil, errors.New("process scraper only available on Linux, Windows, or MacOS") } @@ -59,8 +59,8 @@ func (f *Factory) CreateMetricsScraper( return nil, err } - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), + scraper.WithStart(s.start), ) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go index 72f82417bd9d..335cf1ce7bb4 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go @@ -42,7 +42,7 @@ const ( ) // scraper for Process Metrics -type scraper struct { +type processScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -60,8 +60,8 @@ type scraper struct { } // newProcessScraper creates a Process Scraper -func newProcessScraper(settings receiver.Settings, cfg *Config) (*scraper, error) { - scraper := &scraper{ +func newProcessScraper(settings receiver.Settings, cfg *Config) (*processScraper, error) { + scraper := &processScraper{ settings: settings, config: cfg, getProcessCreateTime: processHandle.CreateTimeWithContext, @@ -97,12 +97,12 @@ func newProcessScraper(settings receiver.Settings, cfg *Config) (*scraper, error return scraper, nil } -func (s *scraper) start(context.Context, component.Host) error { +func (s *processScraper) start(context.Context, component.Host) error { s.mb = metadata.NewMetricsBuilder(s.config.MetricsBuilderConfig, s.settings) return nil } -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *processScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { var errs scrapererror.ScrapeErrors // If the boot time cache featuregate is disabled, this will refresh the @@ -198,7 +198,7 @@ func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { // for all currently running processes. If errors occur obtaining information // for some processes, an error will be returned, but any processes that were // successfully obtained will still be returned. -func (s *scraper) getProcessMetadata() ([]*processMetadata, error) { +func (s *processScraper) getProcessMetadata() ([]*processMetadata, error) { ctx := context.WithValue(context.Background(), common.EnvKey, s.config.EnvMap) handles, err := s.getProcessHandles(ctx) if err != nil { @@ -289,7 +289,7 @@ func (s *scraper) getProcessMetadata() ([]*processMetadata, error) { return data, errs.Combine() } -func (s *scraper) scrapeAndAppendCPUTimeMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle, pid int32) error { +func (s *processScraper) scrapeAndAppendCPUTimeMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle, pid int32) error { if !s.config.MetricsBuilderConfig.Metrics.ProcessCPUTime.Enabled && !s.config.MetricsBuilderConfig.Metrics.ProcessCPUUtilization.Enabled { return nil } @@ -315,7 +315,7 @@ func (s *scraper) scrapeAndAppendCPUTimeMetric(ctx context.Context, now pcommon. return err } -func (s *scraper) scrapeAndAppendMemoryUsageMetrics(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { +func (s *processScraper) scrapeAndAppendMemoryUsageMetrics(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { if !(s.config.MetricsBuilderConfig.Metrics.ProcessMemoryUsage.Enabled || s.config.MetricsBuilderConfig.Metrics.ProcessMemoryVirtual.Enabled) { return nil } @@ -330,7 +330,7 @@ func (s *scraper) scrapeAndAppendMemoryUsageMetrics(ctx context.Context, now pco return nil } -func (s *scraper) scrapeAndAppendMemoryUtilizationMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { +func (s *processScraper) scrapeAndAppendMemoryUtilizationMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { if !s.config.MetricsBuilderConfig.Metrics.ProcessMemoryUtilization.Enabled { return nil } @@ -345,7 +345,7 @@ func (s *scraper) scrapeAndAppendMemoryUtilizationMetric(ctx context.Context, no return nil } -func (s *scraper) scrapeAndAppendDiskMetrics(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { +func (s *processScraper) scrapeAndAppendDiskMetrics(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { if !(s.config.MetricsBuilderConfig.Metrics.ProcessDiskIo.Enabled || s.config.MetricsBuilderConfig.Metrics.ProcessDiskOperations.Enabled) || runtime.GOOS == "darwin" { return nil } @@ -366,7 +366,7 @@ func (s *scraper) scrapeAndAppendDiskMetrics(ctx context.Context, now pcommon.Ti return nil } -func (s *scraper) scrapeAndAppendPagingMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { +func (s *processScraper) scrapeAndAppendPagingMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { if !s.config.MetricsBuilderConfig.Metrics.ProcessPagingFaults.Enabled { return nil } @@ -382,7 +382,7 @@ func (s *scraper) scrapeAndAppendPagingMetric(ctx context.Context, now pcommon.T return nil } -func (s *scraper) scrapeAndAppendThreadsMetrics(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { +func (s *processScraper) scrapeAndAppendThreadsMetrics(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { if !s.config.MetricsBuilderConfig.Metrics.ProcessThreads.Enabled { return nil } @@ -395,7 +395,7 @@ func (s *scraper) scrapeAndAppendThreadsMetrics(ctx context.Context, now pcommon return nil } -func (s *scraper) scrapeAndAppendContextSwitchMetrics(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { +func (s *processScraper) scrapeAndAppendContextSwitchMetrics(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { if !s.config.MetricsBuilderConfig.Metrics.ProcessContextSwitches.Enabled { return nil } @@ -411,7 +411,7 @@ func (s *scraper) scrapeAndAppendContextSwitchMetrics(ctx context.Context, now p return nil } -func (s *scraper) scrapeAndAppendOpenFileDescriptorsMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { +func (s *processScraper) scrapeAndAppendOpenFileDescriptorsMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { if !s.config.MetricsBuilderConfig.Metrics.ProcessOpenFileDescriptors.Enabled { return nil } @@ -426,7 +426,7 @@ func (s *scraper) scrapeAndAppendOpenFileDescriptorsMetric(ctx context.Context, return nil } -func (s *scraper) refreshHandleCounts() error { +func (s *processScraper) refreshHandleCounts() error { if !s.config.MetricsBuilderConfig.Metrics.ProcessHandles.Enabled { return nil } @@ -434,7 +434,7 @@ func (s *scraper) refreshHandleCounts() error { return s.handleCountManager.Refresh() } -func (s *scraper) scrapeAndAppendHandlesMetric(_ context.Context, now pcommon.Timestamp, pid int64) error { +func (s *processScraper) scrapeAndAppendHandlesMetric(_ context.Context, now pcommon.Timestamp, pid int64) error { if !s.config.MetricsBuilderConfig.Metrics.ProcessHandles.Enabled { return nil } @@ -449,7 +449,7 @@ func (s *scraper) scrapeAndAppendHandlesMetric(_ context.Context, now pcommon.Ti return nil } -func (s *scraper) scrapeAndAppendSignalsPendingMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { +func (s *processScraper) scrapeAndAppendSignalsPendingMetric(ctx context.Context, now pcommon.Timestamp, handle processHandle) error { if !s.config.MetricsBuilderConfig.Metrics.ProcessSignalsPending.Enabled { return nil } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_darwin.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_darwin.go index b705367baa57..de98262ed6bb 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_darwin.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_darwin.go @@ -16,13 +16,13 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal" ) -func (s *scraper) recordCPUTimeMetric(now pcommon.Timestamp, cpuTime *cpu.TimesStat) { +func (s *processScraper) recordCPUTimeMetric(now pcommon.Timestamp, cpuTime *cpu.TimesStat) { s.mb.RecordProcessCPUTimeDataPoint(now, cpuTime.User, metadata.AttributeStateUser) s.mb.RecordProcessCPUTimeDataPoint(now, cpuTime.System, metadata.AttributeStateSystem) s.mb.RecordProcessCPUTimeDataPoint(now, cpuTime.Iowait, metadata.AttributeStateWait) } -func (s *scraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { +func (s *processScraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { s.mb.RecordProcessCPUUtilizationDataPoint(now, cpuUtilization.User, metadata.AttributeStateUser) s.mb.RecordProcessCPUUtilizationDataPoint(now, cpuUtilization.System, metadata.AttributeStateSystem) s.mb.RecordProcessCPUUtilizationDataPoint(now, cpuUtilization.Iowait, metadata.AttributeStateWait) diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_linux.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_linux.go index 256d3b602658..52a4e07d5b30 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_linux.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_linux.go @@ -15,13 +15,13 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal" ) -func (s *scraper) recordCPUTimeMetric(now pcommon.Timestamp, cpuTime *cpu.TimesStat) { +func (s *processScraper) recordCPUTimeMetric(now pcommon.Timestamp, cpuTime *cpu.TimesStat) { s.mb.RecordProcessCPUTimeDataPoint(now, cpuTime.User, metadata.AttributeStateUser) s.mb.RecordProcessCPUTimeDataPoint(now, cpuTime.System, metadata.AttributeStateSystem) s.mb.RecordProcessCPUTimeDataPoint(now, cpuTime.Iowait, metadata.AttributeStateWait) } -func (s *scraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { +func (s *processScraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { s.mb.RecordProcessCPUUtilizationDataPoint(now, cpuUtilization.User, metadata.AttributeStateUser) s.mb.RecordProcessCPUUtilizationDataPoint(now, cpuUtilization.System, metadata.AttributeStateSystem) s.mb.RecordProcessCPUUtilizationDataPoint(now, cpuUtilization.Iowait, metadata.AttributeStateWait) diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_others.go index c6d3a0885381..624d8a499033 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_others.go @@ -14,10 +14,10 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal" ) -func (s *scraper) recordCPUTimeMetric(now pcommon.Timestamp, cpuTime *cpu.TimesStat) { +func (s *processScraper) recordCPUTimeMetric(now pcommon.Timestamp, cpuTime *cpu.TimesStat) { } -func (s *scraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { +func (s *processScraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { } func getProcessName(context.Context, processHandle, string) (string, error) { diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go index e12f8f2ca545..beefca8af3c9 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go @@ -50,7 +50,7 @@ func TestScrape(t *testing.T) { skipTestOnUnsupportedOS(t) type testCase struct { name string - mutateScraper func(*scraper) + mutateScraper func(*processScraper) mutateMetricsConfig func(*testing.T, *metadata.MetricsConfig) } testCases := []testCase{ diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_windows.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_windows.go index 442643cb76c7..a3b35a2e3ae9 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_windows.go @@ -18,12 +18,12 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper/ucal" ) -func (s *scraper) recordCPUTimeMetric(now pcommon.Timestamp, cpuTime *cpu.TimesStat) { +func (s *processScraper) recordCPUTimeMetric(now pcommon.Timestamp, cpuTime *cpu.TimesStat) { s.mb.RecordProcessCPUTimeDataPoint(now, cpuTime.User, metadata.AttributeStateUser) s.mb.RecordProcessCPUTimeDataPoint(now, cpuTime.System, metadata.AttributeStateSystem) } -func (s *scraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { +func (s *processScraper) recordCPUUtilization(now pcommon.Timestamp, cpuUtilization ucal.CPUUtilization) { s.mb.RecordProcessCPUUtilizationDataPoint(now, cpuUtilization.User, metadata.AttributeStateUser) s.mb.RecordProcessCPUUtilizationDataPoint(now, cpuUtilization.System, metadata.AttributeStateSystem) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go index 660c4d9335a9..109614e1fea2 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/factory.go @@ -9,7 +9,7 @@ import ( "runtime" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/systemscraper/internal/metadata" @@ -37,15 +37,15 @@ func (f *Factory) CreateMetricsScraper( ctx context.Context, settings receiver.Settings, cfg internal.Config, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { if runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin" { - return nil, errors.New("uptime scraper only available on Linux, Windows, or MacOS") + return nil, errors.New("uptime systemsScraper only available on Linux, Windows, or MacOS") } uptimeScraper := newUptimeScraper(ctx, settings, cfg.(*Config)) - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( uptimeScraper.scrape, - scraperhelper.WithStart(uptimeScraper.start), + scraper.WithStart(uptimeScraper.start), ) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper.go index 3d441eb0bc2b..36c6b98263c3 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/systemscraper/system_scraper.go @@ -18,7 +18,7 @@ import ( ) // scraper for Uptime Metrics -type scraper struct { +type systemsScraper struct { settings receiver.Settings config *Config mb *metadata.MetricsBuilder @@ -29,11 +29,11 @@ type scraper struct { } // newUptimeScraper creates an Uptime related metric -func newUptimeScraper(_ context.Context, settings receiver.Settings, cfg *Config) *scraper { - return &scraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, uptime: host.UptimeWithContext} +func newUptimeScraper(_ context.Context, settings receiver.Settings, cfg *Config) *systemsScraper { + return &systemsScraper{settings: settings, config: cfg, bootTime: host.BootTimeWithContext, uptime: host.UptimeWithContext} } -func (s *scraper) start(ctx context.Context, _ component.Host) error { +func (s *systemsScraper) start(ctx context.Context, _ component.Host) error { ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) bootTime, err := s.bootTime(ctx) if err != nil { @@ -44,7 +44,7 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error { return nil } -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *systemsScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { now := pcommon.NewTimestampFromTime(time.Now()) ctx = context.WithValue(ctx, common.EnvKey, s.config.EnvMap) diff --git a/receiver/httpcheckreceiver/factory.go b/receiver/httpcheckreceiver/factory.go index e7491bcd6ba4..7c0fec3cbf77 100644 --- a/receiver/httpcheckreceiver/factory.go +++ b/receiver/httpcheckreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/httpcheckreceiver/internal/metadata" ) @@ -44,10 +45,10 @@ func createMetricsReceiver(_ context.Context, params receiver.Settings, rConf co } httpcheckScraper := newScraper(cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType(httpcheckScraper.scrape, scraperhelper.WithStart(httpcheckScraper.start)) + s, err := scraper.NewMetrics(httpcheckScraper.scrape, scraper.WithStart(httpcheckScraper.start)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/httpcheckreceiver/go.mod b/receiver/httpcheckreceiver/go.mod index 1d61405b1b1c..40e3fba87980 100644 --- a/receiver/httpcheckreceiver/go.mod +++ b/receiver/httpcheckreceiver/go.mod @@ -17,6 +17,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -59,7 +60,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect diff --git a/receiver/httpcheckreceiver/go.sum b/receiver/httpcheckreceiver/go.sum index 03d2908e5bde..916e3374066d 100644 --- a/receiver/httpcheckreceiver/go.sum +++ b/receiver/httpcheckreceiver/go.sum @@ -112,8 +112,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/iisreceiver/factory_windows.go b/receiver/iisreceiver/factory_windows.go index 8e11ecc9616c..1de490cc5fda 100644 --- a/receiver/iisreceiver/factory_windows.go +++ b/receiver/iisreceiver/factory_windows.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver/internal/metadata" ) @@ -25,15 +26,15 @@ func createMetricsReceiver( cfg := rConf.(*Config) rcvr := newIisReceiver(params, cfg, nextConsumer) - scraper, err := scraperhelper.NewScraperWithoutType(rcvr.scrape, - scraperhelper.WithStart(rcvr.start), - scraperhelper.WithShutdown(rcvr.shutdown)) + s, err := scraper.NewMetrics(rcvr.scrape, + scraper.WithStart(rcvr.start), + scraper.WithShutdown(rcvr.shutdown)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, nextConsumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/iisreceiver/go.mod b/receiver/iisreceiver/go.mod index c23d86c92021..652130f2a21e 100644 --- a/receiver/iisreceiver/go.mod +++ b/receiver/iisreceiver/go.mod @@ -18,6 +18,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -82,7 +83,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/iisreceiver/go.sum b/receiver/iisreceiver/go.sum index 6293ff36528f..f88d88affb78 100644 --- a/receiver/iisreceiver/go.sum +++ b/receiver/iisreceiver/go.sum @@ -162,8 +162,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/k8sclusterreceiver/e2e_test.go b/receiver/k8sclusterreceiver/e2e_test.go index 1f571d486dfd..e7b0bbb024a7 100644 --- a/receiver/k8sclusterreceiver/e2e_test.go +++ b/receiver/k8sclusterreceiver/e2e_test.go @@ -12,15 +12,14 @@ import ( "testing" "time" - "go.opentelemetry.io/collector/consumer/consumertest" - "go.opentelemetry.io/collector/receiver/otlpreceiver" - "go.opentelemetry.io/collector/receiver/receivertest" - "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/receiver/otlpreceiver" + "go.opentelemetry.io/collector/receiver/receivertest" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8stest" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden" diff --git a/receiver/kafkametricsreceiver/broker_scraper.go b/receiver/kafkametricsreceiver/broker_scraper.go index 7f04fbcc16be..c6ef5065c692 100644 --- a/receiver/kafkametricsreceiver/broker_scraper.go +++ b/receiver/kafkametricsreceiver/broker_scraper.go @@ -15,7 +15,7 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scrapererror" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkametricsreceiver/internal/metadata" @@ -104,15 +104,15 @@ func (s *brokerScraper) scrape(context.Context) (pmetric.Metrics, error) { func createBrokerScraper(_ context.Context, cfg Config, saramaConfig *sarama.Config, settings receiver.Settings, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { s := brokerScraper{ settings: settings, config: cfg, saramaConfig: saramaConfig, } - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), - scraperhelper.WithShutdown(s.shutdown), + scraper.WithStart(s.start), + scraper.WithShutdown(s.shutdown), ) } diff --git a/receiver/kafkametricsreceiver/consumer_scraper.go b/receiver/kafkametricsreceiver/consumer_scraper.go index 4ef36f08bac5..75207d7e7761 100644 --- a/receiver/kafkametricsreceiver/consumer_scraper.go +++ b/receiver/kafkametricsreceiver/consumer_scraper.go @@ -14,7 +14,7 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "go.uber.org/multierr" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkametricsreceiver/internal/metadata" @@ -165,7 +165,7 @@ func (s *consumerScraper) scrape(context.Context) (pmetric.Metrics, error) { func createConsumerScraper(_ context.Context, cfg Config, saramaConfig *sarama.Config, settings receiver.Settings, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { groupFilter, err := regexp.Compile(cfg.GroupMatch) if err != nil { return nil, fmt.Errorf("failed to compile group_match: %w", err) @@ -181,9 +181,9 @@ func createConsumerScraper(_ context.Context, cfg Config, saramaConfig *sarama.C config: cfg, saramaConfig: saramaConfig, } - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), - scraperhelper.WithShutdown(s.shutdown), + scraper.WithStart(s.start), + scraper.WithShutdown(s.shutdown), ) } diff --git a/receiver/kafkametricsreceiver/go.mod b/receiver/kafkametricsreceiver/go.mod index 27020e116209..d5eb227e9ea1 100644 --- a/receiver/kafkametricsreceiver/go.mod +++ b/receiver/kafkametricsreceiver/go.mod @@ -17,6 +17,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -68,7 +69,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/kafkametricsreceiver/go.sum b/receiver/kafkametricsreceiver/go.sum index 67e43402c302..eb426f313958 100644 --- a/receiver/kafkametricsreceiver/go.sum +++ b/receiver/kafkametricsreceiver/go.sum @@ -149,8 +149,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/kafkametricsreceiver/receiver.go b/receiver/kafkametricsreceiver/receiver.go index e4496124ded2..a2f79f6231e1 100644 --- a/receiver/kafkametricsreceiver/receiver.go +++ b/receiver/kafkametricsreceiver/receiver.go @@ -12,12 +12,13 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkametricsreceiver/internal/metadata" ) -type createKafkaScraper func(context.Context, Config, *sarama.Config, receiver.Settings) (scraperhelper.Scraper, error) +type createKafkaScraper func(context.Context, Config, *sarama.Config, receiver.Settings) (scraper.Metrics, error) var ( brokersScraperType = component.MustNewType("brokers") @@ -58,7 +59,7 @@ var newMetricsReceiver = func( if err != nil { return nil, err } - scraperControllerOptions = append(scraperControllerOptions, scraperhelper.AddScraperWithType(metadata.Type, s)) + scraperControllerOptions = append(scraperControllerOptions, scraperhelper.AddScraper(metadata.Type, s)) continue } return nil, fmt.Errorf("no scraper found for key: %s", scraper) diff --git a/receiver/kafkametricsreceiver/receiver_test.go b/receiver/kafkametricsreceiver/receiver_test.go index e63f16248e1a..ea87612a130c 100644 --- a/receiver/kafkametricsreceiver/receiver_test.go +++ b/receiver/kafkametricsreceiver/receiver_test.go @@ -15,7 +15,7 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka" ) @@ -31,8 +31,8 @@ func TestNewReceiver_invalid_version_err(t *testing.T) { 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.NewScraperWithoutType(func(context.Context) (pmetric.Metrics, error) { + mockScraper := func(ctx context.Context, _ Config, _ *sarama.Config, settings receiver.Settings) (scraper.Metrics, error) { + return scraper.NewMetrics(func(context.Context) (pmetric.Metrics, error) { return pmetric.Metrics{}, nil }) } @@ -62,10 +62,11 @@ func TestNewReceiver_invalid_auth_error(t *testing.T) { 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.NewScraperWithoutType(func(context.Context) (pmetric.Metrics, error) { - return pmetric.Metrics{}, nil - }) + mockScraper := func(ctx context.Context, _ Config, _ *sarama.Config, settings receiver.Settings) (scraper.Metrics, error) { + return scraper.NewMetrics( + func(context.Context) (pmetric.Metrics, error) { + return pmetric.Metrics{}, nil + }) } allScrapers["brokers"] = mockScraper r, err := newMetricsReceiver(context.Background(), *c, receivertest.NewNopSettings(), consumertest.NewNop()) @@ -76,7 +77,7 @@ func TestNewReceiver(t *testing.T) { func TestNewReceiver_handles_scraper_error(t *testing.T) { c := createDefaultConfig().(*Config) c.Scrapers = []string{"brokers"} - mockScraper := func(context.Context, Config, *sarama.Config, receiver.Settings) (scraperhelper.Scraper, error) { + mockScraper := func(context.Context, Config, *sarama.Config, receiver.Settings) (scraper.Metrics, error) { return nil, errors.New("fail") } allScrapers["brokers"] = mockScraper diff --git a/receiver/kafkametricsreceiver/topic_scraper.go b/receiver/kafkametricsreceiver/topic_scraper.go index 96a1e72865dd..6571c29daafc 100644 --- a/receiver/kafkametricsreceiver/topic_scraper.go +++ b/receiver/kafkametricsreceiver/topic_scraper.go @@ -16,7 +16,7 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scrapererror" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkametricsreceiver/internal/metadata" @@ -169,7 +169,7 @@ func (s *topicScraper) scrapeTopicConfigs(now pcommon.Timestamp, errors scrapere } } -func createTopicsScraper(_ context.Context, cfg Config, saramaConfig *sarama.Config, settings receiver.Settings) (scraperhelper.Scraper, error) { +func createTopicsScraper(ctx context.Context, cfg Config, saramaConfig *sarama.Config, settings receiver.Settings) (scraper.Metrics, error) { topicFilter, err := regexp.Compile(cfg.TopicMatch) if err != nil { return nil, fmt.Errorf("failed to compile topic filter: %w", err) @@ -180,9 +180,9 @@ func createTopicsScraper(_ context.Context, cfg Config, saramaConfig *sarama.Con saramaConfig: saramaConfig, config: cfg, } - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), - scraperhelper.WithShutdown(s.shutdown), + scraper.WithStart(s.start), + scraper.WithShutdown(s.shutdown), ) } diff --git a/receiver/kafkareceiver/generated_component_telemetry_test.go b/receiver/kafkareceiver/generated_component_telemetry_test.go index ecae9482633c..d6dc1a9f572f 100644 --- a/receiver/kafkareceiver/generated_component_telemetry_test.go +++ b/receiver/kafkareceiver/generated_component_telemetry_test.go @@ -7,16 +7,15 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type componentTestTelemetry struct { diff --git a/receiver/kafkareceiver/internal/metadata/generated_telemetry.go b/receiver/kafkareceiver/internal/metadata/generated_telemetry.go index 0a0fefbc0b5b..5723c9ec8a7e 100644 --- a/receiver/kafkareceiver/internal/metadata/generated_telemetry.go +++ b/receiver/kafkareceiver/internal/metadata/generated_telemetry.go @@ -5,12 +5,11 @@ package metadata import ( "errors" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" ) func Meter(settings component.TelemetrySettings) metric.Meter { diff --git a/receiver/kafkareceiver/internal/metadata/generated_telemetry_test.go b/receiver/kafkareceiver/internal/metadata/generated_telemetry_test.go index 1ead19164a8a..108bdc2431fb 100644 --- a/receiver/kafkareceiver/internal/metadata/generated_telemetry_test.go +++ b/receiver/kafkareceiver/internal/metadata/generated_telemetry_test.go @@ -6,16 +6,15 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/receiver/kubeletstatsreceiver/factory.go b/receiver/kubeletstatsreceiver/factory.go index 5d99ae643268..2b3784487ef2 100644 --- a/receiver/kubeletstatsreceiver/factory.go +++ b/receiver/kubeletstatsreceiver/factory.go @@ -63,7 +63,7 @@ func createDefaultConfig() component.Config { } func createMetricsReceiver( - _ context.Context, + ctx context.Context, set receiver.Settings, baseCfg component.Config, consumer consumer.Metrics, @@ -103,12 +103,12 @@ func createMetricsReceiver( } } - scrp, err := newKubletScraper(rest, set, rOptions, cfg.MetricsBuilderConfig, cfg.NodeName) + scrp, err := newKubletScraper(ctx, rest, set, rOptions, cfg.MetricsBuilderConfig, cfg.NodeName) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, set, consumer, scraperhelper.AddScraperWithType(metadata.Type, scrp)) + return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, set, consumer, scraperhelper.AddScraper(metadata.Type, scrp)) } func restClient(logger *zap.Logger, cfg *Config) (kubelet.RestClient, error) { diff --git a/receiver/kubeletstatsreceiver/go.mod b/receiver/kubeletstatsreceiver/go.mod index 044898e51879..fd73f47f6a3f 100644 --- a/receiver/kubeletstatsreceiver/go.mod +++ b/receiver/kubeletstatsreceiver/go.mod @@ -25,6 +25,7 @@ require ( go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/otlpreceiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 @@ -104,7 +105,6 @@ require ( go.opentelemetry.io/collector/internal/sharedcomponent v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect diff --git a/receiver/kubeletstatsreceiver/go.sum b/receiver/kubeletstatsreceiver/go.sum index b2af61b995a2..dcf3e11a79ab 100644 --- a/receiver/kubeletstatsreceiver/go.sum +++ b/receiver/kubeletstatsreceiver/go.sum @@ -367,8 +367,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 h1:yMkBS9yViCc7U7yeLzJPM2XizlfdVvBRSmsQDWu6qc0= diff --git a/receiver/kubeletstatsreceiver/scraper.go b/receiver/kubeletstatsreceiver/scraper.go index e9dc3a73a17e..43a46cafb945 100644 --- a/receiver/kubeletstatsreceiver/scraper.go +++ b/receiver/kubeletstatsreceiver/scraper.go @@ -12,7 +12,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "go.uber.org/zap" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -51,12 +51,13 @@ type kubletScraper struct { } func newKubletScraper( + ctx context.Context, restClient kubelet.RestClient, set receiver.Settings, rOptions *scraperOptions, metricsConfig metadata.MetricsBuilderConfig, nodeName string, -) (scraperhelper.Scraper, error) { +) (scraper.Metrics, error) { ks := &kubletScraper{ statsProvider: kubelet.NewStatsProvider(restClient), metadataProvider: kubelet.NewMetadataProvider(restClient), @@ -90,10 +91,10 @@ func newKubletScraper( ks.nodeInformer = k8sconfig.NewNodeSharedInformer(rOptions.k8sAPIClient, nodeName, 5*time.Minute) } - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( ks.scrape, - scraperhelper.WithStart(ks.start), - scraperhelper.WithShutdown(ks.shutdown), + scraper.WithStart(ks.start), + scraper.WithShutdown(ks.shutdown), ) } diff --git a/receiver/memcachedreceiver/factory.go b/receiver/memcachedreceiver/factory.go index a25301e1dac7..075919200c32 100644 --- a/receiver/memcachedreceiver/factory.go +++ b/receiver/memcachedreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/memcachedreceiver/internal/metadata" ) @@ -45,7 +46,7 @@ func createDefaultConfig() component.Config { } func createMetricsReceiver( - _ context.Context, + ctx context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics, @@ -54,13 +55,13 @@ func createMetricsReceiver( ms := newMemcachedScraper(params, cfg) - scraper, err := scraperhelper.NewScraperWithoutType(ms.scrape) + scraper, err := scraper.NewMetrics(ms.scrape) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, scraper), ) } diff --git a/receiver/memcachedreceiver/go.mod b/receiver/memcachedreceiver/go.mod index ff6a186fa63f..126a2b6aad8f 100644 --- a/receiver/memcachedreceiver/go.mod +++ b/receiver/memcachedreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -81,7 +82,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/memcachedreceiver/go.sum b/receiver/memcachedreceiver/go.sum index a000ac8de6b7..6364e83f5206 100644 --- a/receiver/memcachedreceiver/go.sum +++ b/receiver/memcachedreceiver/go.sum @@ -164,8 +164,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/mongodbatlasreceiver/factory.go b/receiver/mongodbatlasreceiver/factory.go index 7f00db4d9d70..7952811144b5 100644 --- a/receiver/mongodbatlasreceiver/factory.go +++ b/receiver/mongodbatlasreceiver/factory.go @@ -34,19 +34,19 @@ func NewFactory() receiver.Factory { } func createMetricsReceiver( - _ context.Context, + ctx context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics, ) (receiver.Metrics, error) { cfg := rConf.(*Config) recv := newMongoDBAtlasReceiver(params, cfg) - ms, err := newMongoDBAtlasScraper(recv) + ms, err := newMongoDBAtlasScraper(ctx, params, recv) if err != nil { return nil, fmt.Errorf("unable to create a MongoDB Atlas Scaper instance: %w", err) } - return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, ms)) + return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, ms)) } func createCombinedLogReceiver( diff --git a/receiver/mongodbatlasreceiver/go.mod b/receiver/mongodbatlasreceiver/go.mod index ba1eb57e12dd..117dba23fd7b 100644 --- a/receiver/mongodbatlasreceiver/go.mod +++ b/receiver/mongodbatlasreceiver/go.mod @@ -36,6 +36,7 @@ require ( go.opentelemetry.io/collector/consumer/consumertest v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/extension/experimental/storage v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be ) require ( @@ -75,7 +76,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/sdk v1.32.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect diff --git a/receiver/mongodbatlasreceiver/go.sum b/receiver/mongodbatlasreceiver/go.sum index 8a9c6962f5bf..1f035314e108 100644 --- a/receiver/mongodbatlasreceiver/go.sum +++ b/receiver/mongodbatlasreceiver/go.sum @@ -128,8 +128,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/mongodbatlasreceiver/receiver.go b/receiver/mongodbatlasreceiver/receiver.go index 5961abd5da76..885668501bdd 100644 --- a/receiver/mongodbatlasreceiver/receiver.go +++ b/receiver/mongodbatlasreceiver/receiver.go @@ -13,7 +13,7 @@ import ( "go.mongodb.org/atlas/mongodbatlas" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbatlasreceiver/internal" @@ -50,8 +50,8 @@ func newMongoDBAtlasReceiver(settings receiver.Settings, cfg *Config) *mongodbat } } -func newMongoDBAtlasScraper(recv *mongodbatlasreceiver) (scraperhelper.Scraper, error) { - return scraperhelper.NewScraperWithoutType(recv.scrape, scraperhelper.WithShutdown(recv.shutdown)) +func newMongoDBAtlasScraper(ctx context.Context, settings receiver.Settings, recv *mongodbatlasreceiver) (scraper.Metrics, error) { + return scraper.NewMetrics(recv.scrape, scraper.WithShutdown(recv.shutdown)) } func (s *mongodbatlasreceiver) scrape(ctx context.Context) (pmetric.Metrics, error) { diff --git a/receiver/mongodbreceiver/factory.go b/receiver/mongodbreceiver/factory.go index 9b66dc828613..bf076d8ada16 100644 --- a/receiver/mongodbreceiver/factory.go +++ b/receiver/mongodbreceiver/factory.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbreceiver/internal/metadata" ) @@ -45,7 +46,7 @@ func createDefaultConfig() component.Config { } func createMetricsReceiver( - _ context.Context, + ctx context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics, @@ -53,15 +54,16 @@ func createMetricsReceiver( cfg := rConf.(*Config) ms := newMongodbScraper(params, cfg) - scraper, err := scraperhelper.NewScraperWithoutType(ms.scrape, - scraperhelper.WithStart(ms.start), - scraperhelper.WithShutdown(ms.shutdown)) + s, err := scraper.NewMetrics( + ms.scrape, + scraper.WithStart(ms.start), + scraper.WithShutdown(ms.shutdown)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/mongodbreceiver/go.mod b/receiver/mongodbreceiver/go.mod index 0cc0120ecda0..b382732ba4ec 100644 --- a/receiver/mongodbreceiver/go.mod +++ b/receiver/mongodbreceiver/go.mod @@ -24,6 +24,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -95,7 +96,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/mongodbreceiver/go.sum b/receiver/mongodbreceiver/go.sum index 3a33b215fef1..a669d0929004 100644 --- a/receiver/mongodbreceiver/go.sum +++ b/receiver/mongodbreceiver/go.sum @@ -189,8 +189,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/mysqlreceiver/factory.go b/receiver/mysqlreceiver/factory.go index 832167519417..85b1a88ffb01 100644 --- a/receiver/mysqlreceiver/factory.go +++ b/receiver/mysqlreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver/internal/metadata" ) @@ -44,7 +45,7 @@ func createDefaultConfig() component.Config { } func createMetricsReceiver( - _ context.Context, + ctx context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics, @@ -52,14 +53,14 @@ func createMetricsReceiver( cfg := rConf.(*Config) ns := newMySQLScraper(params, cfg) - scraper, err := scraperhelper.NewScraperWithoutType(ns.scrape, scraperhelper.WithStart(ns.start), - scraperhelper.WithShutdown(ns.shutdown)) + s, err := scraper.NewMetrics(ns.scrape, scraper.WithStart(ns.start), + scraper.WithShutdown(ns.shutdown)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/mysqlreceiver/go.mod b/receiver/mysqlreceiver/go.mod index f881606598af..10ae59bf36f1 100644 --- a/receiver/mysqlreceiver/go.mod +++ b/receiver/mysqlreceiver/go.mod @@ -22,6 +22,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -30,7 +31,6 @@ require ( github.com/containerd/platforms v0.2.1 // indirect github.com/moby/sys/userns v0.1.0 // indirect go.opentelemetry.io/collector/consumer/consumererror v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect ) diff --git a/receiver/mysqlreceiver/go.sum b/receiver/mysqlreceiver/go.sum index cdd290e1b6a8..cd5a3ad28d22 100644 --- a/receiver/mysqlreceiver/go.sum +++ b/receiver/mysqlreceiver/go.sum @@ -176,8 +176,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/nginxreceiver/factory.go b/receiver/nginxreceiver/factory.go index 67c520994fb7..2d1c51e1f1e3 100644 --- a/receiver/nginxreceiver/factory.go +++ b/receiver/nginxreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nginxreceiver/internal/metadata" ) @@ -40,7 +41,7 @@ func createDefaultConfig() component.Config { } func createMetricsReceiver( - _ context.Context, + ctx context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics, @@ -48,13 +49,13 @@ func createMetricsReceiver( cfg := rConf.(*Config) ns := newNginxScraper(params, cfg) - scraper, err := scraperhelper.NewScraperWithoutType(ns.scrape, scraperhelper.WithStart(ns.start)) + s, err := scraper.NewMetrics(ns.scrape, scraper.WithStart(ns.start)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/nginxreceiver/go.mod b/receiver/nginxreceiver/go.mod index eff88c4233ac..0138c1b26895 100644 --- a/receiver/nginxreceiver/go.mod +++ b/receiver/nginxreceiver/go.mod @@ -20,6 +20,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -92,7 +93,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/nginxreceiver/go.sum b/receiver/nginxreceiver/go.sum index 911e16dce19e..a78f188b8423 100644 --- a/receiver/nginxreceiver/go.sum +++ b/receiver/nginxreceiver/go.sum @@ -190,8 +190,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/nsxtreceiver/factory.go b/receiver/nsxtreceiver/factory.go index 176d700e9e9f..fda456ff9035 100644 --- a/receiver/nsxtreceiver/factory.go +++ b/receiver/nsxtreceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver/internal/metadata" ) @@ -33,16 +34,16 @@ func createDefaultConfig() component.Config { } } -func createMetricsReceiver(_ context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics) (receiver.Metrics, error) { +func createMetricsReceiver(ctx context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics) (receiver.Metrics, error) { cfg, ok := rConf.(*Config) if !ok { return nil, errConfigNotNSX } s := newScraper(cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType( + sc, err := scraper.NewMetrics( s.scrape, - scraperhelper.WithStart(s.start), + scraper.WithStart(s.start), ) if err != nil { return nil, err @@ -52,6 +53,6 @@ func createMetricsReceiver(_ context.Context, params receiver.Settings, rConf co &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, sc), ) } diff --git a/receiver/nsxtreceiver/go.mod b/receiver/nsxtreceiver/go.mod index 771f8823e2e3..3dd5488300e0 100644 --- a/receiver/nsxtreceiver/go.mod +++ b/receiver/nsxtreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -62,7 +63,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect diff --git a/receiver/nsxtreceiver/go.sum b/receiver/nsxtreceiver/go.sum index d93cec1dcf8a..967dda930987 100644 --- a/receiver/nsxtreceiver/go.sum +++ b/receiver/nsxtreceiver/go.sum @@ -122,8 +122,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/nsxtreceiver/scraper.go b/receiver/nsxtreceiver/scraper.go index ecd5fd38602a..e54865715deb 100644 --- a/receiver/nsxtreceiver/scraper.go +++ b/receiver/nsxtreceiver/scraper.go @@ -20,7 +20,7 @@ import ( dm "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver/internal/model" ) -type scraper struct { +type nsxtScraper struct { config *Config settings component.TelemetrySettings host component.Host @@ -28,15 +28,15 @@ type scraper struct { mb *metadata.MetricsBuilder } -func newScraper(cfg *Config, settings receiver.Settings) *scraper { - return &scraper{ +func newScraper(cfg *Config, settings receiver.Settings) *nsxtScraper { + return &nsxtScraper{ config: cfg, settings: settings.TelemetrySettings, mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, settings), } } -func (s *scraper) start(ctx context.Context, host component.Host) error { +func (s *nsxtScraper) start(ctx context.Context, host component.Host) error { s.host = host client, err := newClient(ctx, s.config, s.settings, s.host, s.settings.Logger) if err != nil { @@ -53,7 +53,7 @@ const ( managerClass ) -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *nsxtScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { r, err := s.retrieve(ctx) if err != nil { return pmetric.NewMetrics(), err @@ -76,7 +76,7 @@ type interfaceInformation struct { stats *dm.NetworkInterfaceStats } -func (s *scraper) retrieve(ctx context.Context) ([]*nodeInfo, error) { +func (s *nsxtScraper) retrieve(ctx context.Context) ([]*nodeInfo, error) { var r []*nodeInfo errs := &scrapererror.ScrapeErrors{} @@ -126,7 +126,7 @@ func (s *scraper) retrieve(ctx context.Context) ([]*nodeInfo, error) { return r, errs.Combine() } -func (s *scraper) retrieveInterfaces( +func (s *nsxtScraper) retrieveInterfaces( ctx context.Context, nodeProps dm.NodeProperties, nodeInfo *nodeInfo, @@ -154,7 +154,7 @@ func (s *scraper) retrieveInterfaces( } } -func (s *scraper) retrieveNodeStats( +func (s *nsxtScraper) retrieveNodeStats( ctx context.Context, nodeProps dm.NodeProperties, nodeInfo *nodeInfo, @@ -171,7 +171,7 @@ func (s *scraper) retrieveNodeStats( nodeInfo.stats = ns } -func (s *scraper) process( +func (s *nsxtScraper) process( nodes []*nodeInfo, colTime pcommon.Timestamp, ) { @@ -183,7 +183,7 @@ func (s *scraper) process( } } -func (s *scraper) recordNodeInterface(colTime pcommon.Timestamp, nodeProps dm.NodeProperties, i interfaceInformation) { +func (s *nsxtScraper) recordNodeInterface(colTime pcommon.Timestamp, nodeProps dm.NodeProperties, i interfaceInformation) { s.mb.RecordNsxtNodeNetworkPacketCountDataPoint(colTime, i.stats.RxDropped, metadata.AttributeDirectionReceived, metadata.AttributePacketTypeDropped) s.mb.RecordNsxtNodeNetworkPacketCountDataPoint(colTime, i.stats.RxErrors, metadata.AttributeDirectionReceived, metadata.AttributePacketTypeErrored) successRxPackets := i.stats.RxPackets - i.stats.RxDropped - i.stats.RxErrors @@ -205,7 +205,7 @@ func (s *scraper) recordNodeInterface(colTime pcommon.Timestamp, nodeProps dm.No s.mb.EmitForResource(metadata.WithResource(rb.Emit())) } -func (s *scraper) recordNode( +func (s *nsxtScraper) recordNode( colTime pcommon.Timestamp, info *nodeInfo, ) { diff --git a/receiver/ntpreceiver/factory.go b/receiver/ntpreceiver/factory.go index 307f9f5ccbae..a2b684bfc78f 100644 --- a/receiver/ntpreceiver/factory.go +++ b/receiver/ntpreceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ntpreceiver/internal/metadata" ) @@ -34,14 +35,15 @@ func createDefaultConfig() component.Config { } } -func createMetricsReceiver(_ context.Context, settings receiver.Settings, cfg component.Config, consumer consumer.Metrics) (receiver.Metrics, error) { +func createMetricsReceiver(ctx context.Context, settings receiver.Settings, cfg component.Config, consumer consumer.Metrics) (receiver.Metrics, error) { rCfg := cfg.(*Config) mp := newScraper(rCfg, settings) - s, err := scraperhelper.NewScraperWithoutType(mp.scrape) + s, err := scraper.NewMetrics( + mp.scrape) if err != nil { return nil, err } - opt := scraperhelper.AddScraperWithType(metadata.Type, s) + opt := scraperhelper.AddScraper(metadata.Type, s) return scraperhelper.NewScraperControllerReceiver( &rCfg.ControllerConfig, diff --git a/receiver/ntpreceiver/go.mod b/receiver/ntpreceiver/go.mod index ba4786876e06..b7129f67b63c 100644 --- a/receiver/ntpreceiver/go.mod +++ b/receiver/ntpreceiver/go.mod @@ -15,6 +15,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -42,7 +43,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/ntpreceiver/go.sum b/receiver/ntpreceiver/go.sum index 71eedba10c01..b0ddf9f30526 100644 --- a/receiver/ntpreceiver/go.sum +++ b/receiver/ntpreceiver/go.sum @@ -82,8 +82,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/ntpreceiver/receiver.go b/receiver/ntpreceiver/receiver.go index d52605431b46..126b9331abee 100644 --- a/receiver/ntpreceiver/receiver.go +++ b/receiver/ntpreceiver/receiver.go @@ -16,7 +16,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/ntpreceiver/internal/metadata" ) -type scraper struct { +type ntpScraper struct { logger *zap.Logger mb *metadata.MetricsBuilder version int @@ -24,7 +24,7 @@ type scraper struct { endpoint string } -func (s *scraper) scrape(context.Context) (pmetric.Metrics, error) { +func (s *ntpScraper) scrape(context.Context) (pmetric.Metrics, error) { options := ntp.QueryOptions{Version: s.version, Timeout: s.timeout} response, err := ntp.QueryWithOptions(s.endpoint, options) if err != nil { @@ -35,8 +35,8 @@ func (s *scraper) scrape(context.Context) (pmetric.Metrics, error) { return s.mb.Emit(), nil } -func newScraper(cfg *Config, settings receiver.Settings) *scraper { - return &scraper{ +func newScraper(cfg *Config, settings receiver.Settings) *ntpScraper { + return &ntpScraper{ logger: settings.TelemetrySettings.Logger, mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, settings), version: cfg.Version, diff --git a/receiver/oracledbreceiver/factory.go b/receiver/oracledbreceiver/factory.go index 3d98cf83b09f..4d589bc77c71 100644 --- a/receiver/oracledbreceiver/factory.go +++ b/receiver/oracledbreceiver/factory.go @@ -44,7 +44,7 @@ type sqlOpenerFunc func(dataSourceName string) (*sql.DB, error) func createReceiverFunc(sqlOpenerFunc sqlOpenerFunc, clientProviderFunc clientProviderFunc) receiver.CreateMetricsFunc { return func( - _ context.Context, + ctx context.Context, settings receiver.Settings, cfg component.Config, consumer consumer.Metrics, @@ -57,13 +57,13 @@ func createReceiverFunc(sqlOpenerFunc sqlOpenerFunc, clientProviderFunc clientPr return nil, err } - mp, err := newScraper(metricsBuilder, sqlCfg.MetricsBuilderConfig, sqlCfg.ControllerConfig, settings.TelemetrySettings.Logger, func() (*sql.DB, error) { + mp, err := newScraper(ctx, settings, metricsBuilder, sqlCfg.MetricsBuilderConfig, sqlCfg.ControllerConfig, settings.TelemetrySettings.Logger, func() (*sql.DB, error) { return sqlOpenerFunc(getDataSource(*sqlCfg)) }, clientProviderFunc, instanceName) if err != nil { return nil, err } - opt := scraperhelper.AddScraperWithType(metadata.Type, mp) + opt := scraperhelper.AddScraper(metadata.Type, mp) return scraperhelper.NewScraperControllerReceiver( &sqlCfg.ControllerConfig, diff --git a/receiver/oracledbreceiver/go.mod b/receiver/oracledbreceiver/go.mod index 4b4b7a38fc1d..88e8625811e2 100644 --- a/receiver/oracledbreceiver/go.mod +++ b/receiver/oracledbreceiver/go.mod @@ -15,6 +15,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -43,7 +44,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/oracledbreceiver/go.sum b/receiver/oracledbreceiver/go.sum index 013178d0797f..8f36f16e6527 100644 --- a/receiver/oracledbreceiver/go.sum +++ b/receiver/oracledbreceiver/go.sum @@ -82,8 +82,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/oracledbreceiver/scraper.go b/receiver/oracledbreceiver/scraper.go index a458ebf2af01..70a7c8263ee8 100644 --- a/receiver/oracledbreceiver/scraper.go +++ b/receiver/oracledbreceiver/scraper.go @@ -13,8 +13,10 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" + "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scrapererror" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "go.uber.org/multierr" "go.uber.org/zap" @@ -48,7 +50,7 @@ type dbProviderFunc func() (*sql.DB, error) type clientProviderFunc func(*sql.DB, string, *zap.Logger) dbClient -type scraper struct { +type oracleScraper struct { statsClient dbClient tablespaceUsageClient dbClient systemResourceLimitsClient dbClient @@ -65,8 +67,8 @@ type scraper struct { metricsBuilderConfig metadata.MetricsBuilderConfig } -func newScraper(metricsBuilder *metadata.MetricsBuilder, metricsBuilderConfig metadata.MetricsBuilderConfig, scrapeCfg scraperhelper.ControllerConfig, logger *zap.Logger, providerFunc dbProviderFunc, clientProviderFunc clientProviderFunc, instanceName string) (scraperhelper.Scraper, error) { - s := &scraper{ +func newScraper(ctx context.Context, settings receiver.Settings, metricsBuilder *metadata.MetricsBuilder, metricsBuilderConfig metadata.MetricsBuilderConfig, scrapeCfg scraperhelper.ControllerConfig, logger *zap.Logger, providerFunc dbProviderFunc, clientProviderFunc clientProviderFunc, instanceName string) (scraper.Metrics, error) { + s := &oracleScraper{ mb: metricsBuilder, metricsBuilderConfig: metricsBuilderConfig, scrapeCfg: scrapeCfg, @@ -75,10 +77,10 @@ func newScraper(metricsBuilder *metadata.MetricsBuilder, metricsBuilderConfig me clientProviderFunc: clientProviderFunc, instanceName: instanceName, } - return scraperhelper.NewScraperWithoutType(s.scrape, scraperhelper.WithShutdown(s.shutdown), scraperhelper.WithStart(s.start)) + return scraper.NewMetrics(s.scrape, scraper.WithShutdown(s.shutdown), scraper.WithStart(s.start)) } -func (s *scraper) start(context.Context, component.Host) error { +func (s *oracleScraper) start(context.Context, component.Host) error { s.startTime = pcommon.NewTimestampFromTime(time.Now()) var err error s.db, err = s.dbProviderFunc() @@ -92,7 +94,7 @@ func (s *scraper) start(context.Context, component.Host) error { return nil } -func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { +func (s *oracleScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { s.logger.Debug("Begin scrape") var scrapeErrors []error @@ -331,7 +333,7 @@ func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) { return out, nil } -func (s *scraper) shutdown(_ context.Context) error { +func (s *oracleScraper) shutdown(_ context.Context) error { if s.db == nil { return nil } diff --git a/receiver/oracledbreceiver/scraper_test.go b/receiver/oracledbreceiver/scraper_test.go index 8d004393d2c5..bda31cb93017 100644 --- a/receiver/oracledbreceiver/scraper_test.go +++ b/receiver/oracledbreceiver/scraper_test.go @@ -22,7 +22,7 @@ import ( ) func TestScraper_ErrorOnStart(t *testing.T) { - scrpr := scraper{ + scrpr := oracleScraper{ dbProviderFunc: func() (*sql.DB, error) { return nil, errors.New("oops") }, @@ -129,7 +129,7 @@ func TestScraper_Scrape(t *testing.T) { cfg.Metrics.OracledbConsistentGets.Enabled = true cfg.Metrics.OracledbDbBlockGets.Enabled = true - scrpr := scraper{ + scrpr := oracleScraper{ logger: zap.NewNop(), mb: metadata.NewMetricsBuilder(cfg, receivertest.NewNopSettings()), dbProviderFunc: func() (*sql.DB, error) { diff --git a/receiver/otlpjsonfilereceiver/internal/metadata/generated_telemetry_test.go b/receiver/otlpjsonfilereceiver/internal/metadata/generated_telemetry_test.go index 3cb69319b6a5..c2b54d8b0492 100644 --- a/receiver/otlpjsonfilereceiver/internal/metadata/generated_telemetry_test.go +++ b/receiver/otlpjsonfilereceiver/internal/metadata/generated_telemetry_test.go @@ -6,14 +6,13 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" ) type mockMeter struct { diff --git a/receiver/podmanreceiver/go.mod b/receiver/podmanreceiver/go.mod index 47adb3c95632..06d1f511c4cc 100644 --- a/receiver/podmanreceiver/go.mod +++ b/receiver/podmanreceiver/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -44,7 +45,6 @@ require ( go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/podmanreceiver/go.sum b/receiver/podmanreceiver/go.sum index c3e274f6590c..227910a1645c 100644 --- a/receiver/podmanreceiver/go.sum +++ b/receiver/podmanreceiver/go.sum @@ -82,8 +82,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/podmanreceiver/receiver.go b/receiver/podmanreceiver/receiver.go index 03eee3e02737..ca674c8f73d9 100644 --- a/receiver/podmanreceiver/receiver.go +++ b/receiver/podmanreceiver/receiver.go @@ -18,6 +18,7 @@ import ( "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scrapererror" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "go.uber.org/multierr" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver/internal/metadata" @@ -58,11 +59,11 @@ func createMetricsReceiver( podmanConfig := config.(*Config) recv := newMetricsReceiver(params, podmanConfig, nil) - scrp, err := scraperhelper.NewScraperWithoutType(recv.scrape, scraperhelper.WithStart(recv.start), scraperhelper.WithShutdown(recv.shutdown)) + scrp, err := scraper.NewMetrics(recv.scrape, scraper.WithStart(recv.start), scraper.WithShutdown(recv.shutdown)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&recv.config.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scrp)) + return scraperhelper.NewScraperControllerReceiver(&recv.config.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, scrp)) } func (r *metricsReceiver) start(ctx context.Context, _ component.Host) error { diff --git a/receiver/postgresqlreceiver/factory.go b/receiver/postgresqlreceiver/factory.go index c47f31721bb6..2a3a25466b56 100644 --- a/receiver/postgresqlreceiver/factory.go +++ b/receiver/postgresqlreceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver/internal/metadata" ) @@ -58,13 +59,13 @@ func createMetricsReceiver( } ns := newPostgreSQLScraper(params, cfg, clientFactory) - scraper, err := scraperhelper.NewScraperWithoutType(ns.scrape, scraperhelper.WithShutdown(ns.shutdown)) + s, err := scraper.NewMetrics(ns.scrape, scraper.WithShutdown(ns.shutdown)) if err != nil { return nil, err } return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/postgresqlreceiver/go.mod b/receiver/postgresqlreceiver/go.mod index ca61e1f572d6..babc74758ebe 100644 --- a/receiver/postgresqlreceiver/go.mod +++ b/receiver/postgresqlreceiver/go.mod @@ -24,6 +24,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -90,7 +91,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/postgresqlreceiver/go.sum b/receiver/postgresqlreceiver/go.sum index 74491b7e2a80..72e6f2c43383 100644 --- a/receiver/postgresqlreceiver/go.sum +++ b/receiver/postgresqlreceiver/go.sum @@ -176,8 +176,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/rabbitmqreceiver/factory.go b/receiver/rabbitmqreceiver/factory.go index ba884cc82e37..2dbaa8d06e05 100644 --- a/receiver/rabbitmqreceiver/factory.go +++ b/receiver/rabbitmqreceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/rabbitmqreceiver/internal/metadata" ) @@ -49,10 +50,10 @@ func createMetricsReceiver(_ context.Context, params receiver.Settings, rConf co } rabbitScraper := newScraper(params.Logger, cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType(rabbitScraper.scrape, scraperhelper.WithStart(rabbitScraper.start)) + s, err := scraper.NewMetrics(rabbitScraper.scrape, scraper.WithStart(rabbitScraper.start)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/rabbitmqreceiver/go.mod b/receiver/rabbitmqreceiver/go.mod index 8452984642b4..6bcf4f19bc37 100644 --- a/receiver/rabbitmqreceiver/go.mod +++ b/receiver/rabbitmqreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -60,7 +61,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect diff --git a/receiver/rabbitmqreceiver/go.sum b/receiver/rabbitmqreceiver/go.sum index 709cd2bc0af3..3cb7e77d34bb 100644 --- a/receiver/rabbitmqreceiver/go.sum +++ b/receiver/rabbitmqreceiver/go.sum @@ -116,8 +116,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/redisreceiver/factory.go b/receiver/redisreceiver/factory.go index 93f8745632cf..13735ddb9327 100644 --- a/receiver/redisreceiver/factory.go +++ b/receiver/redisreceiver/factory.go @@ -53,5 +53,5 @@ func createMetricsReceiver( return nil, err } - return scraperhelper.NewScraperControllerReceiver(&oCfg.ControllerConfig, set, consumer, scraperhelper.AddScraperWithType(metadata.Type, scrp)) + return scraperhelper.NewScraperControllerReceiver(&oCfg.ControllerConfig, set, consumer, scraperhelper.AddScraper(metadata.Type, scrp)) } diff --git a/receiver/redisreceiver/go.mod b/receiver/redisreceiver/go.mod index 0e7ccaba0031..123de8762abb 100644 --- a/receiver/redisreceiver/go.mod +++ b/receiver/redisreceiver/go.mod @@ -21,6 +21,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -86,7 +87,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/redisreceiver/go.sum b/receiver/redisreceiver/go.sum index e83a0282679d..783ac96a0251 100644 --- a/receiver/redisreceiver/go.sum +++ b/receiver/redisreceiver/go.sum @@ -178,8 +178,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/redisreceiver/redis_scraper.go b/receiver/redisreceiver/redis_scraper.go index 05f037475daf..4c7311bfc86e 100644 --- a/receiver/redisreceiver/redis_scraper.go +++ b/receiver/redisreceiver/redis_scraper.go @@ -14,7 +14,7 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver/internal/metadata" @@ -33,7 +33,7 @@ type redisScraper struct { const redisMaxDbs = 16 // Maximum possible number of redis databases -func newRedisScraper(cfg *Config, settings receiver.Settings) (scraperhelper.Scraper, error) { +func newRedisScraper(cfg *Config, settings receiver.Settings) (scraper.Metrics, error) { opts := &redis.Options{ Addr: cfg.Endpoint, Username: cfg.Username, @@ -48,7 +48,7 @@ func newRedisScraper(cfg *Config, settings receiver.Settings) (scraperhelper.Scr return newRedisScraperWithClient(newRedisClient(opts), settings, cfg) } -func newRedisScraperWithClient(client client, settings receiver.Settings, cfg *Config) (scraperhelper.Scraper, error) { +func newRedisScraperWithClient(client client, settings receiver.Settings, cfg *Config) (scraper.Metrics, error) { configInfo, err := newConfigInfo(cfg) if err != nil { return nil, err @@ -60,9 +60,9 @@ func newRedisScraperWithClient(client client, settings receiver.Settings, cfg *C mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, settings), configInfo: configInfo, } - return scraperhelper.NewScraperWithoutType( + return scraper.NewMetrics( rs.Scrape, - scraperhelper.WithShutdown(rs.shutdown), + scraper.WithShutdown(rs.shutdown), ) } diff --git a/receiver/redisreceiver/redis_scraper_test.go b/receiver/redisreceiver/redis_scraper_test.go index 616f975768ef..a8b861a88126 100644 --- a/receiver/redisreceiver/redis_scraper_test.go +++ b/receiver/redisreceiver/redis_scraper_test.go @@ -25,7 +25,7 @@ func TestRedisRunnable(t *testing.T) { rs := &redisScraper{mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, settings)} runner, err := newRedisScraperWithClient(newFakeClient(), settings, cfg) require.NoError(t, err) - md, err := runner.Scrape(context.Background()) + md, err := runner.ScrapeMetrics(context.Background()) require.NoError(t, err) // + 6 because there are two keyspace entries each of which has three metrics // -2 because maxmemory and slave_repl_offset is by default disabled, so recorder is there, but there won't be data point diff --git a/receiver/riakreceiver/factory.go b/receiver/riakreceiver/factory.go index 75a6c9cbcdb0..a41e3fbf794b 100644 --- a/receiver/riakreceiver/factory.go +++ b/receiver/riakreceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/riakreceiver/internal/metadata" ) @@ -42,17 +43,17 @@ func createDefaultConfig() component.Config { } } -func createMetricsReceiver(_ context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics) (receiver.Metrics, error) { +func createMetricsReceiver(ctx context.Context, params receiver.Settings, rConf component.Config, consumer consumer.Metrics) (receiver.Metrics, error) { cfg, ok := rConf.(*Config) if !ok { return nil, errConfigNotRiak } riakScraper := newScraper(params.Logger, cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType(riakScraper.scrape, scraperhelper.WithStart(riakScraper.start)) + s, err := scraper.NewMetrics(riakScraper.scrape, scraper.WithStart(riakScraper.start)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/riakreceiver/go.mod b/receiver/riakreceiver/go.mod index cc2adcbe33f3..4d1d823a394e 100644 --- a/receiver/riakreceiver/go.mod +++ b/receiver/riakreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -61,7 +62,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect diff --git a/receiver/riakreceiver/go.sum b/receiver/riakreceiver/go.sum index 709cd2bc0af3..3cb7e77d34bb 100644 --- a/receiver/riakreceiver/go.sum +++ b/receiver/riakreceiver/go.sum @@ -116,8 +116,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/saphanareceiver/factory.go b/receiver/saphanareceiver/factory.go index 9e736b866904..5deae2096fcc 100644 --- a/receiver/saphanareceiver/factory.go +++ b/receiver/saphanareceiver/factory.go @@ -48,7 +48,7 @@ func createDefaultConfig() component.Config { var errConfigNotSAPHANA = errors.New("config was not an sap hana receiver config") func createMetricsReceiver( - _ context.Context, + ctx context.Context, set receiver.Settings, cfg component.Config, consumer consumer.Metrics, @@ -57,10 +57,10 @@ func createMetricsReceiver( if !ok { return nil, errConfigNotSAPHANA } - scraper, err := newSapHanaScraper(set, c, &defaultConnectionFactory{}) + s, err := newSapHanaScraper(ctx, set, c, &defaultConnectionFactory{}) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&c.ControllerConfig, set, consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + return scraperhelper.NewScraperControllerReceiver(&c.ControllerConfig, set, consumer, scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/saphanareceiver/go.mod b/receiver/saphanareceiver/go.mod index bc653d983e6e..e7072d779d0d 100644 --- a/receiver/saphanareceiver/go.mod +++ b/receiver/saphanareceiver/go.mod @@ -20,6 +20,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -52,7 +53,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/saphanareceiver/go.sum b/receiver/saphanareceiver/go.sum index fadb348bca87..4701fbbedfb4 100644 --- a/receiver/saphanareceiver/go.sum +++ b/receiver/saphanareceiver/go.sum @@ -94,8 +94,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/saphanareceiver/scraper.go b/receiver/saphanareceiver/scraper.go index b6422118fae7..2857c229b693 100644 --- a/receiver/saphanareceiver/scraper.go +++ b/receiver/saphanareceiver/scraper.go @@ -13,7 +13,7 @@ import ( "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scrapererror" - "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/saphanareceiver/internal/metadata" ) @@ -27,14 +27,14 @@ type sapHanaScraper struct { factory sapHanaConnectionFactory } -func newSapHanaScraper(settings receiver.Settings, cfg *Config, factory sapHanaConnectionFactory) (scraperhelper.Scraper, error) { +func newSapHanaScraper(_ context.Context, settings receiver.Settings, cfg *Config, factory sapHanaConnectionFactory) (scraper.Metrics, error) { rs := &sapHanaScraper{ settings: settings, cfg: cfg, mbs: make(map[string]*metadata.MetricsBuilder), factory: factory, } - return scraperhelper.NewScraperWithoutType(rs.scrape) + return scraper.NewMetrics(rs.scrape) } func (s *sapHanaScraper) getMetricsBuilder(resourceAttributes map[string]string) (*metadata.MetricsBuilder, error) { diff --git a/receiver/saphanareceiver/scraper_test.go b/receiver/saphanareceiver/scraper_test.go index 8e61e72e4877..eabb88f6c2ea 100644 --- a/receiver/saphanareceiver/scraper_test.go +++ b/receiver/saphanareceiver/scraper_test.go @@ -96,13 +96,13 @@ func TestDisabledMetrics(t *testing.T) { cfg.MetricsBuilderConfig.Metrics.SaphanaVolumeOperationSize.Enabled = false cfg.MetricsBuilderConfig.Metrics.SaphanaVolumeOperationTime.Enabled = false - sc, err := newSapHanaScraper(receivertest.NewNopSettings(), cfg, &testConnectionFactory{dbWrapper}) + sc, err := newSapHanaScraper(context.Background(), receivertest.NewNopSettings(), cfg, &testConnectionFactory{dbWrapper}) require.NoError(t, err) expectedMetrics, err := golden.ReadMetrics(partialExpectedMetricsPath) require.NoError(t, err) - actualMetrics, err := sc.Scrape(context.Background()) + actualMetrics, err := sc.ScrapeMetrics(context.Background()) require.NoError(t, err) require.NoError(t, pmetrictest.CompareMetrics(expectedMetrics, actualMetrics, diff --git a/receiver/snmpreceiver/factory.go b/receiver/snmpreceiver/factory.go index 5eafd1d98178..7cc7e675dcc1 100644 --- a/receiver/snmpreceiver/factory.go +++ b/receiver/snmpreceiver/factory.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snmpreceiver/internal/metadata" ) @@ -61,12 +62,12 @@ func createMetricsReceiver( } snmpScraper := newScraper(params.Logger, snmpConfig, params) - scraper, err := scraperhelper.NewScraperWithoutType(snmpScraper.scrape, scraperhelper.WithStart(snmpScraper.start)) + s, err := scraper.NewMetrics(snmpScraper.scrape, scraper.WithStart(snmpScraper.start)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&snmpConfig.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + return scraperhelper.NewScraperControllerReceiver(&snmpConfig.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, s)) } // addMissingConfigDefaults adds any missing config parameters that have defaults diff --git a/receiver/snmpreceiver/go.mod b/receiver/snmpreceiver/go.mod index 5637e0766b8a..c3d7d6a608dd 100644 --- a/receiver/snmpreceiver/go.mod +++ b/receiver/snmpreceiver/go.mod @@ -18,6 +18,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -116,7 +117,6 @@ require ( go.opentelemetry.io/collector/processor/processorprofiles v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/processor/processortest v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect diff --git a/receiver/snmpreceiver/go.sum b/receiver/snmpreceiver/go.sum index 7b5166557c2f..6238673d79b9 100644 --- a/receiver/snmpreceiver/go.sum +++ b/receiver/snmpreceiver/go.sum @@ -266,8 +266,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be h1:cqvNzZCCdyGhcovzJy0Yzxp5MrNxBqWo1yhdF/wQwdE= go.opentelemetry.io/collector/semconv v0.114.1-0.20241130171227-c52d625647be/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= go.opentelemetry.io/collector/service v0.114.1-0.20241130171227-c52d625647be h1:qQxHHmhM/UoWf+uApuEn732ONV5eEdjfYMLO1QO0I6s= diff --git a/receiver/snowflakereceiver/factory.go b/receiver/snowflakereceiver/factory.go index c23218194cad..30e76887c005 100644 --- a/receiver/snowflakereceiver/factory.go +++ b/receiver/snowflakereceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snowflakereceiver/internal/metadata" ) @@ -43,7 +44,8 @@ func NewFactory() receiver.Factory { ) } -func createMetricsReceiver(_ context.Context, +func createMetricsReceiver( + _ context.Context, params receiver.Settings, baseCfg component.Config, consumer consumer.Metrics, @@ -51,7 +53,7 @@ func createMetricsReceiver(_ context.Context, cfg := baseCfg.(*Config) snowflakeScraper := newSnowflakeMetricsScraper(params, cfg) - scraper, err := scraperhelper.NewScraperWithoutType(snowflakeScraper.scrape, scraperhelper.WithStart(snowflakeScraper.start), scraperhelper.WithShutdown(snowflakeScraper.shutdown)) + s, err := scraper.NewMetrics(snowflakeScraper.scrape, scraper.WithStart(snowflakeScraper.start), scraper.WithShutdown(snowflakeScraper.shutdown)) if err != nil { return nil, err } @@ -60,6 +62,6 @@ func createMetricsReceiver(_ context.Context, &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/snowflakereceiver/go.mod b/receiver/snowflakereceiver/go.mod index 52d5ffb7ff46..b6bdc525a594 100644 --- a/receiver/snowflakereceiver/go.mod +++ b/receiver/snowflakereceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -86,7 +87,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/snowflakereceiver/go.sum b/receiver/snowflakereceiver/go.sum index f5a1a0fa5645..a8f055a8e258 100644 --- a/receiver/snowflakereceiver/go.sum +++ b/receiver/snowflakereceiver/go.sum @@ -197,8 +197,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/solacereceiver/generated_component_telemetry_test.go b/receiver/solacereceiver/generated_component_telemetry_test.go index 81075778685b..9c48e6fcf3cb 100644 --- a/receiver/solacereceiver/generated_component_telemetry_test.go +++ b/receiver/solacereceiver/generated_component_telemetry_test.go @@ -7,16 +7,15 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type componentTestTelemetry struct { diff --git a/receiver/solacereceiver/internal/metadata/generated_telemetry.go b/receiver/solacereceiver/internal/metadata/generated_telemetry.go index 888b734f570b..0397b56f77ee 100644 --- a/receiver/solacereceiver/internal/metadata/generated_telemetry.go +++ b/receiver/solacereceiver/internal/metadata/generated_telemetry.go @@ -5,12 +5,11 @@ package metadata import ( "errors" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" ) func Meter(settings component.TelemetrySettings) metric.Meter { diff --git a/receiver/solacereceiver/internal/metadata/generated_telemetry_test.go b/receiver/solacereceiver/internal/metadata/generated_telemetry_test.go index 76f015b57f4a..92b5e9d95dc6 100644 --- a/receiver/solacereceiver/internal/metadata/generated_telemetry_test.go +++ b/receiver/solacereceiver/internal/metadata/generated_telemetry_test.go @@ -6,16 +6,15 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/receiver/splunkenterprisereceiver/factory.go b/receiver/splunkenterprisereceiver/factory.go index e69b2fa29d81..70c12a7ed845 100644 --- a/receiver/splunkenterprisereceiver/factory.go +++ b/receiver/splunkenterprisereceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkenterprisereceiver/internal/metadata" ) @@ -61,9 +62,9 @@ func createMetricsReceiver( cfg := baseCfg.(*Config) splunkScraper := newSplunkMetricsScraper(params, cfg) - scraper, err := scraperhelper.NewScraperWithoutType( + s, err := scraper.NewMetrics( splunkScraper.scrape, - scraperhelper.WithStart(splunkScraper.start)) + scraper.WithStart(splunkScraper.start)) if err != nil { return nil, err } @@ -72,6 +73,6 @@ func createMetricsReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/splunkenterprisereceiver/go.mod b/receiver/splunkenterprisereceiver/go.mod index 4e5f65decee1..dddabed88ce1 100644 --- a/receiver/splunkenterprisereceiver/go.mod +++ b/receiver/splunkenterprisereceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -59,7 +60,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect diff --git a/receiver/splunkenterprisereceiver/go.sum b/receiver/splunkenterprisereceiver/go.sum index 03d2908e5bde..916e3374066d 100644 --- a/receiver/splunkenterprisereceiver/go.sum +++ b/receiver/splunkenterprisereceiver/go.sum @@ -112,8 +112,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/sqlserverreceiver/factory.go b/receiver/sqlserverreceiver/factory.go index a16dd8a17c9c..ccae941125f3 100644 --- a/receiver/sqlserverreceiver/factory.go +++ b/receiver/sqlserverreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/sqlquery" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sqlserverreceiver/internal/metadata" @@ -119,14 +120,14 @@ func setupScrapers(params receiver.Settings, cfg *Config) ([]scraperhelper.Scrap var opts []scraperhelper.ScraperControllerOption for _, sqlScraper := range sqlServerScrapers { - scraper, err := scraperhelper.NewScraperWithoutType(sqlScraper.Scrape, - scraperhelper.WithStart(sqlScraper.Start), - scraperhelper.WithShutdown(sqlScraper.Shutdown)) + s, err := scraper.NewMetrics(sqlScraper.Scrape, + scraper.WithStart(sqlScraper.Start), + scraper.WithShutdown(sqlScraper.Shutdown)) if err != nil { return nil, err } - opt := scraperhelper.AddScraperWithType(metadata.Type, scraper) + opt := scraperhelper.AddScraper(metadata.Type, s) opts = append(opts, opt) } diff --git a/receiver/sqlserverreceiver/factory_windows.go b/receiver/sqlserverreceiver/factory_windows.go index 148b0c027d80..c8bff7fc6e61 100644 --- a/receiver/sqlserverreceiver/factory_windows.go +++ b/receiver/sqlserverreceiver/factory_windows.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sqlserverreceiver/internal/metadata" ) @@ -29,9 +30,9 @@ func createMetricsReceiver( } sqlServerScraper := newSQLServerPCScraper(params, cfg) - scraper, err := scraperhelper.NewScraperWithoutType(sqlServerScraper.scrape, - scraperhelper.WithStart(sqlServerScraper.start), - scraperhelper.WithShutdown(sqlServerScraper.shutdown)) + scraper, err := scraper.NewMetrics(sqlServerScraper.scrape, + scraper.WithStart(sqlServerScraper.start), + scraper.WithShutdown(sqlServerScraper.shutdown)) if err != nil { return nil, err } @@ -41,7 +42,7 @@ func createMetricsReceiver( if err != nil { return nil, err } - opts = append(opts, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + opts = append(opts, scraperhelper.AddScraper(metadata.Type, scraper)) return scraperhelper.NewScraperControllerReceiver( &cfg.ControllerConfig, diff --git a/receiver/sqlserverreceiver/go.mod b/receiver/sqlserverreceiver/go.mod index fde2dffe3813..49763defa0ce 100644 --- a/receiver/sqlserverreceiver/go.mod +++ b/receiver/sqlserverreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -102,7 +103,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/sqlserverreceiver/go.sum b/receiver/sqlserverreceiver/go.sum index 69559cc70c0a..908a87ba056c 100644 --- a/receiver/sqlserverreceiver/go.sum +++ b/receiver/sqlserverreceiver/go.sum @@ -236,8 +236,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/sshcheckreceiver/factory.go b/receiver/sshcheckreceiver/factory.go index d564ad058416..a99164d42e62 100644 --- a/receiver/sshcheckreceiver/factory.go +++ b/receiver/sshcheckreceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sshcheckreceiver/internal/configssh" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sshcheckreceiver/internal/metadata" @@ -44,10 +45,10 @@ func createMetricsReceiver(_ context.Context, params receiver.Settings, rConf co } sshcheckScraper := newScraper(cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType(sshcheckScraper.scrape, scraperhelper.WithStart(sshcheckScraper.start)) + s, err := scraper.NewMetrics(sshcheckScraper.scrape, scraper.WithStart(sshcheckScraper.start)) if err != nil { return nil, err } - return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraperWithType(metadata.Type, scraper)) + return scraperhelper.NewScraperControllerReceiver(&cfg.ControllerConfig, params, consumer, scraperhelper.AddScraper(metadata.Type, s)) } diff --git a/receiver/sshcheckreceiver/go.mod b/receiver/sshcheckreceiver/go.mod index fcbf6a5cffec..2203ea8816c5 100644 --- a/receiver/sshcheckreceiver/go.mod +++ b/receiver/sshcheckreceiver/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 golang.org/x/crypto v0.28.0 @@ -46,7 +47,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/otel/sdk v1.32.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect ) diff --git a/receiver/sshcheckreceiver/go.sum b/receiver/sshcheckreceiver/go.sum index e32b7fe64f8f..7e885cedc846 100644 --- a/receiver/sshcheckreceiver/go.sum +++ b/receiver/sshcheckreceiver/go.sum @@ -96,8 +96,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/statsdreceiver/generated_component_telemetry_test.go b/receiver/statsdreceiver/generated_component_telemetry_test.go index f84f53a26df5..05ddcfc600ac 100644 --- a/receiver/statsdreceiver/generated_component_telemetry_test.go +++ b/receiver/statsdreceiver/generated_component_telemetry_test.go @@ -7,16 +7,15 @@ import ( "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receivertest" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type componentTestTelemetry struct { diff --git a/receiver/statsdreceiver/internal/metadata/generated_telemetry.go b/receiver/statsdreceiver/internal/metadata/generated_telemetry.go index 5ef557da7f8d..55edc70c8e78 100644 --- a/receiver/statsdreceiver/internal/metadata/generated_telemetry.go +++ b/receiver/statsdreceiver/internal/metadata/generated_telemetry.go @@ -5,12 +5,11 @@ package metadata import ( "errors" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" ) func Meter(settings component.TelemetrySettings) metric.Meter { diff --git a/receiver/statsdreceiver/internal/metadata/generated_telemetry_test.go b/receiver/statsdreceiver/internal/metadata/generated_telemetry_test.go index e10801bb12f9..a63d6e8fdd39 100644 --- a/receiver/statsdreceiver/internal/metadata/generated_telemetry_test.go +++ b/receiver/statsdreceiver/internal/metadata/generated_telemetry_test.go @@ -6,16 +6,15 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/otel/metric" embeddedmetric "go.opentelemetry.io/otel/metric/embedded" noopmetric "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/trace" embeddedtrace "go.opentelemetry.io/otel/trace/embedded" nooptrace "go.opentelemetry.io/otel/trace/noop" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config/configtelemetry" ) type mockMeter struct { diff --git a/receiver/tlscheckreceiver/factory.go b/receiver/tlscheckreceiver/factory.go index 9bb9d92c37d2..de3e0fcaa265 100644 --- a/receiver/tlscheckreceiver/factory.go +++ b/receiver/tlscheckreceiver/factory.go @@ -11,6 +11,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver/internal/metadata" ) @@ -45,11 +46,11 @@ func newReceiver( } mp := newScraper(tlsCheckConfig, settings) - s, err := scraperhelper.NewScraperWithoutType(mp.scrape) + s, err := scraper.NewMetrics(mp.scrape) if err != nil { return nil, err } - opt := scraperhelper.AddScraperWithType(metadata.Type, s) + opt := scraperhelper.AddScraper(metadata.Type, s) return scraperhelper.NewScraperControllerReceiver( &tlsCheckConfig.ControllerConfig, diff --git a/receiver/tlscheckreceiver/go.mod b/receiver/tlscheckreceiver/go.mod index f88b38225946..528e978eb5de 100644 --- a/receiver/tlscheckreceiver/go.mod +++ b/receiver/tlscheckreceiver/go.mod @@ -14,6 +14,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -42,7 +43,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/tlscheckreceiver/go.sum b/receiver/tlscheckreceiver/go.sum index 12a776eda8d9..0fb8e8045eb9 100644 --- a/receiver/tlscheckreceiver/go.sum +++ b/receiver/tlscheckreceiver/go.sum @@ -80,8 +80,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/tlscheckreceiver/scraper.go b/receiver/tlscheckreceiver/scraper.go index c4807cc78eff..7866afccd427 100644 --- a/receiver/tlscheckreceiver/scraper.go +++ b/receiver/tlscheckreceiver/scraper.go @@ -13,18 +13,18 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tlscheckreceiver/internal/metadata" ) -type scraper struct { +type tlsCheckScraper struct { // include string logger *zap.Logger mb *metadata.MetricsBuilder } -func (s *scraper) scrape(_ context.Context) (pmetric.Metrics, error) { +func (s *tlsCheckScraper) scrape(_ context.Context) (pmetric.Metrics, error) { return pmetric.NewMetrics(), nil } -func newScraper(cfg *Config, settings receiver.Settings) *scraper { - return &scraper{ +func newScraper(cfg *Config, settings receiver.Settings) *tlsCheckScraper { + return &tlsCheckScraper{ logger: settings.TelemetrySettings.Logger, mb: metadata.NewMetricsBuilder(cfg.MetricsBuilderConfig, settings), } diff --git a/receiver/vcenterreceiver/factory.go b/receiver/vcenterreceiver/factory.go index e40b1f02db5a..5bdf539d22f7 100644 --- a/receiver/vcenterreceiver/factory.go +++ b/receiver/vcenterreceiver/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/vcenterreceiver/internal/metadata" ) @@ -51,10 +52,10 @@ func createMetricsReceiver( } vr := newVmwareVcenterScraper(params.Logger, cfg, params) - scraper, err := scraperhelper.NewScraperWithoutType( + s, err := scraper.NewMetrics( vr.scrape, - scraperhelper.WithStart(vr.Start), - scraperhelper.WithShutdown(vr.Shutdown), + scraper.WithStart(vr.Start), + scraper.WithShutdown(vr.Shutdown), ) if err != nil { return nil, err @@ -64,6 +65,6 @@ func createMetricsReceiver( &cfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scraper), + scraperhelper.AddScraper(metadata.Type, s), ) } diff --git a/receiver/vcenterreceiver/go.mod b/receiver/vcenterreceiver/go.mod index 1a5999506f81..f94faf91feb5 100644 --- a/receiver/vcenterreceiver/go.mod +++ b/receiver/vcenterreceiver/go.mod @@ -22,6 +22,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -89,7 +90,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/vcenterreceiver/go.sum b/receiver/vcenterreceiver/go.sum index cd01b92b7197..7bb71b7a5e48 100644 --- a/receiver/vcenterreceiver/go.sum +++ b/receiver/vcenterreceiver/go.sum @@ -180,8 +180,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= diff --git a/receiver/windowsperfcountersreceiver/factory_windows.go b/receiver/windowsperfcountersreceiver/factory_windows.go index 00fe33f4d111..88f81427e58b 100644 --- a/receiver/windowsperfcountersreceiver/factory_windows.go +++ b/receiver/windowsperfcountersreceiver/factory_windows.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/windowsperfcountersreceiver/internal/metadata" ) @@ -24,12 +25,12 @@ func createMetricsReceiver( consumer consumer.Metrics, ) (receiver.Metrics, error) { oCfg := cfg.(*Config) - scraper := newScraper(oCfg, params.TelemetrySettings) + s := newScraper(oCfg, params.TelemetrySettings) - scrp, err := scraperhelper.NewScraperWithoutType( - scraper.scrape, - scraperhelper.WithStart(scraper.start), - scraperhelper.WithShutdown(scraper.shutdown), + scrp, err := scraper.NewMetrics( + s.scrape, + scraper.WithStart(s.start), + scraper.WithShutdown(s.shutdown), ) if err != nil { return nil, err @@ -39,6 +40,6 @@ func createMetricsReceiver( &oCfg.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scrp), + scraperhelper.AddScraper(metadata.Type, scrp), ) } diff --git a/receiver/windowsperfcountersreceiver/go.mod b/receiver/windowsperfcountersreceiver/go.mod index e012333e4b77..d9ff88fa40bf 100644 --- a/receiver/windowsperfcountersreceiver/go.mod +++ b/receiver/windowsperfcountersreceiver/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -45,7 +46,6 @@ require ( go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper 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 diff --git a/receiver/windowsperfcountersreceiver/go.sum b/receiver/windowsperfcountersreceiver/go.sum index 44360e93c707..a3c5cfcc3544 100644 --- a/receiver/windowsperfcountersreceiver/go.sum +++ b/receiver/windowsperfcountersreceiver/go.sum @@ -80,8 +80,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= diff --git a/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper.go b/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper.go index 229a48a2a89e..8b9cbd53c0f5 100644 --- a/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper.go +++ b/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper.go @@ -29,8 +29,8 @@ type perfCounterMetricWatcher struct { type newWatcherFunc func(string, string, string) (winperfcounters.PerfCounterWatcher, error) -// scraper is the type that scrapes various host metrics. -type scraper struct { +// windowsPerfCountersScraper is the type that scrapes various host metrics. +type windowsPerfCountersScraper struct { cfg *Config settings component.TelemetrySettings watchers []perfCounterMetricWatcher @@ -39,11 +39,11 @@ type scraper struct { newWatcher newWatcherFunc } -func newScraper(cfg *Config, settings component.TelemetrySettings) *scraper { - return &scraper{cfg: cfg, settings: settings, newWatcher: winperfcounters.NewWatcher} +func newScraper(cfg *Config, settings component.TelemetrySettings) *windowsPerfCountersScraper { + return &windowsPerfCountersScraper{cfg: cfg, settings: settings, newWatcher: winperfcounters.NewWatcher} } -func (s *scraper) start(context.Context, component.Host) error { +func (s *windowsPerfCountersScraper) start(context.Context, component.Host) error { watchers, err := s.initWatchers() if err != nil { s.settings.Logger.Warn("some performance counters could not be initialized", zap.Error(err)) @@ -52,7 +52,7 @@ func (s *scraper) start(context.Context, component.Host) error { return nil } -func (s *scraper) initWatchers() ([]perfCounterMetricWatcher, error) { +func (s *windowsPerfCountersScraper) initWatchers() ([]perfCounterMetricWatcher, error) { var errs error var watchers []perfCounterMetricWatcher @@ -85,7 +85,7 @@ func (s *scraper) initWatchers() ([]perfCounterMetricWatcher, error) { return watchers, errs } -func (s *scraper) shutdown(context.Context) error { +func (s *windowsPerfCountersScraper) shutdown(context.Context) error { var errs error for _, watcher := range s.watchers { err := watcher.Close() @@ -96,7 +96,7 @@ func (s *scraper) shutdown(context.Context) error { return errs } -func (s *scraper) scrape(context.Context) (pmetric.Metrics, error) { +func (s *windowsPerfCountersScraper) scrape(context.Context) (pmetric.Metrics, error) { md := pmetric.NewMetrics() metricSlice := md.ResourceMetrics().AppendEmpty().ScopeMetrics().AppendEmpty().Metrics() now := pcommon.NewTimestampFromTime(time.Now()) diff --git a/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper_test.go b/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper_test.go index 068359acfdc7..78e10b92bafb 100644 --- a/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper_test.go +++ b/receiver/windowsperfcountersreceiver/windowsperfcounters_scraper_test.go @@ -328,7 +328,7 @@ func TestInitWatchers(t *testing.T) { for _, test := range testCases { t.Run(test.name, func(t *testing.T) { - s := &scraper{cfg: &Config{PerfCounters: test.cfgs}, newWatcher: winperfcounters.NewWatcher} + s := &windowsPerfCountersScraper{cfg: &Config{PerfCounters: test.cfgs}, newWatcher: winperfcounters.NewWatcher} watchers, errs := s.initWatchers() if test.expectedErr != "" { require.EqualError(t, errs, test.expectedErr) @@ -372,7 +372,7 @@ func TestWatcherResetFailure(t *testing.T) { settings := componenttest.NewNopTelemetrySettings() settings.Logger = logger - s := &scraper{cfg: &cfg, settings: settings, newWatcher: mockPerfCounterFactoryInvocations(mpc)} + s := &windowsPerfCountersScraper{cfg: &cfg, settings: settings, newWatcher: mockPerfCounterFactoryInvocations(mpc)} errs := s.start(context.Background(), componenttest.NewNopHost()) require.NoError(t, errs) @@ -498,7 +498,7 @@ func TestScrape(t *testing.T) { t.Run(test.name, func(t *testing.T) { mpcs := test.mockPerfCounters testConfig := test.cfg - s := &scraper{cfg: &testConfig, newWatcher: mockPerfCounterFactoryInvocations(mpcs...)} + s := &windowsPerfCountersScraper{cfg: &testConfig, newWatcher: mockPerfCounterFactoryInvocations(mpcs...)} errs := s.start(context.Background(), componenttest.NewNopHost()) require.NoError(t, errs) diff --git a/receiver/zookeeperreceiver/factory.go b/receiver/zookeeperreceiver/factory.go index 42f8d31a05a2..e424ff5f9c89 100644 --- a/receiver/zookeeperreceiver/factory.go +++ b/receiver/zookeeperreceiver/factory.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/scraperhelper" + "go.opentelemetry.io/collector/scraper" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookeeperreceiver/internal/metadata" @@ -58,9 +59,9 @@ func createMetricsReceiver( return nil, err } - scrp, err := scraperhelper.NewScraperWithoutType( + scrp, err := scraper.NewMetrics( zms.scrape, - scraperhelper.WithShutdown(zms.shutdown), + scraper.WithShutdown(zms.shutdown), ) if err != nil { return nil, err @@ -70,6 +71,6 @@ func createMetricsReceiver( &rConfig.ControllerConfig, params, consumer, - scraperhelper.AddScraperWithType(metadata.Type, scrp), + scraperhelper.AddScraper(metadata.Type, scrp), ) } diff --git a/receiver/zookeeperreceiver/go.mod b/receiver/zookeeperreceiver/go.mod index e3bb81a514a5..2ae492ac5c16 100644 --- a/receiver/zookeeperreceiver/go.mod +++ b/receiver/zookeeperreceiver/go.mod @@ -20,6 +20,7 @@ require ( go.opentelemetry.io/collector/pdata v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be + go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 ) @@ -84,7 +85,6 @@ require ( go.opentelemetry.io/collector/pdata/pprofile v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/pipeline v0.114.1-0.20241130171227-c52d625647be // indirect go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be // indirect - go.opentelemetry.io/collector/scraper v0.114.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect diff --git a/receiver/zookeeperreceiver/go.sum b/receiver/zookeeperreceiver/go.sum index 48c142b7e52a..03cdb4d322ed 100644 --- a/receiver/zookeeperreceiver/go.sum +++ b/receiver/zookeeperreceiver/go.sum @@ -168,8 +168,8 @@ go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.2024113017122 go.opentelemetry.io/collector/receiver/receiverprofiles v0.114.1-0.20241130171227-c52d625647be/go.mod h1:+7Vv46YQ493yuiSnyUPvw6OTbWzdf/ym+oWdNKzdawk= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be h1:LHOaRHJr8v1d5s3paKdruDh1aBZIDLdWGLwYjcwUY+g= go.opentelemetry.io/collector/receiver/receivertest v0.114.1-0.20241130171227-c52d625647be/go.mod h1:x457Z8VzHtpPWL7/d4baWawdP/vFUFa+YVwfYBFFccU= -go.opentelemetry.io/collector/scraper v0.114.0 h1:65fGJ63oiw31FH089VgIA3VAMzNFGZz43DoCuD2FtDo= -go.opentelemetry.io/collector/scraper v0.114.0/go.mod h1:vWKPP+UxgMkQNCz22YGnx/PVreUL5CvA2slMSyC7Gks= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be h1:srlJbDYpoEMOxdEQL0W632lx5IW8yU2NhE+z4Y4nOp0= +go.opentelemetry.io/collector/scraper v0.114.1-0.20241130171227-c52d625647be/go.mod h1:JdaLA6lJH34XOA5dCCnhaNvL6ldhTbMn3E7U2A/eHWo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U=