chore(statsreporter): add nomad, vultr, aca platform detection (#9220)

This commit is contained in:
Nageshbansal 2025-09-30 16:31:43 +05:30 committed by GitHub
parent 1a1ef5aff8
commit 9ffe0d8143
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {