mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
chore(statsreporter): add nomad, vultr, aca platform detection (#9220)
This commit is contained in:
parent
1a1ef5aff8
commit
9ffe0d8143
@ -110,6 +110,10 @@ func detectPlatform() string {
|
|||||||
return "railway"
|
return "railway"
|
||||||
case os.Getenv("ECS_CONTAINER_METADATA_URI_V4") != "":
|
case os.Getenv("ECS_CONTAINER_METADATA_URI_V4") != "":
|
||||||
return "ecs"
|
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
|
// 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
|
// Hetzner metadata
|
||||||
if req, err := http.NewRequest(http.MethodGet, "http://169.254.169.254/hetzner/v1/metadata", nil); err == nil {
|
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 {
|
if resp, err := client.Do(req); err == nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user