From 315c1bff8ced0c814d56f65f4e0d75a98a41135f Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Wed, 15 Nov 2023 15:46:29 -0500 Subject: [PATCH] use binary as fallback deploy mode --- internal/useragent/useragent.go | 4 ++-- internal/useragent/useragent_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/useragent/useragent.go b/internal/useragent/useragent.go index 6627527647f3..bb6043f97aa3 100644 --- a/internal/useragent/useragent.go +++ b/internal/useragent/useragent.go @@ -51,10 +51,10 @@ func getRunMode() string { func getDeployMode() string { op := os.Getenv(deployModeEnv) - // only return known modes + // only return known modes. Use "binary" as a default catch-all. switch op { case "operator", "helm", "docker", "deb", "rpm", "brew": return op } - return "" + return "binary" } diff --git a/internal/useragent/useragent_test.go b/internal/useragent/useragent_test.go index f0706f8a5ebc..abaf0b80d192 100644 --- a/internal/useragent/useragent_test.go +++ b/internal/useragent/useragent_test.go @@ -19,26 +19,26 @@ func TestUserAgent(t *testing.T) { { Name: "basic", Mode: "", - Expected: "GrafanaAgent/v1.2.3 (static; linux)", + Expected: "GrafanaAgent/v1.2.3 (static; linux; binary)", GOOS: "linux", }, { Name: "flow", Mode: "flow", - Expected: "GrafanaAgent/v1.2.3 (flow; windows)", + Expected: "GrafanaAgent/v1.2.3 (flow; windows; binary)", GOOS: "windows", }, { Name: "static", Mode: "static", - Expected: "GrafanaAgent/v1.2.3 (static; darwin)", + Expected: "GrafanaAgent/v1.2.3 (static; darwin; binary)", GOOS: "darwin", }, { Name: "unknown", Mode: "blahlahblah", // unknown mode, should not happen. But we will substitute 'unknown' to avoid allowing arbitrary cardinality. - Expected: "GrafanaAgent/v1.2.3 (unknown; freebsd)", + Expected: "GrafanaAgent/v1.2.3 (unknown; freebsd; binary)", GOOS: "freebsd", }, {