-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andy Lo-A-Foe <[email protected]>
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package alerts | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// Payload is the JSON format of HSDP Metrics webhook alerts | ||
type Payload struct { | ||
Receiver string `json:"receiver"` | ||
Status string `json:"status"` | ||
Alerts []Alert `json:"alerts"` | ||
GroupLabels GroupLabel `json:"groupLabels"` | ||
CommonLabels Label `json:"commonLabels"` | ||
CommonAnnotations Annotation `json:"commonAnnotations"` | ||
ExternalURL string `json:"externalURL"` | ||
Version string `json:"version"` | ||
GroupKey string `json:"groupKey"` | ||
} | ||
|
||
// Alert describes an alert | ||
type Alert struct { | ||
Status string `json:"status"` | ||
Labels Label `json:"labels"` | ||
Annotations Annotation `json:"annotations"` | ||
StartsAt time.Time `json:"startsAt"` | ||
EndsAt time.Time `json:"endsAt"` | ||
GeneratorURL string `json:"generatorURL"` | ||
} | ||
|
||
// Annotation describes an alert | ||
type Annotation struct { | ||
Description string `json:"description"` | ||
Summary string `json:"summary"` | ||
} | ||
|
||
// Label describes a label | ||
type Label struct { | ||
AlertName string `json:"alertname"` | ||
Application string `json:"application"` | ||
ApplicationID string `json:"application_id"` | ||
BrokerID string `json:"broker_id"` | ||
Deployment string `json:"deployment"` | ||
Instance string `json:"instance"` | ||
Job string `json:"job"` | ||
Organization string `json:"organization"` | ||
OrganizationID string `json:"organization_id"` | ||
Region string `json:"region"` | ||
Severity string `json:"severity"` | ||
Space string `json:"space"` | ||
SpaceID string `json:"space_id"` | ||
} | ||
|
||
// GroupLabel describes a group label | ||
type GroupLabel struct { | ||
AlertName string `json:"alertname"` | ||
Application string `json:"application"` | ||
} |