Alerting: Remove unused fields in Pagerduty struct (#37198)

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
This commit is contained in:
Ganesh Vernekar 2021-07-27 10:41:48 +05:30 committed by GitHub
parent 01e984c394
commit e8ac802e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 16 deletions

View File

@ -145,7 +145,7 @@ func (pn *PagerdutyNotifier) buildPagerdutyMessage(ctx context.Context, alerts m
Text: "External URL", Text: "External URL",
}}, }},
Description: tmpl(`{{ template "default.title" . }}`), // TODO: this can be configurable template. Description: tmpl(`{{ template "default.title" . }}`), // TODO: this can be configurable template.
Payload: &pagerDutyPayload{ Payload: pagerDutyPayload{
Component: tmpl(pn.Component), Component: tmpl(pn.Component),
Summary: tmpl(pn.Summary), Summary: tmpl(pn.Summary),
Severity: tmpl(pn.Severity), Severity: tmpl(pn.Severity),
@ -177,18 +177,15 @@ func (pn *PagerdutyNotifier) SendResolved() bool {
} }
type pagerDutyMessage struct { type pagerDutyMessage struct {
RoutingKey string `json:"routing_key,omitempty"` RoutingKey string `json:"routing_key,omitempty"`
ServiceKey string `json:"service_key,omitempty"` ServiceKey string `json:"service_key,omitempty"`
DedupKey string `json:"dedup_key,omitempty"` DedupKey string `json:"dedup_key,omitempty"`
IncidentKey string `json:"incident_key,omitempty"` Description string `json:"description,omitempty"`
EventType string `json:"event_type,omitempty"` EventAction string `json:"event_action"`
Description string `json:"description,omitempty"` Payload pagerDutyPayload `json:"payload"`
EventAction string `json:"event_action"` Client string `json:"client,omitempty"`
Payload *pagerDutyPayload `json:"payload"` ClientURL string `json:"client_url,omitempty"`
Client string `json:"client,omitempty"` Links []pagerDutyLink `json:"links,omitempty"`
ClientURL string `json:"client_url,omitempty"`
Details map[string]string `json:"details,omitempty"`
Links []pagerDutyLink `json:"links,omitempty"`
} }
type pagerDutyLink struct { type pagerDutyLink struct {
@ -200,7 +197,6 @@ type pagerDutyPayload struct {
Summary string `json:"summary"` Summary string `json:"summary"`
Source string `json:"source"` Source string `json:"source"`
Severity string `json:"severity"` Severity string `json:"severity"`
Timestamp string `json:"timestamp,omitempty"`
Class string `json:"class,omitempty"` Class string `json:"class,omitempty"`
Component string `json:"component,omitempty"` Component string `json:"component,omitempty"`
Group string `json:"group,omitempty"` Group string `json:"group,omitempty"`

View File

@ -51,7 +51,7 @@ func TestPagerdutyNotifier(t *testing.T) {
DedupKey: "6e3538104c14b583da237e9693b76debbc17f0f8058ef20492e5853096cf8733", DedupKey: "6e3538104c14b583da237e9693b76debbc17f0f8058ef20492e5853096cf8733",
Description: "[FIRING:1] (val1)", Description: "[FIRING:1] (val1)",
EventAction: "trigger", EventAction: "trigger",
Payload: &pagerDutyPayload{ Payload: pagerDutyPayload{
Summary: "[FIRING:1] (val1)", Summary: "[FIRING:1] (val1)",
Source: hostname, Source: hostname,
Severity: "critical", Severity: "critical",
@ -97,7 +97,7 @@ func TestPagerdutyNotifier(t *testing.T) {
DedupKey: "6e3538104c14b583da237e9693b76debbc17f0f8058ef20492e5853096cf8733", DedupKey: "6e3538104c14b583da237e9693b76debbc17f0f8058ef20492e5853096cf8733",
Description: "[FIRING:2] ", Description: "[FIRING:2] ",
EventAction: "trigger", EventAction: "trigger",
Payload: &pagerDutyPayload{ Payload: pagerDutyPayload{
Summary: "[FIRING:2] ", Summary: "[FIRING:2] ",
Source: hostname, Source: hostname,
Severity: "warning", Severity: "warning",