mirror of
https://github.com/openfaas/faas.git
synced 2025-06-08 16:26:47 +00:00
Update error handling for empty metrics responses in exporter
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
This commit is contained in:
parent
667577f3ce
commit
b22cb639fe
@ -167,7 +167,9 @@ func (e *Exporter) getFunctions(endpointURL url.URL, namespace string) ([]types.
|
||||
} else {
|
||||
body = b
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if len(body) == 0 {
|
||||
return services, fmt.Errorf("no response body from /system/functions")
|
||||
}
|
||||
|
||||
@ -211,6 +213,10 @@ func (e *Exporter) getNamespaces(endpointURL url.URL) ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if len(body) == 0 {
|
||||
return namespaces, fmt.Errorf("no response body from /system/namespaces")
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(body, &namespaces); err != nil {
|
||||
return namespaces, fmt.Errorf("error unmarshalling response: %s, error: %s", string(body), err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user