mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 08:46:48 +00:00
Unmarshall the service name
This commit is contained in:
parent
158c412251
commit
cf2317696d
@ -22,7 +22,18 @@ type AlexaRequestBody struct {
|
||||
Request AlexaRequest `json:"request"`
|
||||
}
|
||||
|
||||
type PrometheusAlert struct {
|
||||
Status string `json:"status"`
|
||||
Receiver string `json:"receiver"`
|
||||
type PrometheusInnerAlertLabel struct {
|
||||
AlertName string `json:"alertname"`
|
||||
FunctionName string `json:"function_name"`
|
||||
}
|
||||
|
||||
type PrometheusInnerAlert struct {
|
||||
Status string `json:"status"`
|
||||
Labels PrometheusInnerAlertLabel `json:"labels"`
|
||||
}
|
||||
|
||||
type PrometheusAlert struct {
|
||||
Status string `json:"status"`
|
||||
Receiver string `json:"receiver"`
|
||||
Alerts []PrometheusInnerAlert `json:"alerts"`
|
||||
}
|
||||
|
@ -26,4 +26,14 @@ func TestUnmarshallAlert(t *testing.T) {
|
||||
if (len(alert.Receiver)) == 0 {
|
||||
t.Fatal("No status read")
|
||||
}
|
||||
if (len(alert.Alerts)) == 0 {
|
||||
t.Fatal("No alerts read")
|
||||
}
|
||||
if (len(alert.Alerts[0].Labels.AlertName)) == 0 {
|
||||
t.Fatal("No alerts name")
|
||||
}
|
||||
if (len(alert.Alerts[0].Labels.FunctionName)) == 0 {
|
||||
t.Fatal("No function name read")
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user