From 72e7a002f209e4aad0b9ec3703fa3d72ebfa9174 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Sep 2025 14:49:27 -0700 Subject: [PATCH 1/3] [exporter/signalfx] Do not validate the root_path of the collector if `sync_host_metadata` is not set --- .chloggen/validate_root_path.yaml | 27 ++++++++++++++++++++++++ exporter/signalfxexporter/config.go | 7 +++--- exporter/signalfxexporter/config_test.go | 9 ++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 .chloggen/validate_root_path.yaml diff --git a/.chloggen/validate_root_path.yaml b/.chloggen/validate_root_path.yaml new file mode 100644 index 0000000000000..fb3d1de367982 --- /dev/null +++ b/.chloggen/validate_root_path.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: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: signalfxexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Do not validate the root_path of the collector if `sync_host_metadata` is not set. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [42688] + +# (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: [] diff --git a/exporter/signalfxexporter/config.go b/exporter/signalfxexporter/config.go index ef52bcdfaccd3..4abb1adbd2466 100644 --- a/exporter/signalfxexporter/config.go +++ b/exporter/signalfxexporter/config.go @@ -228,10 +228,11 @@ func (cfg *Config) Validate() error { return errors.New(`cannot have a negative "timeout"`) } - if err := gopsutilenv.ValidateRootPath(cfg.RootPath); err != nil { - return fmt.Errorf("invalid root_path: %w", err) + if cfg.SyncHostMetadata { + if err := gopsutilenv.ValidateRootPath(cfg.RootPath); err != nil { + return fmt.Errorf("invalid root_path: %w", err) + } } - return nil } diff --git a/exporter/signalfxexporter/config_test.go b/exporter/signalfxexporter/config_test.go index fcf130e9052ef..b34a9d96edd20 100644 --- a/exporter/signalfxexporter/config_test.go +++ b/exporter/signalfxexporter/config_test.go @@ -461,6 +461,15 @@ func TestConfigValidateErrors(t *testing.T) { }, }, }, + { + name: "Invalid root_path", + cfg: &Config{ + Realm: "us0", + AccessToken: "access_token", + RootPath: "/foobar", + SyncHostMetadata: true, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { From 04a7c317bb07a13fbf541b06ac02ae222763e7a8 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Mon, 15 Sep 2025 15:33:18 -0700 Subject: [PATCH 2/3] Update .chloggen/validate_root_path.yaml Co-authored-by: Curtis Robert --- .chloggen/validate_root_path.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/validate_root_path.yaml b/.chloggen/validate_root_path.yaml index fb3d1de367982..e14ec13520b8c 100644 --- a/.chloggen/validate_root_path.yaml +++ b/.chloggen/validate_root_path.yaml @@ -7,7 +7,7 @@ change_type: bug_fix component: signalfxexporter # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Do not validate the root_path of the collector if `sync_host_metadata` is not set. +note: Only validate the root_path of the collector if `sync_host_metadata` is enabled. # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. issues: [42688] From 8460f12e6f62a291ec92815bf452334aeb639c42 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 15 Sep 2025 15:38:39 -0700 Subject: [PATCH 3/3] whitespace --- exporter/signalfxexporter/config_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exporter/signalfxexporter/config_test.go b/exporter/signalfxexporter/config_test.go index b34a9d96edd20..5b731e8dab5fc 100644 --- a/exporter/signalfxexporter/config_test.go +++ b/exporter/signalfxexporter/config_test.go @@ -464,9 +464,9 @@ func TestConfigValidateErrors(t *testing.T) { { name: "Invalid root_path", cfg: &Config{ - Realm: "us0", - AccessToken: "access_token", - RootPath: "/foobar", + Realm: "us0", + AccessToken: "access_token", + RootPath: "/foobar", SyncHostMetadata: true, }, },