From e13d3721f1593ba460fbe7508ac3f567425869b6 Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Fri, 3 May 2024 12:59:41 -0400 Subject: [PATCH 1/3] adding scrape protocol and ID for pr0metheus receiver --- .../internal/gpu/dcgmscraper_config.go | 11 ++++++----- .../prometheusscraper/simple_prometheus_scraper.go | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/receiver/awscontainerinsightreceiver/internal/gpu/dcgmscraper_config.go b/receiver/awscontainerinsightreceiver/internal/gpu/dcgmscraper_config.go index 4d11945d0db3..40e74fcfce7d 100644 --- a/receiver/awscontainerinsightreceiver/internal/gpu/dcgmscraper_config.go +++ b/receiver/awscontainerinsightreceiver/internal/gpu/dcgmscraper_config.go @@ -38,11 +38,12 @@ func GetScraperConfig(hostInfoProvider hostInfoProvider) *config.ScrapeConfig { InsecureSkipVerify: false, }, }, - ScrapeInterval: model.Duration(collectionInterval), - ScrapeTimeout: model.Duration(collectionInterval), - JobName: jobName, - Scheme: "https", - MetricsPath: scraperMetricsPath, + ScrapeInterval: model.Duration(collectionInterval), + ScrapeTimeout: model.Duration(collectionInterval), + ScrapeProtocols: config.DefaultScrapeProtocols, + JobName: jobName, + Scheme: "https", + MetricsPath: scraperMetricsPath, ServiceDiscoveryConfigs: discovery.Configs{ &kubernetes.SDConfig{ Role: kubernetes.RoleService, diff --git a/receiver/awscontainerinsightreceiver/internal/prometheusscraper/simple_prometheus_scraper.go b/receiver/awscontainerinsightreceiver/internal/prometheusscraper/simple_prometheus_scraper.go index 2f7be0071adf..ff33bb219d59 100644 --- a/receiver/awscontainerinsightreceiver/internal/prometheusscraper/simple_prometheus_scraper.go +++ b/receiver/awscontainerinsightreceiver/internal/prometheusscraper/simple_prometheus_scraper.go @@ -61,6 +61,7 @@ func NewSimplePrometheusScraper(opts SimplePrometheusScraperOpts) (*SimplePromet } params := receiver.CreateSettings{ + ID: component.MustNewID(opts.ScraperConfigs.JobName), TelemetrySettings: opts.TelemetrySettings, } From 50b55d0d45a754d72680c582921e800833c9b929 Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Fri, 3 May 2024 13:22:16 -0400 Subject: [PATCH 2/3] add missing scraper protocols --- .../internal/k8sapiserver/prometheus_scraper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/receiver/awscontainerinsightreceiver/internal/k8sapiserver/prometheus_scraper.go b/receiver/awscontainerinsightreceiver/internal/k8sapiserver/prometheus_scraper.go index b0b0860fe70d..3fe86335e8d9 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8sapiserver/prometheus_scraper.go +++ b/receiver/awscontainerinsightreceiver/internal/k8sapiserver/prometheus_scraper.go @@ -106,6 +106,7 @@ func NewPrometheusScraper(opts PrometheusScraperOpts) (*PrometheusScraper, error }, ScrapeInterval: model.Duration(collectionInterval), ScrapeTimeout: model.Duration(collectionInterval), + ScrapeProtocols: config.DefaultScrapeProtocols, JobName: fmt.Sprintf("%s/%s", jobName, opts.Endpoint), HonorTimestamps: true, Scheme: "https", From 2ec8183d58c5687ea167fbf881de9145330937f9 Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Fri, 3 May 2024 13:23:06 -0400 Subject: [PATCH 3/3] add id --- .../internal/k8sapiserver/prometheus_scraper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/receiver/awscontainerinsightreceiver/internal/k8sapiserver/prometheus_scraper.go b/receiver/awscontainerinsightreceiver/internal/k8sapiserver/prometheus_scraper.go index 3fe86335e8d9..2eba8dd74b96 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8sapiserver/prometheus_scraper.go +++ b/receiver/awscontainerinsightreceiver/internal/k8sapiserver/prometheus_scraper.go @@ -160,6 +160,7 @@ func NewPrometheusScraper(opts PrometheusScraperOpts) (*PrometheusScraper, error } params := receiver.CreateSettings{ + ID: component.MustNewID(jobName), TelemetrySettings: opts.TelemetrySettings, }