mirror of
https://github.com/prymitive/karma
synced 2026-08-23 11:56:20 +00:00
Drop global SilencedBy & InhibitedBy from alert, only export per instance data
This commit is contained in:
@@ -495,3 +495,7 @@ a[aria-expanded=false] .fa-chevron-down {
|
||||
line-height: 1.42857143;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.alert-static-elements {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<script type="application/json" id="alert-group-elements">
|
||||
<% var cls_indicator = 'incident-indicator-danger' %>
|
||||
<% if (alert.state === "suppressed") { cls_indicator = 'incident-indicator-success' } %>
|
||||
<div>
|
||||
<div class="alert-static-elements">
|
||||
<% _.each(alert.alertmanager, function(am){ %>
|
||||
<a class="label label-list label-primary"
|
||||
href="<%= am.source %>"
|
||||
@@ -77,7 +77,7 @@
|
||||
<% }) %>
|
||||
<% var attrs = Alerts.GetLabelAttrs("@state", alert.state) %>
|
||||
<%= Templates.Render('buttonLabel', {elem: 'span', attrs: attrs, label: {key: '@state', value: alert.state, text: '@state: ' + alert.state}}) %>
|
||||
<% if (alert.silencedBy.length == 0) { %>
|
||||
<% if (alert.state != "suppressed") { %>
|
||||
<% var labels = [] %>
|
||||
<% var alertmanagers = [] %>
|
||||
<% _.each(Alerts.SortMapByKey(alert.labels), function(label) { %>
|
||||
@@ -113,9 +113,6 @@
|
||||
</script>
|
||||
|
||||
<script type="application/json" id="alert-group-silence">
|
||||
<small class="silence-comment-title text-muted">
|
||||
Silenced by:
|
||||
</small>
|
||||
<% _.each(alert.alertmanager, function(am) { %>
|
||||
<% _.each(am.silences, function(silence) { %>
|
||||
<div class="silence-block well">
|
||||
@@ -270,7 +267,7 @@
|
||||
<%= Templates.Render('alertGroupAnnotations', {alert: alert}) %>
|
||||
<%= Templates.Render('alertGroupLabels', {alert: alert, group: group}) %>
|
||||
<%= Templates.Render('alertGroupElements', {alert: alert}) %>
|
||||
<% if (alert.silencedBy.length) { %>
|
||||
<% if (alert.state == "suppressed") { %>
|
||||
<%= Templates.Render('alertGroupSilence', {alert: alert}) %>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
+10
-8
@@ -30,14 +30,16 @@ var AlertStateList = []string{
|
||||
// it's pulled out of annotation map and returned under links field,
|
||||
// unsee UI used this to show links differently than other annotations
|
||||
type Alert struct {
|
||||
Annotations map[string]string `json:"annotations"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
StartsAt time.Time `json:"startsAt"`
|
||||
EndsAt time.Time `json:"endsAt"`
|
||||
GeneratorURL string `json:"-"`
|
||||
State string `json:"state"`
|
||||
SilencedBy []string `json:"silencedBy"`
|
||||
InhibitedBy []string `json:"inhibitedBy"`
|
||||
Annotations map[string]string `json:"annotations"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
StartsAt time.Time `json:"startsAt"`
|
||||
EndsAt time.Time `json:"endsAt"`
|
||||
State string `json:"state"`
|
||||
// those are not exposed in JSON, Alertmanager specific value will be in kept
|
||||
// in the Alertmanager slice
|
||||
GeneratorURL string `json:"-"`
|
||||
SilencedBy []string `json:"-"`
|
||||
InhibitedBy []string `json:"-"`
|
||||
// unsee fields
|
||||
Alertmanager []AlertmanagerInstance `json:"alertmanager"`
|
||||
Receiver string `json:"receiver"`
|
||||
|
||||
@@ -9,6 +9,7 @@ type AlertmanagerInstance struct {
|
||||
Source string `json:"source"`
|
||||
// all silences matching current alert in this upstream
|
||||
Silences map[string]Silence `json:"silences"`
|
||||
// TODO also export InhibitedBy here if it ever becomes needed
|
||||
}
|
||||
|
||||
// AlertmanagerAPIStatus describes the Alertmanager instance overall health
|
||||
|
||||
Reference in New Issue
Block a user