From e6e939f03279c5fe4bf777421b52322fcfdc4c61 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Wed, 6 Nov 2024 13:56:05 -0600 Subject: [PATCH 01/16] enable namespaces --- receiver/purefareceiver/README.md | 2 +- receiver/purefareceiver/internal/scraper.go | 4 +++- receiver/purefareceiver/internal/scraperconfig.go | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/receiver/purefareceiver/README.md b/receiver/purefareceiver/README.md index 3be69a70f9ae..0085dca01b12 100644 --- a/receiver/purefareceiver/README.md +++ b/receiver/purefareceiver/README.md @@ -17,7 +17,7 @@ The Pure Storage FlashArray receiver, receives metrics from Pure Storage interna ## Configuration The following settings are required: - - `endpoint` (default: `http://172.0.0.0:9490/metrics/array`): The URL of the scraper selected endpoint + - `endpoint` (default: `http://127.0.0.0:9490/metrics/array`): The URL of the scraper selected endpoint Example: diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index 3788f6c5ea9d..87832ecb826c 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -71,6 +71,7 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac httpConfig := configutil.HTTPClientConfig{} httpConfig.BearerToken = configutil.Secret(bearerToken) + httpConfig.TLSConfig.InsecureSkipVerify = true scrapeConfig := &config.ScrapeConfig{ HTTPClientConfig: httpConfig, @@ -81,7 +82,8 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac Scheme: u.Scheme, MetricsPath: fmt.Sprintf("/metrics/%s", h.scraperType), Params: url.Values{ - "endpoint": {arr.Address}, + "endpoint": {arr.Address}, + "namespace": {arr.Namespace}, }, ServiceDiscoveryConfigs: discovery.Configs{ diff --git a/receiver/purefareceiver/internal/scraperconfig.go b/receiver/purefareceiver/internal/scraperconfig.go index 7cffc48f6571..fee353422e2a 100644 --- a/receiver/purefareceiver/internal/scraperconfig.go +++ b/receiver/purefareceiver/internal/scraperconfig.go @@ -6,6 +6,7 @@ package internal // import "github.com/open-telemetry/opentelemetry-collector-co import "go.opentelemetry.io/collector/config/configauth" type ScraperConfig struct { - Address string `mapstructure:"address"` - Auth configauth.Authentication `mapstructure:"auth"` + Address string `mapstructure:"address"` + Auth configauth.Authentication `mapstructure:"auth"` + Namespace string `mapstructure:"namespace"` } From b86e73bab9073d73f322b9dc74a02bf4395c16b9 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Wed, 6 Nov 2024 15:22:01 -0600 Subject: [PATCH 02/16] add namespace to config --- receiver/purefareceiver/internal/scraper.go | 4 ++-- receiver/purefareceiver/internal/scraperconfig.go | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index 87832ecb826c..d029df734e3c 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -71,10 +71,10 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac httpConfig := configutil.HTTPClientConfig{} httpConfig.BearerToken = configutil.Secret(bearerToken) - httpConfig.TLSConfig.InsecureSkipVerify = true scrapeConfig := &config.ScrapeConfig{ HTTPClientConfig: httpConfig, + ScrapeProtocols: config.DefaultGlobalConfig.ScrapeProtocols, ScrapeInterval: model.Duration(h.scrapeInterval), ScrapeTimeout: model.Duration(h.scrapeInterval), JobName: fmt.Sprintf("%s/%s/%s", "purefa", h.scraperType, arr.Address), @@ -83,7 +83,7 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac MetricsPath: fmt.Sprintf("/metrics/%s", h.scraperType), Params: url.Values{ "endpoint": {arr.Address}, - "namespace": {arr.Namespace}, + "namespace": {"purefa"}, }, ServiceDiscoveryConfigs: discovery.Configs{ diff --git a/receiver/purefareceiver/internal/scraperconfig.go b/receiver/purefareceiver/internal/scraperconfig.go index fee353422e2a..7cffc48f6571 100644 --- a/receiver/purefareceiver/internal/scraperconfig.go +++ b/receiver/purefareceiver/internal/scraperconfig.go @@ -6,7 +6,6 @@ package internal // import "github.com/open-telemetry/opentelemetry-collector-co import "go.opentelemetry.io/collector/config/configauth" type ScraperConfig struct { - Address string `mapstructure:"address"` - Auth configauth.Authentication `mapstructure:"auth"` - Namespace string `mapstructure:"namespace"` + Address string `mapstructure:"address"` + Auth configauth.Authentication `mapstructure:"auth"` } From 3f9e36e0742f1464131f599f75aafa56f99a147e Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Wed, 6 Nov 2024 16:08:53 -0600 Subject: [PATCH 03/16] enable tls insecure for https scrapes --- receiver/purefareceiver/README.md | 31 +++++++++++-------- receiver/purefareceiver/internal/scraper.go | 24 ++++++++------ .../purefareceiver/internal/scraper_test.go | 3 +- receiver/purefareceiver/receiver.go | 10 +++--- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/receiver/purefareceiver/README.md b/receiver/purefareceiver/README.md index dcd38c374a72..6c3953962b66 100644 --- a/receiver/purefareceiver/README.md +++ b/receiver/purefareceiver/README.md @@ -12,12 +12,15 @@ [contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib -The Pure Storage FlashArray receiver, receives metrics from Pure Storage internal services hosts. +The Pure Storage FlashArray receiver, receives metrics from the Pure Storage FlashArray. ## Configuration The following settings are required: - - `endpoint` (default: `http://127.0.0.0:9490/metrics/array`): The URL of the scraper selected endpoint + - `endpoint` (default: `http://127.0.0.0:9490/metrics/array`): The URL of the scraper selected endpoint. + - `fa_array_name` (no default): The array's pretty name to be used as a metrics label. + +In the below examples array01 is using the [Pure Storage FlashArray OpenMetrics exporter](https://github.com/PureStorage-OpenConnect/pure-fa-openmetrics-exporter), while array02 is using the native on-box metrics provided in Purity//FA v6.6.11+. Example: @@ -55,15 +58,17 @@ receivers: env: dev settings: reload_intervals: - array: 10s - hosts: 13s - directories: 15s - pods: 30s - volumes: 25s + array: 20s + hosts: 60s + directories: 60s + pods: 60s + volumes: 60s purefa/array02: fa_array_name: foobar02 - endpoint: http://127.0.0.1:9490/metrics + endpoint: https://127.0.0.1/metrics + tls: + insecure_skip_verify: true array: - address: array02 auth: @@ -87,11 +92,11 @@ receivers: env: production settings: reload_intervals: - array: 15s - hosts: 15s - directories: 15s - pods: 30s - volumes: 25s + array: 20s + hosts: 60s + directories: 60s + pods: 60s + volumes: 60s service: extensions: [bearertokenauth/array01,bearertokenauth/array02] diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index d029df734e3c..9070a00735b0 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -32,26 +32,29 @@ const ( ) type scraper struct { - scraperType ScraperType - endpoint string - configs []ScraperConfig - scrapeInterval time.Duration - labels model.LabelSet + scraperType ScraperType + endpoint string + insecureskipverify bool + configs []ScraperConfig + scrapeInterval time.Duration + labels model.LabelSet } func NewScraper(_ context.Context, scraperType ScraperType, endpoint string, + insecureskipverify bool, configs []ScraperConfig, scrapeInterval time.Duration, labels model.LabelSet, ) Scraper { return &scraper{ - scraperType: scraperType, - endpoint: endpoint, - configs: configs, - scrapeInterval: scrapeInterval, - labels: labels, + scraperType: scraperType, + endpoint: endpoint, + insecureskipverify: insecureskipverify, + configs: configs, + scrapeInterval: scrapeInterval, + labels: labels, } } @@ -71,6 +74,7 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac httpConfig := configutil.HTTPClientConfig{} httpConfig.BearerToken = configutil.Secret(bearerToken) + httpConfig.TLSConfig.InsecureSkipVerify = h.insecureskipverify scrapeConfig := &config.ScrapeConfig{ HTTPClientConfig: httpConfig, diff --git a/receiver/purefareceiver/internal/scraper_test.go b/receiver/purefareceiver/internal/scraper_test.go index 749f7543d386..6c2fb995ac55 100644 --- a/receiver/purefareceiver/internal/scraper_test.go +++ b/receiver/purefareceiver/internal/scraper_test.go @@ -37,6 +37,7 @@ func TestToPrometheusConfig(t *testing.T) { } endpoint := "http://example.com" + insecureskipverify := false interval := 15 * time.Second cfgs := []ScraperConfig{ { @@ -47,7 +48,7 @@ func TestToPrometheusConfig(t *testing.T) { }, } - scraper := NewScraper(context.Background(), "hosts", endpoint, cfgs, interval, model.LabelSet{}) + scraper := NewScraper(context.Background(), "hosts", endpoint, insecureskipverify, cfgs, interval, model.LabelSet{}) // test scCfgs, err := scraper.ToPrometheusReceiverConfig(host, prFactory) diff --git a/receiver/purefareceiver/receiver.go b/receiver/purefareceiver/receiver.go index ad2b9bec5c9e..e6fb8de5301b 100644 --- a/receiver/purefareceiver/receiver.go +++ b/receiver/purefareceiver/receiver.go @@ -53,35 +53,35 @@ func (r *purefaReceiver) Start(ctx context.Context, compHost component.Host) err "fa_array_name": ArrayName, } - arrScraper := internal.NewScraper(ctx, internal.ScraperTypeArray, r.cfg.Endpoint, r.cfg.Array, r.cfg.Settings.ReloadIntervals.Array, commomLabel) + arrScraper := internal.NewScraper(ctx, internal.ScraperTypeArray, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Array, r.cfg.Settings.ReloadIntervals.Array, commomLabel) if scCfgs, err := arrScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - hostScraper := internal.NewScraper(ctx, internal.ScraperTypeHosts, r.cfg.Endpoint, r.cfg.Hosts, r.cfg.Settings.ReloadIntervals.Hosts, labelSet) + hostScraper := internal.NewScraper(ctx, internal.ScraperTypeHosts, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Hosts, r.cfg.Settings.ReloadIntervals.Hosts, labelSet) if scCfgs, err := hostScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - directoriesScraper := internal.NewScraper(ctx, internal.ScraperTypeDirectories, r.cfg.Endpoint, r.cfg.Directories, r.cfg.Settings.ReloadIntervals.Directories, commomLabel) + directoriesScraper := internal.NewScraper(ctx, internal.ScraperTypeDirectories, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Directories, r.cfg.Settings.ReloadIntervals.Directories, commomLabel) if scCfgs, err := directoriesScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - podsScraper := internal.NewScraper(ctx, internal.ScraperTypePods, r.cfg.Endpoint, r.cfg.Pods, r.cfg.Settings.ReloadIntervals.Pods, commomLabel) + podsScraper := internal.NewScraper(ctx, internal.ScraperTypePods, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Pods, r.cfg.Settings.ReloadIntervals.Pods, commomLabel) if scCfgs, err := podsScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - volumesScraper := internal.NewScraper(ctx, internal.ScraperTypeVolumes, r.cfg.Endpoint, r.cfg.Volumes, r.cfg.Settings.ReloadIntervals.Volumes, labelSet) + volumesScraper := internal.NewScraper(ctx, internal.ScraperTypeVolumes, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Volumes, r.cfg.Settings.ReloadIntervals.Volumes, labelSet) if scCfgs, err := volumesScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { From ff0c0e658e0296ca9abc5538ac503f8ccaa02b9e Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Wed, 6 Nov 2024 16:21:34 -0600 Subject: [PATCH 04/16] Create 36251-purefa-native-om-support.yaml --- .chloggen/36251-purefa-native-om-support.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .chloggen/36251-purefa-native-om-support.yaml diff --git a/.chloggen/36251-purefa-native-om-support.yaml b/.chloggen/36251-purefa-native-om-support.yaml new file mode 100644 index 000000000000..82f3cd5f2e11 --- /dev/null +++ b/.chloggen/36251-purefa-native-om-support.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: 'enhancement' + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: purefareceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Implements support for scraping Pure Storage FlashArray with Purity version 6.6.11+ + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [36251] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] From ef1ea5e4953b63a93fe75a9eb196edd1f30c8880 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Wed, 6 Nov 2024 21:36:11 -0600 Subject: [PATCH 05/16] added namespace config and tls insecurity tests --- receiver/purefareceiver/config.go | 8 +++++++- receiver/purefareceiver/config_test.go | 11 ++++++----- receiver/purefareceiver/factory.go | 11 ++++++----- receiver/purefareceiver/internal/scraper.go | 5 ++++- receiver/purefareceiver/internal/scraper_test.go | 7 +++++-- receiver/purefareceiver/receiver.go | 10 +++++----- receiver/purefareceiver/testdata/config.yaml | 1 + 7 files changed, 34 insertions(+), 19 deletions(-) diff --git a/receiver/purefareceiver/config.go b/receiver/purefareceiver/config.go index fe2d0b9e3562..1bde48af1fb8 100644 --- a/receiver/purefareceiver/config.go +++ b/receiver/purefareceiver/config.go @@ -41,8 +41,11 @@ type Config struct { // Env represents the respective environment value valid to scrape Env string `mapstructure:"env"` - // ArrayName represents the display name that is appended to the received metrics, as the `host` label if not provided by OpenMetrics output, and to the `fa_array_name` label always. + // ArrayName represents the display name that is appended to the received metrics, as the `host` label if not provided by OpenMetrics output, and to the `fa_array_name` label always ArrayName string `mapstructure:"fa_array_name"` + + // Namespace selects the OpenMetrics namespace requested + Namespace string `mapstructure:"namespace"` } type Settings struct { @@ -63,6 +66,9 @@ func (c *Config) Validate() error { if c.ArrayName == "" { errs = multierr.Append(errs, errors.New("the array's pretty name as 'fa_array_name' must be provided")) } + if c.Namespace == "" { + errs = multierr.Append(errs, errors.New("a specified namespace must be provided")) + } if c.Settings.ReloadIntervals.Array == 0 { errs = multierr.Append(errs, errors.New("reload interval for 'array' must be provided")) } diff --git a/receiver/purefareceiver/config_test.go b/receiver/purefareceiver/config_test.go index 5dfb36922521..7562fbc31fde 100644 --- a/receiver/purefareceiver/config_test.go +++ b/receiver/purefareceiver/config_test.go @@ -30,13 +30,14 @@ func TestLoadConfig(t *testing.T) { id: component.NewID(metadata.Type), expected: &Config{ ArrayName: "foobar.example.com", + Namespace: "purefa", Settings: &Settings{ ReloadIntervals: &ReloadIntervals{ - Array: 15 * time.Second, - Hosts: 15 * time.Second, - Directories: 15 * time.Second, - Pods: 15 * time.Second, - Volumes: 15 * time.Second, + Array: 60 * time.Second, + Hosts: 60 * time.Second, + Directories: 60 * time.Second, + Pods: 60 * time.Second, + Volumes: 60 * time.Second, }, }, }, diff --git a/receiver/purefareceiver/factory.go b/receiver/purefareceiver/factory.go index 90a8c2578430..0c15a29f2f99 100644 --- a/receiver/purefareceiver/factory.go +++ b/receiver/purefareceiver/factory.go @@ -29,14 +29,15 @@ func NewFactory() receiver.Factory { func createDefaultConfig() component.Config { return &Config{ ArrayName: "foobar.example.com", + Namespace: "purefa", ClientConfig: confighttp.ClientConfig{}, Settings: &Settings{ ReloadIntervals: &ReloadIntervals{ - Array: 15 * time.Second, - Hosts: 15 * time.Second, - Directories: 15 * time.Second, - Pods: 15 * time.Second, - Volumes: 15 * time.Second, + Array: 60 * time.Second, + Hosts: 60 * time.Second, + Directories: 60 * time.Second, + Pods: 60 * time.Second, + Volumes: 60 * time.Second, }, }, } diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index 9070a00735b0..e7ff93345af9 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -34,6 +34,7 @@ const ( type scraper struct { scraperType ScraperType endpoint string + namespace string insecureskipverify bool configs []ScraperConfig scrapeInterval time.Duration @@ -43,6 +44,7 @@ type scraper struct { func NewScraper(_ context.Context, scraperType ScraperType, endpoint string, + namespace string, insecureskipverify bool, configs []ScraperConfig, scrapeInterval time.Duration, @@ -51,6 +53,7 @@ func NewScraper(_ context.Context, return &scraper{ scraperType: scraperType, endpoint: endpoint, + namespace: namespace, insecureskipverify: insecureskipverify, configs: configs, scrapeInterval: scrapeInterval, @@ -87,7 +90,7 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac MetricsPath: fmt.Sprintf("/metrics/%s", h.scraperType), Params: url.Values{ "endpoint": {arr.Address}, - "namespace": {"purefa"}, + "namespace": {h.namespace}, }, ServiceDiscoveryConfigs: discovery.Configs{ diff --git a/receiver/purefareceiver/internal/scraper_test.go b/receiver/purefareceiver/internal/scraper_test.go index 6c2fb995ac55..1954eaab2dce 100644 --- a/receiver/purefareceiver/internal/scraper_test.go +++ b/receiver/purefareceiver/internal/scraper_test.go @@ -37,7 +37,8 @@ func TestToPrometheusConfig(t *testing.T) { } endpoint := "http://example.com" - insecureskipverify := false + namespace := "purefa" + insecureskipverify := true interval := 15 * time.Second cfgs := []ScraperConfig{ { @@ -48,7 +49,7 @@ func TestToPrometheusConfig(t *testing.T) { }, } - scraper := NewScraper(context.Background(), "hosts", endpoint, insecureskipverify, cfgs, interval, model.LabelSet{}) + scraper := NewScraper(context.Background(), "hosts", endpoint, namespace, insecureskipverify, cfgs, interval, model.LabelSet{}) // test scCfgs, err := scraper.ToPrometheusReceiverConfig(host, prFactory) @@ -56,7 +57,9 @@ func TestToPrometheusConfig(t *testing.T) { // verify assert.NoError(t, err) assert.Len(t, scCfgs, 1) + assert.EqualValues(t, "purefa", scCfgs[0].Params.Get("namespace")) assert.EqualValues(t, "the-token", scCfgs[0].HTTPClientConfig.BearerToken) + assert.True(t, true, scCfgs[0].HTTPClientConfig.TLSConfig.InsecureSkipVerify) assert.Equal(t, "array01", scCfgs[0].Params.Get("endpoint")) assert.Equal(t, "/metrics/hosts", scCfgs[0].MetricsPath) assert.Equal(t, "purefa/hosts/array01", scCfgs[0].JobName) diff --git a/receiver/purefareceiver/receiver.go b/receiver/purefareceiver/receiver.go index e6fb8de5301b..8836253e8cb0 100644 --- a/receiver/purefareceiver/receiver.go +++ b/receiver/purefareceiver/receiver.go @@ -53,35 +53,35 @@ func (r *purefaReceiver) Start(ctx context.Context, compHost component.Host) err "fa_array_name": ArrayName, } - arrScraper := internal.NewScraper(ctx, internal.ScraperTypeArray, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Array, r.cfg.Settings.ReloadIntervals.Array, commomLabel) + arrScraper := internal.NewScraper(ctx, internal.ScraperTypeArray, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Array, r.cfg.Settings.ReloadIntervals.Array, commomLabel) if scCfgs, err := arrScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - hostScraper := internal.NewScraper(ctx, internal.ScraperTypeHosts, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Hosts, r.cfg.Settings.ReloadIntervals.Hosts, labelSet) + hostScraper := internal.NewScraper(ctx, internal.ScraperTypeHosts, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Hosts, r.cfg.Settings.ReloadIntervals.Hosts, labelSet) if scCfgs, err := hostScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - directoriesScraper := internal.NewScraper(ctx, internal.ScraperTypeDirectories, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Directories, r.cfg.Settings.ReloadIntervals.Directories, commomLabel) + directoriesScraper := internal.NewScraper(ctx, internal.ScraperTypeDirectories, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Directories, r.cfg.Settings.ReloadIntervals.Directories, commomLabel) if scCfgs, err := directoriesScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - podsScraper := internal.NewScraper(ctx, internal.ScraperTypePods, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Pods, r.cfg.Settings.ReloadIntervals.Pods, commomLabel) + podsScraper := internal.NewScraper(ctx, internal.ScraperTypePods, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Pods, r.cfg.Settings.ReloadIntervals.Pods, commomLabel) if scCfgs, err := podsScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - volumesScraper := internal.NewScraper(ctx, internal.ScraperTypeVolumes, r.cfg.Endpoint, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Volumes, r.cfg.Settings.ReloadIntervals.Volumes, labelSet) + volumesScraper := internal.NewScraper(ctx, internal.ScraperTypeVolumes, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Volumes, r.cfg.Settings.ReloadIntervals.Volumes, labelSet) if scCfgs, err := volumesScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { diff --git a/receiver/purefareceiver/testdata/config.yaml b/receiver/purefareceiver/testdata/config.yaml index 6bb13a8f1e8f..ed99af405911 100644 --- a/receiver/purefareceiver/testdata/config.yaml +++ b/receiver/purefareceiver/testdata/config.yaml @@ -5,6 +5,7 @@ receivers: purefa/with_custom_intervals: fa_array_name: foobar.example.com + namespace: purefa endpoint: http://172.31.60.208:9490/metrics array: - address: array01 From 99fe3e9086be49d1217c540adb3e19ba7725c289 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Wed, 6 Nov 2024 22:24:19 -0600 Subject: [PATCH 06/16] fix scraper test --- receiver/purefareceiver/internal/scraper_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/purefareceiver/internal/scraper_test.go b/receiver/purefareceiver/internal/scraper_test.go index 1954eaab2dce..d264f359b8cf 100644 --- a/receiver/purefareceiver/internal/scraper_test.go +++ b/receiver/purefareceiver/internal/scraper_test.go @@ -59,7 +59,7 @@ func TestToPrometheusConfig(t *testing.T) { assert.Len(t, scCfgs, 1) assert.EqualValues(t, "purefa", scCfgs[0].Params.Get("namespace")) assert.EqualValues(t, "the-token", scCfgs[0].HTTPClientConfig.BearerToken) - assert.True(t, true, scCfgs[0].HTTPClientConfig.TLSConfig.InsecureSkipVerify) + assert.True(t, scCfgs[0].HTTPClientConfig.TLSConfig.InsecureSkipVerify) assert.Equal(t, "array01", scCfgs[0].Params.Get("endpoint")) assert.Equal(t, "/metrics/hosts", scCfgs[0].MetricsPath) assert.Equal(t, "purefa/hosts/array01", scCfgs[0].JobName) From cf6065e9154c342ba2e6967a61d873e9fc984e97 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Thu, 7 Nov 2024 08:23:12 -0600 Subject: [PATCH 07/16] Added Test for Scrape Protocols in Scraper --- receiver/purefareceiver/internal/scraper_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/receiver/purefareceiver/internal/scraper_test.go b/receiver/purefareceiver/internal/scraper_test.go index d264f359b8cf..9b8f51dcb4ab 100644 --- a/receiver/purefareceiver/internal/scraper_test.go +++ b/receiver/purefareceiver/internal/scraper_test.go @@ -57,6 +57,7 @@ func TestToPrometheusConfig(t *testing.T) { // verify assert.NoError(t, err) assert.Len(t, scCfgs, 1) + assert.NotNil(t, scCfgs[0].ScrapeProtocols) assert.EqualValues(t, "purefa", scCfgs[0].Params.Get("namespace")) assert.EqualValues(t, "the-token", scCfgs[0].HTTPClientConfig.BearerToken) assert.True(t, scCfgs[0].HTTPClientConfig.TLSConfig.InsecureSkipVerify) From d42be0174dfaad5a310bcee625344dbf4fca4ac0 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Thu, 7 Nov 2024 14:28:57 -0600 Subject: [PATCH 08/16] correct scrape protocol --- receiver/purefareceiver/internal/scraper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index e7ff93345af9..248252216eac 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -81,7 +81,7 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac scrapeConfig := &config.ScrapeConfig{ HTTPClientConfig: httpConfig, - ScrapeProtocols: config.DefaultGlobalConfig.ScrapeProtocols, + ScrapeProtocols: config.DefaultScrapeProtocols, ScrapeInterval: model.Duration(h.scrapeInterval), ScrapeTimeout: model.Duration(h.scrapeInterval), JobName: fmt.Sprintf("%s/%s/%s", "purefa", h.scraperType, arr.Address), From 6c880df79d6ee8a29cf58cd916749384a188ea85 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Mon, 25 Nov 2024 11:44:11 -0600 Subject: [PATCH 09/16] Update README.md --- receiver/purefareceiver/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/receiver/purefareceiver/README.md b/receiver/purefareceiver/README.md index 6c3953962b66..48af5f922bf4 100644 --- a/receiver/purefareceiver/README.md +++ b/receiver/purefareceiver/README.md @@ -19,6 +19,7 @@ The Pure Storage FlashArray receiver, receives metrics from the Pure Storage Fla The following settings are required: - `endpoint` (default: `http://127.0.0.0:9490/metrics/array`): The URL of the scraper selected endpoint. - `fa_array_name` (no default): The array's pretty name to be used as a metrics label. + - `namespace` (default:purefa): The selected Pure Storage OpenMetrics Namespace to query. In the below examples array01 is using the [Pure Storage FlashArray OpenMetrics exporter](https://github.com/PureStorage-OpenConnect/pure-fa-openmetrics-exporter), while array02 is using the native on-box metrics provided in Purity//FA v6.6.11+. From aa86063d9933b74806e044d5f8f8f2ab16d33d77 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Wed, 27 Nov 2024 10:01:42 -0600 Subject: [PATCH 10/16] Implement tlssettings strut maps --- receiver/purefareceiver/internal/scraper.go | 42 ++++++++++++------- .../purefareceiver/internal/scraper_test.go | 14 ++++--- receiver/purefareceiver/receiver.go | 10 ++--- 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index 248252216eac..2472b61303a3 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -14,6 +14,7 @@ import ( "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/discovery" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/receiver" ) @@ -32,32 +33,32 @@ const ( ) type scraper struct { - scraperType ScraperType - endpoint string - namespace string - insecureskipverify bool - configs []ScraperConfig - scrapeInterval time.Duration - labels model.LabelSet + scraperType ScraperType + endpoint string + namespace string + tlsSettings configtls.ClientConfig + configs []ScraperConfig + scrapeInterval time.Duration + labels model.LabelSet } func NewScraper(_ context.Context, scraperType ScraperType, endpoint string, namespace string, - insecureskipverify bool, + tlsSettings configtls.ClientConfig, configs []ScraperConfig, scrapeInterval time.Duration, labels model.LabelSet, ) Scraper { return &scraper{ - scraperType: scraperType, - endpoint: endpoint, - namespace: namespace, - insecureskipverify: insecureskipverify, - configs: configs, - scrapeInterval: scrapeInterval, - labels: labels, + scraperType: scraperType, + endpoint: endpoint, + namespace: namespace, + tlsSettings: tlsSettings, + configs: configs, + scrapeInterval: scrapeInterval, + labels: labels, } } @@ -77,7 +78,16 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac httpConfig := configutil.HTTPClientConfig{} httpConfig.BearerToken = configutil.Secret(bearerToken) - httpConfig.TLSConfig.InsecureSkipVerify = h.insecureskipverify + httpConfig.TLSConfig = configutil.TLSConfig{ + CAFile: h.tlsSettings.CAFile, + CA: h.tlsSettings.CAPem.String(), + CertFile: h.tlsSettings.CertFile, + Cert: h.tlsSettings.CertPem.GoString(), + KeyFile: h.tlsSettings.KeyFile, + Key: configutil.Secret(h.tlsSettings.KeyPem), + InsecureSkipVerify: h.tlsSettings.InsecureSkipVerify, + ServerName: h.tlsSettings.ServerName, + } scrapeConfig := &config.ScrapeConfig{ HTTPClientConfig: httpConfig, diff --git a/receiver/purefareceiver/internal/scraper_test.go b/receiver/purefareceiver/internal/scraper_test.go index 9b8f51dcb4ab..20322672acab 100644 --- a/receiver/purefareceiver/internal/scraper_test.go +++ b/receiver/purefareceiver/internal/scraper_test.go @@ -8,15 +8,15 @@ import ( "testing" "time" + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configauth" + "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/extension/extensiontest" - - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" ) func TestToPrometheusConfig(t *testing.T) { @@ -38,7 +38,10 @@ func TestToPrometheusConfig(t *testing.T) { endpoint := "http://example.com" namespace := "purefa" - insecureskipverify := true + tlsSettings := configtls.ClientConfig{ + InsecureSkipVerify: true, + ServerName: "TestThisServerName", + } interval := 15 * time.Second cfgs := []ScraperConfig{ { @@ -49,7 +52,7 @@ func TestToPrometheusConfig(t *testing.T) { }, } - scraper := NewScraper(context.Background(), "hosts", endpoint, namespace, insecureskipverify, cfgs, interval, model.LabelSet{}) + scraper := NewScraper(context.Background(), "hosts", endpoint, namespace, tlsSettings, cfgs, interval, model.LabelSet{}) // test scCfgs, err := scraper.ToPrometheusReceiverConfig(host, prFactory) @@ -61,6 +64,7 @@ func TestToPrometheusConfig(t *testing.T) { assert.EqualValues(t, "purefa", scCfgs[0].Params.Get("namespace")) assert.EqualValues(t, "the-token", scCfgs[0].HTTPClientConfig.BearerToken) assert.True(t, scCfgs[0].HTTPClientConfig.TLSConfig.InsecureSkipVerify) + assert.Equal(t, "TestThisServerName", scCfgs[0].HTTPClientConfig.TLSConfig.ServerName) assert.Equal(t, "array01", scCfgs[0].Params.Get("endpoint")) assert.Equal(t, "/metrics/hosts", scCfgs[0].MetricsPath) assert.Equal(t, "purefa/hosts/array01", scCfgs[0].JobName) diff --git a/receiver/purefareceiver/receiver.go b/receiver/purefareceiver/receiver.go index 8836253e8cb0..af17a41b5f16 100644 --- a/receiver/purefareceiver/receiver.go +++ b/receiver/purefareceiver/receiver.go @@ -53,35 +53,35 @@ func (r *purefaReceiver) Start(ctx context.Context, compHost component.Host) err "fa_array_name": ArrayName, } - arrScraper := internal.NewScraper(ctx, internal.ScraperTypeArray, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Array, r.cfg.Settings.ReloadIntervals.Array, commomLabel) + arrScraper := internal.NewScraper(ctx, internal.ScraperTypeArray, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting, r.cfg.Array, r.cfg.Settings.ReloadIntervals.Array, commomLabel) if scCfgs, err := arrScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - hostScraper := internal.NewScraper(ctx, internal.ScraperTypeHosts, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Hosts, r.cfg.Settings.ReloadIntervals.Hosts, labelSet) + hostScraper := internal.NewScraper(ctx, internal.ScraperTypeHosts, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting, r.cfg.Hosts, r.cfg.Settings.ReloadIntervals.Hosts, labelSet) if scCfgs, err := hostScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - directoriesScraper := internal.NewScraper(ctx, internal.ScraperTypeDirectories, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Directories, r.cfg.Settings.ReloadIntervals.Directories, commomLabel) + directoriesScraper := internal.NewScraper(ctx, internal.ScraperTypeDirectories, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting, r.cfg.Directories, r.cfg.Settings.ReloadIntervals.Directories, commomLabel) if scCfgs, err := directoriesScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - podsScraper := internal.NewScraper(ctx, internal.ScraperTypePods, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Pods, r.cfg.Settings.ReloadIntervals.Pods, commomLabel) + podsScraper := internal.NewScraper(ctx, internal.ScraperTypePods, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting, r.cfg.Pods, r.cfg.Settings.ReloadIntervals.Pods, commomLabel) if scCfgs, err := podsScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { return err } - volumesScraper := internal.NewScraper(ctx, internal.ScraperTypeVolumes, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting.InsecureSkipVerify, r.cfg.Volumes, r.cfg.Settings.ReloadIntervals.Volumes, labelSet) + volumesScraper := internal.NewScraper(ctx, internal.ScraperTypeVolumes, r.cfg.Endpoint, r.cfg.Namespace, r.cfg.TLSSetting, r.cfg.Volumes, r.cfg.Settings.ReloadIntervals.Volumes, labelSet) if scCfgs, err := volumesScraper.ToPrometheusReceiverConfig(compHost, fact); err == nil { scrapeCfgs = append(scrapeCfgs, scCfgs...) } else { From 7662adef7a5931786b859a0e1b278eb0db0d49ce Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Wed, 27 Nov 2024 10:05:18 -0600 Subject: [PATCH 11/16] Update scraper.go --- receiver/purefareceiver/internal/scraper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index 2472b61303a3..d133fdd37837 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -82,7 +82,7 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac CAFile: h.tlsSettings.CAFile, CA: h.tlsSettings.CAPem.String(), CertFile: h.tlsSettings.CertFile, - Cert: h.tlsSettings.CertPem.GoString(), + Cert: h.tlsSettings.CertPem.String(), KeyFile: h.tlsSettings.KeyFile, Key: configutil.Secret(h.tlsSettings.KeyPem), InsecureSkipVerify: h.tlsSettings.InsecureSkipVerify, From 03b98d399586e3a2e66d09f792175565b56f4062 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Fri, 29 Nov 2024 08:29:41 -0600 Subject: [PATCH 12/16] Update factory.go --- receiver/purefareceiver/factory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/purefareceiver/factory.go b/receiver/purefareceiver/factory.go index c5d8ec5d6b1c..6ebae400dda3 100644 --- a/receiver/purefareceiver/factory.go +++ b/receiver/purefareceiver/factory.go @@ -30,7 +30,7 @@ func createDefaultConfig() component.Config { return &Config{ ArrayName: "foobar.example.com", Namespace: "purefa", - ClientConfig: confighttp.NewDefaultClientConfig(), + ClientConfig: confighttp.NewDefaultClientConfig(), Settings: &Settings{ ReloadIntervals: &ReloadIntervals{ Array: 60 * time.Second, From 2f506f137c1778f9707f2edc91a745cbdc3adc5f Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Mon, 2 Dec 2024 09:29:59 -0600 Subject: [PATCH 13/16] go tidy --- receiver/purefareceiver/config_test.go | 2 +- receiver/purefareceiver/go.mod | 2 +- receiver/purefareceiver/internal/scraper_test.go | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/receiver/purefareceiver/config_test.go b/receiver/purefareceiver/config_test.go index 695961b7ebba..8c7799b648d9 100644 --- a/receiver/purefareceiver/config_test.go +++ b/receiver/purefareceiver/config_test.go @@ -34,7 +34,7 @@ func TestLoadConfig(t *testing.T) { expected: &Config{ ClientConfig: clientConfig, ArrayName: "foobar.example.com", - Namespace: "purefa", + Namespace: "purefa", Settings: &Settings{ ReloadIntervals: &ReloadIntervals{ Array: 60 * time.Second, diff --git a/receiver/purefareceiver/go.mod b/receiver/purefareceiver/go.mod index 12db31a3fcfa..005890cb34d3 100644 --- a/receiver/purefareceiver/go.mod +++ b/receiver/purefareceiver/go.mod @@ -12,6 +12,7 @@ require ( go.opentelemetry.io/collector/component/componenttest v0.114.0 go.opentelemetry.io/collector/config/configauth v0.114.0 go.opentelemetry.io/collector/config/confighttp v0.114.0 + go.opentelemetry.io/collector/config/configtls v1.20.0 go.opentelemetry.io/collector/confmap v1.20.0 go.opentelemetry.io/collector/consumer v0.114.0 go.opentelemetry.io/collector/consumer/consumertest v0.114.0 @@ -144,7 +145,6 @@ require ( go.opentelemetry.io/collector/config/configcompression v1.20.0 // indirect go.opentelemetry.io/collector/config/configopaque v1.20.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.114.0 // indirect - go.opentelemetry.io/collector/config/configtls v1.20.0 // indirect go.opentelemetry.io/collector/config/internal v0.114.0 // indirect go.opentelemetry.io/collector/consumer/consumererror v0.114.0 // indirect go.opentelemetry.io/collector/consumer/consumerprofiles v0.114.0 // indirect diff --git a/receiver/purefareceiver/internal/scraper_test.go b/receiver/purefareceiver/internal/scraper_test.go index 20322672acab..7a0cedce074b 100644 --- a/receiver/purefareceiver/internal/scraper_test.go +++ b/receiver/purefareceiver/internal/scraper_test.go @@ -8,8 +8,6 @@ import ( "testing" "time" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" "github.com/prometheus/common/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -17,6 +15,9 @@ import ( "go.opentelemetry.io/collector/config/configauth" "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/extension/extensiontest" + + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/bearertokenauthextension" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" ) func TestToPrometheusConfig(t *testing.T) { From 377d56716e7b2815ca0bfcf64866963052195ca2 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Mon, 2 Dec 2024 17:08:46 -0600 Subject: [PATCH 14/16] Update go.mod --- receiver/purefareceiver/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/purefareceiver/go.mod b/receiver/purefareceiver/go.mod index 972c866ce17b..effb5a513c12 100644 --- a/receiver/purefareceiver/go.mod +++ b/receiver/purefareceiver/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/collector/component/componenttest v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/config/configauth v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/config/confighttp v0.114.1-0.20241130171227-c52d625647be - go.opentelemetry.io/collector/config/configtls v1.20.1-0.20241130171227-c52d625647be // indirect + go.opentelemetry.io/collector/config/configtls v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/confmap v1.20.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/consumer v0.114.1-0.20241130171227-c52d625647be go.opentelemetry.io/collector/consumer/consumertest v0.114.1-0.20241130171227-c52d625647be From c052b55ef7dd32432c310184f1b419608658f468 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Mon, 9 Dec 2024 10:17:30 -0600 Subject: [PATCH 15/16] update prom config --- receiver/purefareceiver/go.mod | 2 +- receiver/purefareceiver/internal/scraper.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/receiver/purefareceiver/go.mod b/receiver/purefareceiver/go.mod index 149b70a7f119..a04e98db10b9 100644 --- a/receiver/purefareceiver/go.mod +++ b/receiver/purefareceiver/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/collector/component/componenttest v0.115.0 go.opentelemetry.io/collector/config/configauth v0.115.0 go.opentelemetry.io/collector/config/confighttp v0.115.0 - go.opentelemetry.io/collector/config/configtls v1.20.1 + go.opentelemetry.io/collector/config/configtls v1.21.0 go.opentelemetry.io/collector/confmap v1.21.0 go.opentelemetry.io/collector/consumer v1.21.0 go.opentelemetry.io/collector/consumer/consumertest v0.115.0 diff --git a/receiver/purefareceiver/internal/scraper.go b/receiver/purefareceiver/internal/scraper.go index d133fdd37837..ac205ce4c49b 100644 --- a/receiver/purefareceiver/internal/scraper.go +++ b/receiver/purefareceiver/internal/scraper.go @@ -80,11 +80,8 @@ func (h *scraper) ToPrometheusReceiverConfig(host component.Host, _ receiver.Fac httpConfig.BearerToken = configutil.Secret(bearerToken) httpConfig.TLSConfig = configutil.TLSConfig{ CAFile: h.tlsSettings.CAFile, - CA: h.tlsSettings.CAPem.String(), CertFile: h.tlsSettings.CertFile, - Cert: h.tlsSettings.CertPem.String(), KeyFile: h.tlsSettings.KeyFile, - Key: configutil.Secret(h.tlsSettings.KeyPem), InsecureSkipVerify: h.tlsSettings.InsecureSkipVerify, ServerName: h.tlsSettings.ServerName, } From 26fc94562c8e6544ae4d1aa44d5b21d5c36a7cb9 Mon Sep 17 00:00:00 2001 From: Christopher Roberts Date: Tue, 10 Dec 2024 10:17:10 -0600 Subject: [PATCH 16/16] Update go.mod --- receiver/purefareceiver/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/purefareceiver/go.mod b/receiver/purefareceiver/go.mod index 8be170fbefe8..5e8117ed84ef 100644 --- a/receiver/purefareceiver/go.mod +++ b/receiver/purefareceiver/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/collector/component/componenttest v0.115.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/config/configauth v0.115.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/config/confighttp v0.115.1-0.20241206185113-3f3e208e71b8 - go.opentelemetry.io/collector/config/configtls v1.21.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/config/configtls v1.21.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/confmap v1.21.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/consumer v1.21.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/consumer/consumertest v0.115.1-0.20241206185113-3f3e208e71b8