find Author from slack
parent
5fa21d0cd9
commit
5bc068451f
4
slack.go
4
slack.go
|
|
@ -98,6 +98,7 @@ type (
|
||||||
Asset string
|
Asset string
|
||||||
Resolved bool
|
Resolved bool
|
||||||
Datacenter string
|
Datacenter string
|
||||||
|
Author string
|
||||||
}
|
}
|
||||||
|
|
||||||
slackMessage struct {
|
slackMessage struct {
|
||||||
|
|
@ -118,6 +119,7 @@ type (
|
||||||
ParentID string `json:"thread_ts"`
|
ParentID string `json:"thread_ts"`
|
||||||
Text string
|
Text string
|
||||||
Blocks []slackBlock
|
Blocks []slackBlock
|
||||||
|
User string
|
||||||
// bot
|
// bot
|
||||||
Bot slackBot `json:"bot_profile"`
|
Bot slackBot `json:"bot_profile"`
|
||||||
Attachments []slackAttachment
|
Attachments []slackAttachment
|
||||||
|
|
@ -188,6 +190,7 @@ func parseSlack(b []byte) (parsedSlackMessage, error) {
|
||||||
Asset: s.Event.Attachments[0].Text,
|
Asset: s.Event.Attachments[0].Text,
|
||||||
Resolved: !strings.HasPrefix(s.Event.Attachments[0].Color, "F"),
|
Resolved: !strings.HasPrefix(s.Event.Attachments[0].Color, "F"),
|
||||||
Datacenter: tagsField,
|
Datacenter: tagsField,
|
||||||
|
Author: s.Event.Bot.Name,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -205,6 +208,7 @@ func parseSlack(b []byte) (parsedSlackMessage, error) {
|
||||||
Plaintext: s.Event.Text,
|
Plaintext: s.Event.Text,
|
||||||
Asset: "",
|
Asset: "",
|
||||||
Datacenter: "",
|
Datacenter: "",
|
||||||
|
Author: s.Event.User,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,7 @@ func TestParseSlackTestdata(t *testing.T) {
|
||||||
Event: "",
|
Event: "",
|
||||||
Plaintext: "I gotta do this",
|
Plaintext: "I gotta do this",
|
||||||
Asset: "",
|
Asset: "",
|
||||||
|
Author: "U06868T6ADV",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"opsgenie_alert.json": {
|
"opsgenie_alert.json": {
|
||||||
|
|
@ -164,6 +165,7 @@ func TestParseSlackTestdata(t *testing.T) {
|
||||||
Plaintext: "At least one alertconfig run has failed unexpectedly.\nDashboard: <https://grafana.render.com/d/VLZU83YVk?orgId=1>\nPanel: <https://grafana.render.com/d/VLZU83YVk?orgId=1&viewPanel=17>\nSource: <https://grafana.render.com/alerting/grafana/fa7b06b8-b4d8-4979-bce7-5e1c432edd81/view?orgId=1>",
|
Plaintext: "At least one alertconfig run has failed unexpectedly.\nDashboard: <https://grafana.render.com/d/VLZU83YVk?orgId=1>\nPanel: <https://grafana.render.com/d/VLZU83YVk?orgId=1&viewPanel=17>\nSource: <https://grafana.render.com/alerting/grafana/fa7b06b8-b4d8-4979-bce7-5e1c432edd81/view?orgId=1>",
|
||||||
Asset: "At least one alertconfig run has failed unexpectedly.\nDashboard: <https://grafana.render.com/d/VLZU83YVk?orgId=1>\nPanel: <https://grafana.render.com/d/VLZU83YVk?orgId=1&viewPanel=17>\nSource: <https://grafana.render.com/alerting/grafana/fa7b06b8-b4d8-4979-bce7-5e1c432edd81/view?orgId=1>",
|
Asset: "At least one alertconfig run has failed unexpectedly.\nDashboard: <https://grafana.render.com/d/VLZU83YVk?orgId=1>\nPanel: <https://grafana.render.com/d/VLZU83YVk?orgId=1&viewPanel=17>\nSource: <https://grafana.render.com/alerting/grafana/fa7b06b8-b4d8-4979-bce7-5e1c432edd81/view?orgId=1>",
|
||||||
Datacenter: "alertname:Alertconfig Workflow Failed, grafana_folder:Datastores, rule_uid:a7639f7e-6950-41be-850a-b22119f74cbb",
|
Datacenter: "alertname:Alertconfig Workflow Failed, grafana_folder:Datastores, rule_uid:a7639f7e-6950-41be-850a-b22119f74cbb",
|
||||||
|
Author: "Opsgenie for Alert Management",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"opsgenie_alert_resolved.json": {
|
"opsgenie_alert_resolved.json": {
|
||||||
|
|
@ -200,6 +202,7 @@ func TestParseSlackTestdata(t *testing.T) {
|
||||||
Asset: "At least one alertconfig run has failed unexpectedly.\nDashboard: <https://grafana.render.com/d/VLZU83YVk?orgId=1>\nPanel: <https://grafana.render.com/d/VLZU83YVk?orgId=1&viewPanel=17>\nSource: <https://grafana.render.com/alerting/grafana/fa7b06b8-b4d8-4979-bce7-5e1c432edd81/view?orgId=1>",
|
Asset: "At least one alertconfig run has failed unexpectedly.\nDashboard: <https://grafana.render.com/d/VLZU83YVk?orgId=1>\nPanel: <https://grafana.render.com/d/VLZU83YVk?orgId=1&viewPanel=17>\nSource: <https://grafana.render.com/alerting/grafana/fa7b06b8-b4d8-4979-bce7-5e1c432edd81/view?orgId=1>",
|
||||||
Resolved: true,
|
Resolved: true,
|
||||||
Datacenter: "alertname:Alertconfig Workflow Failed, grafana_folder:Datastores, rule_uid:a7639f7e-6950-41be-850a-b22119f74cbb",
|
Datacenter: "alertname:Alertconfig Workflow Failed, grafana_folder:Datastores, rule_uid:a7639f7e-6950-41be-850a-b22119f74cbb",
|
||||||
|
Author: "Opsgenie for Alert Management",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"reingested_alert.json": {
|
"reingested_alert.json": {
|
||||||
|
|
@ -215,6 +218,7 @@ func TestParseSlackTestdata(t *testing.T) {
|
||||||
Asset: "At least one alertconfig run has failed unexpectedly.\nDashboard: <https://grafana.render.com/d/VLZU83YVk?orgId=1>\nPanel: <https://grafana.render.com/d/VLZU83YVk?orgId=1&viewPanel=17>\nSource: <https://grafana.render.com/alerting/grafana/fa7b06b8-b4d8-4979-bce7-5e1c432edd81/view?orgId=1>",
|
Asset: "At least one alertconfig run has failed unexpectedly.\nDashboard: <https://grafana.render.com/d/VLZU83YVk?orgId=1>\nPanel: <https://grafana.render.com/d/VLZU83YVk?orgId=1&viewPanel=17>\nSource: <https://grafana.render.com/alerting/grafana/fa7b06b8-b4d8-4979-bce7-5e1c432edd81/view?orgId=1>",
|
||||||
Resolved: true,
|
Resolved: true,
|
||||||
Datacenter: "alertname:Alertconfig Workflow Failed, grafana_folder:Datastores, rule_uid:a7639f7e-6950-41be-850a-b22119f74cbb",
|
Datacenter: "alertname:Alertconfig Workflow Failed, grafana_folder:Datastores, rule_uid:a7639f7e-6950-41be-850a-b22119f74cbb",
|
||||||
|
Author: "Opsgenie for Alert Management",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue