From 9ffe0d8143884a6162a1a8fa678610a1b5d36bcc Mon Sep 17 00:00:00 2001 From: Nageshbansal <76246968+Nageshbansal@users.noreply.github.com> Date: Tue, 30 Sep 2025 16:31:43 +0530 Subject: [PATCH] chore(statsreporter): add nomad, vultr, aca platform detection (#9220) --- pkg/version/deployment.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/version/deployment.go b/pkg/version/deployment.go index f1ba092998ce..fd5c05ab1fff 100644 --- a/pkg/version/deployment.go +++ b/pkg/version/deployment.go @@ -110,6 +110,10 @@ func detectPlatform() string { return "railway" case os.Getenv("ECS_CONTAINER_METADATA_URI_V4") != "": return "ecs" + case os.Getenv("NOMAD_ALLOC_ID") != "": + return "nomad" + case os.Getenv("CONTAINER_APP_HOSTNAME") != "": + return "aca" } // Try to detect cloud provider through metadata endpoints @@ -157,6 +161,16 @@ func detectPlatform() string { } } + // Vultr metadata + if req, err := http.NewRequest(http.MethodGet, "http://169.254.169.254/v1/hostname", nil); err == nil { + if resp, err := client.Do(req); err == nil { + resp.Body.Close() + if resp.StatusCode == 200 { + return "vultr" + } + } + } + // Hetzner metadata if req, err := http.NewRequest(http.MethodGet, "http://169.254.169.254/hetzner/v1/metadata", nil); err == nil { if resp, err := client.Do(req); err == nil {