diff --git a/app/vmalert/static/js/custom.js b/app/vmalert/static/js/custom.js index e75235efce..25adebd2ba 100644 --- a/app/vmalert/static/js/custom.js +++ b/app/vmalert/static/js/custom.js @@ -1,10 +1,15 @@ function expandAll() { - $(".group-heading").show() - $('.collapse').addClass('show'); + $('.group-heading').each(function () { + let style = $(this).attr("style") + // display only elements that are currently visible + if (style === "display: none;") { + return + } + $(this).next().addClass('show') + }); } function collapseAll() { - $(".group-heading").show() $('.collapse').removeClass('show'); } @@ -19,7 +24,7 @@ function toggleByID(id) { function debounce(func, delay) { let timer; - return function(...args) { + return function (...args) { clearTimeout(timer); timer = setTimeout(() => { func.apply(this, args); @@ -27,75 +32,88 @@ function debounce(func, delay) { }; } -$('#filter').on("keyup", debounce(filter, 500)); +$('#search').on("keyup", debounce(search, 500)); -function filter(){ - $(".rule-table").removeClass('show'); +// search shows or hides groups&rules that satisfy the search phrase. +// case-insensitive, respects GET param `search`. +function search() { $(".rule").show(); - - if($("#filter").val().length === 0){ - $(".group-heading").show() + + let groupHeader = $(".group-heading") + let searchPhrase = $("#search").val().toLowerCase() + if (searchPhrase.length === 0) { + groupHeader.show() + setParamURL('search', '') return } - $(".group-heading").hide() + $(".rule-table").removeClass('show'); + groupHeader.hide() - filterRuleByName(); - filterRuleByLabels(); - filterGroupsByName(); + searchPhrase = searchPhrase.toLowerCase() + filterRuleByName(searchPhrase); + filterRuleByLabels(searchPhrase); + filterGroupsByName(searchPhrase); + + setParamURL('search', searchPhrase) } -function filterGroupsByName(){ - $( ".group-heading" ).each(function() { - const groupName = $(this).attr('data-group-name'); - const filter = $("#filter").val() - const hasValue = groupName.indexOf(filter) >= 0 +function setParamURL(key, value) { + let url = new URL(location.href) + url.searchParams.set(key, value); + window.history.replaceState(null, null, `?${url.searchParams.toString()}`); +} - if (hasValue){ - const target = $(this).attr("data-bs-target"); - - $(this).show(); - $(`div[id="${target}"] .rule`).show(); +function getParamURL(key) { + let url = new URL(location.href) + return url.searchParams.get(key) +} + +function filterGroupsByName(searchPhrase) { + $(".group-heading").each(function () { + const groupName = $(this).attr('data-group-name').toLowerCase(); + const hasValue = groupName.indexOf(searchPhrase) >= 0 + + if (!hasValue) { + return } + + const target = $(this).attr("data-bs-target"); + $(`div[id="${target}"] .rule`).show(); + $(this).show(); }); } -function filterRuleByName(){ - $( ".rule" ).each(function() { - const ruleName = $(this).attr("data-rule-name"); - const filter = $("#filter").val() - const hasValue = ruleName.indexOf(filter) >= 0 - - if (hasValue){ - const target = $(this).attr('data-bs-target') - - $(`#rules-${target}`).addClass('show'); - $(`div[data-bs-target='rules-${target}']`).show(); - $(this).show(); - }else{ +function filterRuleByName(searchPhrase) { + $(".rule").each(function () { + const ruleName = $(this).attr("data-rule-name").toLowerCase(); + const hasValue = ruleName.indexOf(searchPhrase) >= 0 + if (!hasValue) { $(this).hide(); + return } - }); + + const target = $(this).attr('data-bs-target') + $(`#rules-${target}`).addClass('show'); + $(`div[data-bs-target='rules-${target}']`).show(); + $(this).show(); + }); } -function filterRuleByLabels(){ - $( ".rule" ).each(function() { - const filter = $("#filter").val() - - const matches = $( ".label", this ).filter(function() { - const label = $(this).text(); - const hasValue = label.indexOf(filter) >= 0 - return hasValue; - }).length; +function filterRuleByLabels(searchPhrase) { + $(".rule").each(function () { + const matches = $(".label", this).filter(function () { + const label = $(this).text().toLowerCase(); + return label.indexOf(searchPhrase) >= 0; + }).length; - if (matches > 0){ + if (matches > 0) { const target = $(this).attr('data-bs-target') - $(`#rules-${target}`).addClass('show'); $(`div[data-bs-target='rules-${target}']`).show(); $(this).show(); } - }); + }); } $(document).ready(function () { @@ -115,6 +133,13 @@ $(document).ready(function () { }); }); + // update search element with value from URL, if any + let searchPhrase = getParamURL('search') + $("#search").val(searchPhrase) + + // apply filtering by search phrase + search() + let hash = window.location.hash.substr(1); toggleByID(hash); }); diff --git a/app/vmalert/web.qtpl b/app/vmalert/web.qtpl index 120981e73d..bf1619f728 100644 --- a/app/vmalert/web.qtpl +++ b/app/vmalert/web.qtpl @@ -70,19 +70,23 @@ btn-primary } } %} - All - Collapse All - Expand All - Unhealthy - NoMatch -
-
-
- - - + {% if len(groups) > 0 %} @@ -180,11 +184,25 @@ btn-primary {%code prefix := utils.Prefix(r.URL.Path) %} {%= tpl.Header(r, navItems, "Alerts", getLastConfigError()) %} {% if len(groupAlerts) > 0 %} - Collapse All - Expand All + {% for _, ga := range groupAlerts %} {%code g := ga.Group %} -
+
{%s g.Name %}{% if g.Type != "prometheus" %} ({%s g.Type %}){% endif %} {%d len(ga.Alerts) %} @@ -202,7 +220,7 @@ btn-primary } sort.Strings(keys) %} -
+
{% for _, ruleID := range keys %} {%code defaultAR := alertsByRule[ruleID][0] @@ -213,45 +231,46 @@ btn-primary sort.Strings(labelKeys) %}
- alert: {%s defaultAR.Name %} ({%d len(alertsByRule[ruleID]) %}) - | Source -
- expr:
{%s defaultAR.Expression %}
- - - - - - - - - - - - {% for _, ar := range alertsByRule[ruleID] %} - - - - - - - - {% endfor %} - -
LabelsStateActive atValueLink
- {% for _, k := range labelKeys %} - {%s k %}={%s ar.Labels[k] %} - {% endfor %} - {%= badgeState(ar.State) %} - {%s ar.ActiveAt.Format("2006-01-02T15:04:05Z07:00") %} - {% if ar.Restored %}{%= badgeRestored() %}{% endif %} - {% if ar.Stabilizing %}{%= badgeStabilizing() %}{% endif %} - {%s ar.Value %} - Details -
+
+ alert: {%s defaultAR.Name %} ({%d len(alertsByRule[ruleID]) %}) + | Source +
+ expr:
{%s defaultAR.Expression %}
+ + + + + + + + + + + + {% for _, ar := range alertsByRule[ruleID] %} + + + + + + + + {% endfor %} + +
LabelsStateActive atValueLink
+ {% for _, k := range labelKeys %} + {%s k %}={%s ar.Labels[k] %} + {% endfor %} + {%= badgeState(ar.State) %} + {%s ar.ActiveAt.Format("2006-01-02T15:04:05Z07:00") %} + {% if ar.Restored %}{%= badgeRestored() %}{% endif %} + {% if ar.Stabilizing %}{%= badgeStabilizing() %}{% endif %} + {%s ar.Value %} + Details +
+
{% endfor %}
-
{% endfor %} {% else %} diff --git a/app/vmalert/web.qtpl.go b/app/vmalert/web.qtpl.go index 9330ed61f2..35ddea15f3 100644 --- a/app/vmalert/web.qtpl.go +++ b/app/vmalert/web.qtpl.go @@ -242,184 +242,188 @@ func StreamListGroups(qw422016 *qt422016.Writer, r *http.Request, originGroups [ //line app/vmalert/web.qtpl:72 qw422016.N().S(` - +
+ All - Collapse All - Expand All - Collapse All + Expand All + Unhealthy - NoMatch -
-
-
- - - +
+
+
+
+ + + +
+
-
`) -//line app/vmalert/web.qtpl:88 +//line app/vmalert/web.qtpl:92 if len(groups) > 0 { -//line app/vmalert/web.qtpl:88 +//line app/vmalert/web.qtpl:92 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:89 +//line app/vmalert/web.qtpl:93 for _, g := range groups { -//line app/vmalert/web.qtpl:89 +//line app/vmalert/web.qtpl:93 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 qw422016.E().S(g.Name) -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 if g.Type != "prometheus" { -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 qw422016.N().S(` (`) -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 qw422016.E().S(g.Type) -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 qw422016.N().S(`)`) -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 } -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 qw422016.N().S(` (every `) -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 qw422016.N().FPrec(g.Interval, 0) -//line app/vmalert/web.qtpl:93 +//line app/vmalert/web.qtpl:97 qw422016.N().S(`s) # `) -//line app/vmalert/web.qtpl:94 +//line app/vmalert/web.qtpl:98 if rNotOk[g.ID] > 0 { -//line app/vmalert/web.qtpl:94 +//line app/vmalert/web.qtpl:98 qw422016.N().S(``) -//line app/vmalert/web.qtpl:94 +//line app/vmalert/web.qtpl:98 qw422016.N().D(rNotOk[g.ID]) -//line app/vmalert/web.qtpl:94 +//line app/vmalert/web.qtpl:98 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:94 +//line app/vmalert/web.qtpl:98 } -//line app/vmalert/web.qtpl:94 +//line app/vmalert/web.qtpl:98 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:95 +//line app/vmalert/web.qtpl:99 if rNoMatch[g.ID] > 0 { -//line app/vmalert/web.qtpl:95 +//line app/vmalert/web.qtpl:99 qw422016.N().S(``) -//line app/vmalert/web.qtpl:95 +//line app/vmalert/web.qtpl:99 qw422016.N().D(rNoMatch[g.ID]) -//line app/vmalert/web.qtpl:95 +//line app/vmalert/web.qtpl:99 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:95 +//line app/vmalert/web.qtpl:99 } -//line app/vmalert/web.qtpl:95 +//line app/vmalert/web.qtpl:99 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:96 +//line app/vmalert/web.qtpl:100 qw422016.N().D(rOk[g.ID]) -//line app/vmalert/web.qtpl:96 +//line app/vmalert/web.qtpl:100 qw422016.N().S(`

`) -//line app/vmalert/web.qtpl:97 +//line app/vmalert/web.qtpl:101 qw422016.E().S(g.File) -//line app/vmalert/web.qtpl:97 +//line app/vmalert/web.qtpl:101 qw422016.N().S(`

`) -//line app/vmalert/web.qtpl:98 +//line app/vmalert/web.qtpl:102 if len(g.Params) > 0 { -//line app/vmalert/web.qtpl:98 +//line app/vmalert/web.qtpl:102 qw422016.N().S(`
Extra params `) -//line app/vmalert/web.qtpl:100 +//line app/vmalert/web.qtpl:104 for _, param := range g.Params { -//line app/vmalert/web.qtpl:100 +//line app/vmalert/web.qtpl:104 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:101 +//line app/vmalert/web.qtpl:105 qw422016.E().S(param) -//line app/vmalert/web.qtpl:101 +//line app/vmalert/web.qtpl:105 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:102 +//line app/vmalert/web.qtpl:106 } -//line app/vmalert/web.qtpl:102 +//line app/vmalert/web.qtpl:106 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:104 +//line app/vmalert/web.qtpl:108 } -//line app/vmalert/web.qtpl:104 +//line app/vmalert/web.qtpl:108 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:105 +//line app/vmalert/web.qtpl:109 if len(g.Headers) > 0 { -//line app/vmalert/web.qtpl:105 +//line app/vmalert/web.qtpl:109 qw422016.N().S(`
Extra headers `) -//line app/vmalert/web.qtpl:107 +//line app/vmalert/web.qtpl:111 for _, header := range g.Headers { -//line app/vmalert/web.qtpl:107 +//line app/vmalert/web.qtpl:111 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:108 +//line app/vmalert/web.qtpl:112 qw422016.E().S(header) -//line app/vmalert/web.qtpl:108 +//line app/vmalert/web.qtpl:112 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:109 +//line app/vmalert/web.qtpl:113 } -//line app/vmalert/web.qtpl:109 +//line app/vmalert/web.qtpl:113 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:111 +//line app/vmalert/web.qtpl:115 } -//line app/vmalert/web.qtpl:111 +//line app/vmalert/web.qtpl:115 qw422016.N().S(`
@@ -431,308 +435,326 @@ func StreamListGroups(qw422016 *qt422016.Writer, r *http.Request, originGroups [ `) -//line app/vmalert/web.qtpl:123 +//line app/vmalert/web.qtpl:127 for _, r := range g.Rules { -//line app/vmalert/web.qtpl:123 +//line app/vmalert/web.qtpl:127 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:163 +//line app/vmalert/web.qtpl:167 } -//line app/vmalert/web.qtpl:163 +//line app/vmalert/web.qtpl:167 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:128 +//line app/vmalert/web.qtpl:132 if r.Type == "alerting" { -//line app/vmalert/web.qtpl:128 +//line app/vmalert/web.qtpl:132 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:129 +//line app/vmalert/web.qtpl:133 if r.KeepFiringFor > 0 { -//line app/vmalert/web.qtpl:129 +//line app/vmalert/web.qtpl:133 qw422016.N().S(` alert: `) -//line app/vmalert/web.qtpl:130 +//line app/vmalert/web.qtpl:134 qw422016.E().S(r.Name) -//line app/vmalert/web.qtpl:130 +//line app/vmalert/web.qtpl:134 qw422016.N().S(` (for: `) -//line app/vmalert/web.qtpl:130 +//line app/vmalert/web.qtpl:134 qw422016.E().V(r.Duration) -//line app/vmalert/web.qtpl:130 +//line app/vmalert/web.qtpl:134 qw422016.N().S(` seconds, keep_firing_for: `) -//line app/vmalert/web.qtpl:130 +//line app/vmalert/web.qtpl:134 qw422016.E().V(r.KeepFiringFor) -//line app/vmalert/web.qtpl:130 +//line app/vmalert/web.qtpl:134 qw422016.N().S(` seconds) `) -//line app/vmalert/web.qtpl:131 +//line app/vmalert/web.qtpl:135 } else { -//line app/vmalert/web.qtpl:131 +//line app/vmalert/web.qtpl:135 qw422016.N().S(` alert: `) -//line app/vmalert/web.qtpl:132 +//line app/vmalert/web.qtpl:136 qw422016.E().S(r.Name) -//line app/vmalert/web.qtpl:132 +//line app/vmalert/web.qtpl:136 qw422016.N().S(` (for: `) -//line app/vmalert/web.qtpl:132 +//line app/vmalert/web.qtpl:136 qw422016.E().V(r.Duration) -//line app/vmalert/web.qtpl:132 +//line app/vmalert/web.qtpl:136 qw422016.N().S(` seconds) `) -//line app/vmalert/web.qtpl:133 +//line app/vmalert/web.qtpl:137 } -//line app/vmalert/web.qtpl:133 +//line app/vmalert/web.qtpl:137 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:134 +//line app/vmalert/web.qtpl:138 } else { -//line app/vmalert/web.qtpl:134 +//line app/vmalert/web.qtpl:138 qw422016.N().S(` record: `) -//line app/vmalert/web.qtpl:135 +//line app/vmalert/web.qtpl:139 qw422016.E().S(r.Name) -//line app/vmalert/web.qtpl:135 +//line app/vmalert/web.qtpl:139 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:136 +//line app/vmalert/web.qtpl:140 } -//line app/vmalert/web.qtpl:136 +//line app/vmalert/web.qtpl:140 qw422016.N().S(` | `) -//line app/vmalert/web.qtpl:138 +//line app/vmalert/web.qtpl:142 streamseriesFetchedWarn(qw422016, r) -//line app/vmalert/web.qtpl:138 +//line app/vmalert/web.qtpl:142 qw422016.N().S(` Details
`)
-//line app/vmalert/web.qtpl:142
+//line app/vmalert/web.qtpl:146
 				qw422016.E().S(r.Query)
-//line app/vmalert/web.qtpl:142
+//line app/vmalert/web.qtpl:146
 				qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:145 +//line app/vmalert/web.qtpl:149 if len(r.Labels) > 0 { -//line app/vmalert/web.qtpl:145 +//line app/vmalert/web.qtpl:149 qw422016.N().S(` Labels:`) -//line app/vmalert/web.qtpl:145 +//line app/vmalert/web.qtpl:149 } -//line app/vmalert/web.qtpl:145 +//line app/vmalert/web.qtpl:149 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:146 +//line app/vmalert/web.qtpl:150 for k, v := range r.Labels { -//line app/vmalert/web.qtpl:146 +//line app/vmalert/web.qtpl:150 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:147 +//line app/vmalert/web.qtpl:151 qw422016.E().S(k) -//line app/vmalert/web.qtpl:147 +//line app/vmalert/web.qtpl:151 qw422016.N().S(`=`) -//line app/vmalert/web.qtpl:147 +//line app/vmalert/web.qtpl:151 qw422016.E().S(v) -//line app/vmalert/web.qtpl:147 +//line app/vmalert/web.qtpl:151 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:148 +//line app/vmalert/web.qtpl:152 } -//line app/vmalert/web.qtpl:148 +//line app/vmalert/web.qtpl:152 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:150 +//line app/vmalert/web.qtpl:154 if r.LastError != "" { -//line app/vmalert/web.qtpl:150 +//line app/vmalert/web.qtpl:154 qw422016.N().S(`
Error:
`) -//line app/vmalert/web.qtpl:154 +//line app/vmalert/web.qtpl:158 qw422016.E().S(r.LastError) -//line app/vmalert/web.qtpl:154 +//line app/vmalert/web.qtpl:158 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:157 +//line app/vmalert/web.qtpl:161 } -//line app/vmalert/web.qtpl:157 +//line app/vmalert/web.qtpl:161 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:160 +//line app/vmalert/web.qtpl:164 qw422016.N().D(r.LastSamples) -//line app/vmalert/web.qtpl:160 +//line app/vmalert/web.qtpl:164 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:161 +//line app/vmalert/web.qtpl:165 qw422016.N().FPrec(time.Since(r.LastEvaluation).Seconds(), 3) -//line app/vmalert/web.qtpl:161 +//line app/vmalert/web.qtpl:165 qw422016.N().S(`s ago
`) -//line app/vmalert/web.qtpl:167 +//line app/vmalert/web.qtpl:171 } -//line app/vmalert/web.qtpl:167 +//line app/vmalert/web.qtpl:171 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:168 +//line app/vmalert/web.qtpl:172 } else { -//line app/vmalert/web.qtpl:168 +//line app/vmalert/web.qtpl:172 qw422016.N().S(`

No groups...

`) -//line app/vmalert/web.qtpl:172 +//line app/vmalert/web.qtpl:176 } -//line app/vmalert/web.qtpl:172 +//line app/vmalert/web.qtpl:176 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:174 +//line app/vmalert/web.qtpl:178 tpl.StreamFooter(qw422016, r) -//line app/vmalert/web.qtpl:174 +//line app/vmalert/web.qtpl:178 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 } -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 func WriteListGroups(qq422016 qtio422016.Writer, r *http.Request, originGroups []apiGroup) { -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 StreamListGroups(qw422016, r, originGroups) -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 } -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 func ListGroups(r *http.Request, originGroups []apiGroup) string { -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 WriteListGroups(qb422016, r, originGroups) -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 return qs422016 -//line app/vmalert/web.qtpl:176 +//line app/vmalert/web.qtpl:180 } -//line app/vmalert/web.qtpl:179 +//line app/vmalert/web.qtpl:183 func StreamListAlerts(qw422016 *qt422016.Writer, r *http.Request, groupAlerts []groupAlerts) { -//line app/vmalert/web.qtpl:179 +//line app/vmalert/web.qtpl:183 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:180 +//line app/vmalert/web.qtpl:184 prefix := utils.Prefix(r.URL.Path) -//line app/vmalert/web.qtpl:180 +//line app/vmalert/web.qtpl:184 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:181 +//line app/vmalert/web.qtpl:185 tpl.StreamHeader(qw422016, r, navItems, "Alerts", getLastConfigError()) -//line app/vmalert/web.qtpl:181 +//line app/vmalert/web.qtpl:185 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:182 +//line app/vmalert/web.qtpl:186 if len(groupAlerts) > 0 { -//line app/vmalert/web.qtpl:182 +//line app/vmalert/web.qtpl:186 qw422016.N().S(` - Collapse All - Expand All + `) -//line app/vmalert/web.qtpl:185 +//line app/vmalert/web.qtpl:203 for _, ga := range groupAlerts { -//line app/vmalert/web.qtpl:185 +//line app/vmalert/web.qtpl:203 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:186 +//line app/vmalert/web.qtpl:204 g := ga.Group -//line app/vmalert/web.qtpl:186 +//line app/vmalert/web.qtpl:204 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:195 +//line app/vmalert/web.qtpl:213 var keys []string alertsByRule := make(map[string][]*apiAlert) for _, alert := range ga.Alerts { @@ -743,20 +765,20 @@ func StreamListAlerts(qw422016 *qt422016.Writer, r *http.Request, groupAlerts [] } sort.Strings(keys) -//line app/vmalert/web.qtpl:204 +//line app/vmalert/web.qtpl:222 qw422016.N().S(` -
`) -//line app/vmalert/web.qtpl:206 +//line app/vmalert/web.qtpl:224 for _, ruleID := range keys { -//line app/vmalert/web.qtpl:206 +//line app/vmalert/web.qtpl:224 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:208 +//line app/vmalert/web.qtpl:226 defaultAR := alertsByRule[ruleID][0] var labelKeys []string for k := range defaultAR.Labels { @@ -764,248 +786,257 @@ func StreamListAlerts(qw422016 *qt422016.Writer, r *http.Request, groupAlerts [] } sort.Strings(labelKeys) -//line app/vmalert/web.qtpl:214 +//line app/vmalert/web.qtpl:232 qw422016.N().S(`
- alert: `) -//line app/vmalert/web.qtpl:216 +
+ alert: `) +//line app/vmalert/web.qtpl:235 + qw422016.E().S(defaultAR.Name) +//line app/vmalert/web.qtpl:235 qw422016.N().S(` (`) -//line app/vmalert/web.qtpl:216 +//line app/vmalert/web.qtpl:235 qw422016.N().D(len(alertsByRule[ruleID])) -//line app/vmalert/web.qtpl:216 +//line app/vmalert/web.qtpl:235 qw422016.N().S(`) - | Source -
- expr:
`)
-//line app/vmalert/web.qtpl:219
+                      
+ expr:
`)
+//line app/vmalert/web.qtpl:238
 				qw422016.E().S(defaultAR.Expression)
-//line app/vmalert/web.qtpl:219
+//line app/vmalert/web.qtpl:238
 				qw422016.N().S(`
- - - - - - - - - - - - `) -//line app/vmalert/web.qtpl:231 +
LabelsStateActive atValueLink
+ + + + + + + + + + + `) +//line app/vmalert/web.qtpl:250 for _, ar := range alertsByRule[ruleID] { -//line app/vmalert/web.qtpl:231 +//line app/vmalert/web.qtpl:250 qw422016.N().S(` - - + - + - - + - - - `) -//line app/vmalert/web.qtpl:249 + + + `) +//line app/vmalert/web.qtpl:268 } -//line app/vmalert/web.qtpl:249 +//line app/vmalert/web.qtpl:268 qw422016.N().S(` - -
LabelsStateActive atValueLink
- `) -//line app/vmalert/web.qtpl:234 +
+ `) +//line app/vmalert/web.qtpl:253 for _, k := range labelKeys { -//line app/vmalert/web.qtpl:234 +//line app/vmalert/web.qtpl:253 qw422016.N().S(` - `) -//line app/vmalert/web.qtpl:235 + `) +//line app/vmalert/web.qtpl:254 qw422016.E().S(k) -//line app/vmalert/web.qtpl:235 +//line app/vmalert/web.qtpl:254 qw422016.N().S(`=`) -//line app/vmalert/web.qtpl:235 +//line app/vmalert/web.qtpl:254 qw422016.E().S(ar.Labels[k]) -//line app/vmalert/web.qtpl:235 +//line app/vmalert/web.qtpl:254 qw422016.N().S(` - `) -//line app/vmalert/web.qtpl:236 + `) +//line app/vmalert/web.qtpl:255 } -//line app/vmalert/web.qtpl:236 +//line app/vmalert/web.qtpl:255 qw422016.N().S(` - `) -//line app/vmalert/web.qtpl:238 + `) +//line app/vmalert/web.qtpl:257 streambadgeState(qw422016, ar.State) -//line app/vmalert/web.qtpl:238 +//line app/vmalert/web.qtpl:257 qw422016.N().S(` - `) -//line app/vmalert/web.qtpl:240 + + `) +//line app/vmalert/web.qtpl:259 qw422016.E().S(ar.ActiveAt.Format("2006-01-02T15:04:05Z07:00")) -//line app/vmalert/web.qtpl:240 +//line app/vmalert/web.qtpl:259 qw422016.N().S(` - `) -//line app/vmalert/web.qtpl:241 + `) +//line app/vmalert/web.qtpl:260 if ar.Restored { -//line app/vmalert/web.qtpl:241 +//line app/vmalert/web.qtpl:260 streambadgeRestored(qw422016) -//line app/vmalert/web.qtpl:241 +//line app/vmalert/web.qtpl:260 } -//line app/vmalert/web.qtpl:241 +//line app/vmalert/web.qtpl:260 qw422016.N().S(` - `) -//line app/vmalert/web.qtpl:242 + `) +//line app/vmalert/web.qtpl:261 if ar.Stabilizing { -//line app/vmalert/web.qtpl:242 +//line app/vmalert/web.qtpl:261 streambadgeStabilizing(qw422016) -//line app/vmalert/web.qtpl:242 +//line app/vmalert/web.qtpl:261 } -//line app/vmalert/web.qtpl:242 +//line app/vmalert/web.qtpl:261 qw422016.N().S(` - `) -//line app/vmalert/web.qtpl:244 + `) +//line app/vmalert/web.qtpl:263 qw422016.E().S(ar.Value) -//line app/vmalert/web.qtpl:244 +//line app/vmalert/web.qtpl:263 qw422016.N().S(` - Details -
+ + +
`) -//line app/vmalert/web.qtpl:252 +//line app/vmalert/web.qtpl:272 } -//line app/vmalert/web.qtpl:252 +//line app/vmalert/web.qtpl:272 qw422016.N().S(`
-
`) -//line app/vmalert/web.qtpl:255 +//line app/vmalert/web.qtpl:274 } -//line app/vmalert/web.qtpl:255 +//line app/vmalert/web.qtpl:274 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:257 +//line app/vmalert/web.qtpl:276 } else { -//line app/vmalert/web.qtpl:257 +//line app/vmalert/web.qtpl:276 qw422016.N().S(`

No active alerts...

`) -//line app/vmalert/web.qtpl:261 +//line app/vmalert/web.qtpl:280 } -//line app/vmalert/web.qtpl:261 +//line app/vmalert/web.qtpl:280 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:263 +//line app/vmalert/web.qtpl:282 tpl.StreamFooter(qw422016, r) -//line app/vmalert/web.qtpl:263 +//line app/vmalert/web.qtpl:282 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 } -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 func WriteListAlerts(qq422016 qtio422016.Writer, r *http.Request, groupAlerts []groupAlerts) { -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 StreamListAlerts(qw422016, r, groupAlerts) -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 } -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 func ListAlerts(r *http.Request, groupAlerts []groupAlerts) string { -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 WriteListAlerts(qb422016, r, groupAlerts) -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 return qs422016 -//line app/vmalert/web.qtpl:265 +//line app/vmalert/web.qtpl:284 } -//line app/vmalert/web.qtpl:267 +//line app/vmalert/web.qtpl:286 func StreamListTargets(qw422016 *qt422016.Writer, r *http.Request, targets map[notifier.TargetType][]notifier.Target) { -//line app/vmalert/web.qtpl:267 +//line app/vmalert/web.qtpl:286 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:268 +//line app/vmalert/web.qtpl:287 tpl.StreamHeader(qw422016, r, navItems, "Notifiers", getLastConfigError()) -//line app/vmalert/web.qtpl:268 +//line app/vmalert/web.qtpl:287 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:269 +//line app/vmalert/web.qtpl:288 if len(targets) > 0 { -//line app/vmalert/web.qtpl:269 +//line app/vmalert/web.qtpl:288 qw422016.N().S(` Collapse All Expand All `) -//line app/vmalert/web.qtpl:274 +//line app/vmalert/web.qtpl:293 var keys []string for key := range targets { keys = append(keys, string(key)) } sort.Strings(keys) -//line app/vmalert/web.qtpl:279 +//line app/vmalert/web.qtpl:298 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:281 +//line app/vmalert/web.qtpl:300 for i := range keys { -//line app/vmalert/web.qtpl:281 +//line app/vmalert/web.qtpl:300 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:282 +//line app/vmalert/web.qtpl:301 typeK, ns := keys[i], targets[notifier.TargetType(keys[i])] count := len(ns) -//line app/vmalert/web.qtpl:284 +//line app/vmalert/web.qtpl:303 qw422016.N().S(`
@@ -1016,119 +1047,119 @@ func StreamListTargets(qw422016 *qt422016.Writer, r *http.Request, targets map[n `) -//line app/vmalert/web.qtpl:298 +//line app/vmalert/web.qtpl:317 for _, n := range ns { -//line app/vmalert/web.qtpl:298 +//line app/vmalert/web.qtpl:317 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:307 +//line app/vmalert/web.qtpl:326 } -//line app/vmalert/web.qtpl:307 +//line app/vmalert/web.qtpl:326 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:301 +//line app/vmalert/web.qtpl:320 for _, l := range n.Labels.GetLabels() { -//line app/vmalert/web.qtpl:301 +//line app/vmalert/web.qtpl:320 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:302 +//line app/vmalert/web.qtpl:321 qw422016.E().S(l.Name) -//line app/vmalert/web.qtpl:302 +//line app/vmalert/web.qtpl:321 qw422016.N().S(`=`) -//line app/vmalert/web.qtpl:302 +//line app/vmalert/web.qtpl:321 qw422016.E().S(l.Value) -//line app/vmalert/web.qtpl:302 +//line app/vmalert/web.qtpl:321 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:303 +//line app/vmalert/web.qtpl:322 } -//line app/vmalert/web.qtpl:303 +//line app/vmalert/web.qtpl:322 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:305 +//line app/vmalert/web.qtpl:324 qw422016.E().S(n.Notifier.Addr()) -//line app/vmalert/web.qtpl:305 +//line app/vmalert/web.qtpl:324 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:311 +//line app/vmalert/web.qtpl:330 } -//line app/vmalert/web.qtpl:311 +//line app/vmalert/web.qtpl:330 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:313 +//line app/vmalert/web.qtpl:332 } else { -//line app/vmalert/web.qtpl:313 +//line app/vmalert/web.qtpl:332 qw422016.N().S(`

No targets...

`) -//line app/vmalert/web.qtpl:317 +//line app/vmalert/web.qtpl:336 } -//line app/vmalert/web.qtpl:317 +//line app/vmalert/web.qtpl:336 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:319 +//line app/vmalert/web.qtpl:338 tpl.StreamFooter(qw422016, r) -//line app/vmalert/web.qtpl:319 +//line app/vmalert/web.qtpl:338 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 } -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 func WriteListTargets(qq422016 qtio422016.Writer, r *http.Request, targets map[notifier.TargetType][]notifier.Target) { -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 StreamListTargets(qw422016, r, targets) -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 } -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 func ListTargets(r *http.Request, targets map[notifier.TargetType][]notifier.Target) string { -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 WriteListTargets(qb422016, r, targets) -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 return qs422016 -//line app/vmalert/web.qtpl:321 +//line app/vmalert/web.qtpl:340 } -//line app/vmalert/web.qtpl:323 +//line app/vmalert/web.qtpl:342 func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) { -//line app/vmalert/web.qtpl:323 +//line app/vmalert/web.qtpl:342 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:324 +//line app/vmalert/web.qtpl:343 prefix := utils.Prefix(r.URL.Path) -//line app/vmalert/web.qtpl:324 +//line app/vmalert/web.qtpl:343 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:325 +//line app/vmalert/web.qtpl:344 tpl.StreamHeader(qw422016, r, navItems, "", getLastConfigError()) -//line app/vmalert/web.qtpl:325 +//line app/vmalert/web.qtpl:344 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:327 +//line app/vmalert/web.qtpl:346 var labelKeys []string for k := range alert.Labels { labelKeys = append(labelKeys, k) @@ -1141,28 +1172,28 @@ func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) { } sort.Strings(annotationKeys) -//line app/vmalert/web.qtpl:338 +//line app/vmalert/web.qtpl:357 qw422016.N().S(`
Alert: `) -//line app/vmalert/web.qtpl:339 +//line app/vmalert/web.qtpl:358 qw422016.E().S(alert.Name) -//line app/vmalert/web.qtpl:339 +//line app/vmalert/web.qtpl:358 qw422016.N().S(``) -//line app/vmalert/web.qtpl:339 +//line app/vmalert/web.qtpl:358 qw422016.E().S(alert.State) -//line app/vmalert/web.qtpl:339 +//line app/vmalert/web.qtpl:358 qw422016.N().S(`
@@ -1171,9 +1202,9 @@ func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) {
`) -//line app/vmalert/web.qtpl:346 +//line app/vmalert/web.qtpl:365 qw422016.E().S(alert.ActiveAt.Format("2006-01-02T15:04:05Z07:00")) -//line app/vmalert/web.qtpl:346 +//line app/vmalert/web.qtpl:365 qw422016.N().S(`
@@ -1185,9 +1216,9 @@ func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) {
`)
-//line app/vmalert/web.qtpl:356
+//line app/vmalert/web.qtpl:375
 	qw422016.E().S(alert.Expression)
-//line app/vmalert/web.qtpl:356
+//line app/vmalert/web.qtpl:375
 	qw422016.N().S(`
@@ -1199,23 +1230,23 @@ func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) {
`) -//line app/vmalert/web.qtpl:366 +//line app/vmalert/web.qtpl:385 for _, k := range labelKeys { -//line app/vmalert/web.qtpl:366 +//line app/vmalert/web.qtpl:385 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:367 +//line app/vmalert/web.qtpl:386 qw422016.E().S(k) -//line app/vmalert/web.qtpl:367 +//line app/vmalert/web.qtpl:386 qw422016.N().S(`=`) -//line app/vmalert/web.qtpl:367 +//line app/vmalert/web.qtpl:386 qw422016.E().S(alert.Labels[k]) -//line app/vmalert/web.qtpl:367 +//line app/vmalert/web.qtpl:386 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:368 +//line app/vmalert/web.qtpl:387 } -//line app/vmalert/web.qtpl:368 +//line app/vmalert/web.qtpl:387 qw422016.N().S(`
@@ -1227,24 +1258,24 @@ func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) {
`) -//line app/vmalert/web.qtpl:378 +//line app/vmalert/web.qtpl:397 for _, k := range annotationKeys { -//line app/vmalert/web.qtpl:378 +//line app/vmalert/web.qtpl:397 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:379 +//line app/vmalert/web.qtpl:398 qw422016.E().S(k) -//line app/vmalert/web.qtpl:379 +//line app/vmalert/web.qtpl:398 qw422016.N().S(`:

`) -//line app/vmalert/web.qtpl:380 +//line app/vmalert/web.qtpl:399 qw422016.E().S(alert.Annotations[k]) -//line app/vmalert/web.qtpl:380 +//line app/vmalert/web.qtpl:399 qw422016.N().S(`

`) -//line app/vmalert/web.qtpl:381 +//line app/vmalert/web.qtpl:400 } -//line app/vmalert/web.qtpl:381 +//line app/vmalert/web.qtpl:400 qw422016.N().S(`
@@ -1256,17 +1287,17 @@ func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) {
@@ -1278,66 +1309,66 @@ func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) {
Link
`) -//line app/vmalert/web.qtpl:405 +//line app/vmalert/web.qtpl:424 tpl.StreamFooter(qw422016, r) -//line app/vmalert/web.qtpl:405 +//line app/vmalert/web.qtpl:424 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 } -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 func WriteAlert(qq422016 qtio422016.Writer, r *http.Request, alert *apiAlert) { -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 StreamAlert(qw422016, r, alert) -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 } -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 func Alert(r *http.Request, alert *apiAlert) string { -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 WriteAlert(qb422016, r, alert) -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 return qs422016 -//line app/vmalert/web.qtpl:407 +//line app/vmalert/web.qtpl:426 } -//line app/vmalert/web.qtpl:410 +//line app/vmalert/web.qtpl:429 func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule) { -//line app/vmalert/web.qtpl:410 +//line app/vmalert/web.qtpl:429 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:411 +//line app/vmalert/web.qtpl:430 prefix := utils.Prefix(r.URL.Path) -//line app/vmalert/web.qtpl:411 +//line app/vmalert/web.qtpl:430 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:412 +//line app/vmalert/web.qtpl:431 tpl.StreamHeader(qw422016, r, navItems, "", getLastConfigError()) -//line app/vmalert/web.qtpl:412 +//line app/vmalert/web.qtpl:431 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:414 +//line app/vmalert/web.qtpl:433 var labelKeys []string for k := range rule.Labels { labelKeys = append(labelKeys, k) @@ -1361,28 +1392,28 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule) } } -//line app/vmalert/web.qtpl:437 +//line app/vmalert/web.qtpl:456 qw422016.N().S(`
Rule: `) -//line app/vmalert/web.qtpl:438 +//line app/vmalert/web.qtpl:457 qw422016.E().S(rule.Name) -//line app/vmalert/web.qtpl:438 +//line app/vmalert/web.qtpl:457 qw422016.N().S(``) -//line app/vmalert/web.qtpl:438 +//line app/vmalert/web.qtpl:457 qw422016.E().S(rule.Health) -//line app/vmalert/web.qtpl:438 +//line app/vmalert/web.qtpl:457 qw422016.N().S(`
@@ -1391,17 +1422,17 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule)
`)
-//line app/vmalert/web.qtpl:445
+//line app/vmalert/web.qtpl:464
 	qw422016.E().S(rule.Query)
-//line app/vmalert/web.qtpl:445
+//line app/vmalert/web.qtpl:464
 	qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:449 +//line app/vmalert/web.qtpl:468 if rule.Type == "alerting" { -//line app/vmalert/web.qtpl:449 +//line app/vmalert/web.qtpl:468 qw422016.N().S(`
@@ -1410,17 +1441,17 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule)
`) -//line app/vmalert/web.qtpl:456 +//line app/vmalert/web.qtpl:475 qw422016.E().V(rule.Duration) -//line app/vmalert/web.qtpl:456 +//line app/vmalert/web.qtpl:475 qw422016.N().S(` seconds
`) -//line app/vmalert/web.qtpl:460 +//line app/vmalert/web.qtpl:479 if rule.KeepFiringFor > 0 { -//line app/vmalert/web.qtpl:460 +//line app/vmalert/web.qtpl:479 qw422016.N().S(`
@@ -1429,22 +1460,22 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule)
`) -//line app/vmalert/web.qtpl:467 +//line app/vmalert/web.qtpl:486 qw422016.E().V(rule.KeepFiringFor) -//line app/vmalert/web.qtpl:467 +//line app/vmalert/web.qtpl:486 qw422016.N().S(` seconds
`) -//line app/vmalert/web.qtpl:471 +//line app/vmalert/web.qtpl:490 } -//line app/vmalert/web.qtpl:471 +//line app/vmalert/web.qtpl:490 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:472 +//line app/vmalert/web.qtpl:491 } -//line app/vmalert/web.qtpl:472 +//line app/vmalert/web.qtpl:491 qw422016.N().S(`
@@ -1453,31 +1484,31 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule)
`) -//line app/vmalert/web.qtpl:479 +//line app/vmalert/web.qtpl:498 for _, k := range labelKeys { -//line app/vmalert/web.qtpl:479 +//line app/vmalert/web.qtpl:498 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:480 +//line app/vmalert/web.qtpl:499 qw422016.E().S(k) -//line app/vmalert/web.qtpl:480 +//line app/vmalert/web.qtpl:499 qw422016.N().S(`=`) -//line app/vmalert/web.qtpl:480 +//line app/vmalert/web.qtpl:499 qw422016.E().S(rule.Labels[k]) -//line app/vmalert/web.qtpl:480 +//line app/vmalert/web.qtpl:499 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:481 +//line app/vmalert/web.qtpl:500 } -//line app/vmalert/web.qtpl:481 +//line app/vmalert/web.qtpl:500 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:485 +//line app/vmalert/web.qtpl:504 if rule.Type == "alerting" { -//line app/vmalert/web.qtpl:485 +//line app/vmalert/web.qtpl:504 qw422016.N().S(`
@@ -1486,24 +1517,24 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule)
`) -//line app/vmalert/web.qtpl:492 +//line app/vmalert/web.qtpl:511 for _, k := range annotationKeys { -//line app/vmalert/web.qtpl:492 +//line app/vmalert/web.qtpl:511 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:493 +//line app/vmalert/web.qtpl:512 qw422016.E().S(k) -//line app/vmalert/web.qtpl:493 +//line app/vmalert/web.qtpl:512 qw422016.N().S(`:

`) -//line app/vmalert/web.qtpl:494 +//line app/vmalert/web.qtpl:513 qw422016.E().S(rule.Annotations[k]) -//line app/vmalert/web.qtpl:494 +//line app/vmalert/web.qtpl:513 qw422016.N().S(`

`) -//line app/vmalert/web.qtpl:495 +//line app/vmalert/web.qtpl:514 } -//line app/vmalert/web.qtpl:495 +//line app/vmalert/web.qtpl:514 qw422016.N().S(`
@@ -1515,17 +1546,17 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule)
`) -//line app/vmalert/web.qtpl:505 +//line app/vmalert/web.qtpl:524 qw422016.E().V(rule.Debug) -//line app/vmalert/web.qtpl:505 +//line app/vmalert/web.qtpl:524 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:509 +//line app/vmalert/web.qtpl:528 } -//line app/vmalert/web.qtpl:509 +//line app/vmalert/web.qtpl:528 qw422016.N().S(`
@@ -1534,17 +1565,17 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule)
@@ -1552,9 +1583,9 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule)
`) -//line app/vmalert/web.qtpl:522 +//line app/vmalert/web.qtpl:541 if seriesFetchedWarning { -//line app/vmalert/web.qtpl:522 +//line app/vmalert/web.qtpl:541 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:534 +//line app/vmalert/web.qtpl:553 } -//line app/vmalert/web.qtpl:534 +//line app/vmalert/web.qtpl:553 qw422016.N().S(`
Last `) -//line app/vmalert/web.qtpl:535 +//line app/vmalert/web.qtpl:554 qw422016.N().D(len(rule.Updates)) -//line app/vmalert/web.qtpl:535 +//line app/vmalert/web.qtpl:554 qw422016.N().S(`/`) -//line app/vmalert/web.qtpl:535 +//line app/vmalert/web.qtpl:554 qw422016.N().D(rule.MaxUpdates) -//line app/vmalert/web.qtpl:535 +//line app/vmalert/web.qtpl:554 qw422016.N().S(` updates:
@@ -1587,13 +1618,13 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule) `) -//line app/vmalert/web.qtpl:541 +//line app/vmalert/web.qtpl:560 if seriesFetchedEnabled { -//line app/vmalert/web.qtpl:541 +//line app/vmalert/web.qtpl:560 qw422016.N().S(``) -//line app/vmalert/web.qtpl:541 +//line app/vmalert/web.qtpl:560 } -//line app/vmalert/web.qtpl:541 +//line app/vmalert/web.qtpl:560 qw422016.N().S(` @@ -1603,285 +1634,285 @@ func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule) `) -//line app/vmalert/web.qtpl:549 +//line app/vmalert/web.qtpl:568 for _, u := range rule.Updates { -//line app/vmalert/web.qtpl:549 +//line app/vmalert/web.qtpl:568 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:555 +//line app/vmalert/web.qtpl:574 if seriesFetchedEnabled { -//line app/vmalert/web.qtpl:555 +//line app/vmalert/web.qtpl:574 qw422016.N().S(``) -//line app/vmalert/web.qtpl:555 +//line app/vmalert/web.qtpl:574 } -//line app/vmalert/web.qtpl:555 +//line app/vmalert/web.qtpl:574 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:563 +//line app/vmalert/web.qtpl:582 if u.Err != nil { -//line app/vmalert/web.qtpl:563 +//line app/vmalert/web.qtpl:582 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:569 +//line app/vmalert/web.qtpl:588 } -//line app/vmalert/web.qtpl:569 +//line app/vmalert/web.qtpl:588 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:570 +//line app/vmalert/web.qtpl:589 } -//line app/vmalert/web.qtpl:570 +//line app/vmalert/web.qtpl:589 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:572 +//line app/vmalert/web.qtpl:591 tpl.StreamFooter(qw422016, r) -//line app/vmalert/web.qtpl:572 +//line app/vmalert/web.qtpl:591 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 } -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 func WriteRuleDetails(qq422016 qtio422016.Writer, r *http.Request, rule apiRule) { -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 StreamRuleDetails(qw422016, r, rule) -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 } -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 func RuleDetails(r *http.Request, rule apiRule) string { -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 WriteRuleDetails(qb422016, r, rule) -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 return qs422016 -//line app/vmalert/web.qtpl:573 +//line app/vmalert/web.qtpl:592 } -//line app/vmalert/web.qtpl:577 +//line app/vmalert/web.qtpl:596 func streambadgeState(qw422016 *qt422016.Writer, state string) { -//line app/vmalert/web.qtpl:577 +//line app/vmalert/web.qtpl:596 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:579 +//line app/vmalert/web.qtpl:598 badgeClass := "bg-warning text-dark" if state == "firing" { badgeClass = "bg-danger" } -//line app/vmalert/web.qtpl:583 +//line app/vmalert/web.qtpl:602 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:584 +//line app/vmalert/web.qtpl:603 qw422016.E().S(state) -//line app/vmalert/web.qtpl:584 +//line app/vmalert/web.qtpl:603 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 } -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 func writebadgeState(qq422016 qtio422016.Writer, state string) { -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 streambadgeState(qw422016, state) -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 } -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 func badgeState(state string) string { -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 writebadgeState(qb422016, state) -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 return qs422016 -//line app/vmalert/web.qtpl:585 +//line app/vmalert/web.qtpl:604 } -//line app/vmalert/web.qtpl:587 +//line app/vmalert/web.qtpl:606 func streambadgeRestored(qw422016 *qt422016.Writer) { -//line app/vmalert/web.qtpl:587 +//line app/vmalert/web.qtpl:606 qw422016.N().S(` restored `) -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 } -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 func writebadgeRestored(qq422016 qtio422016.Writer) { -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 streambadgeRestored(qw422016) -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 } -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 func badgeRestored() string { -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 writebadgeRestored(qb422016) -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 return qs422016 -//line app/vmalert/web.qtpl:589 +//line app/vmalert/web.qtpl:608 } -//line app/vmalert/web.qtpl:591 +//line app/vmalert/web.qtpl:610 func streambadgeStabilizing(qw422016 *qt422016.Writer) { -//line app/vmalert/web.qtpl:591 +//line app/vmalert/web.qtpl:610 qw422016.N().S(` stabilizing `) -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 } -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 func writebadgeStabilizing(qq422016 qtio422016.Writer) { -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 streambadgeStabilizing(qw422016) -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 } -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 func badgeStabilizing() string { -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 writebadgeStabilizing(qb422016) -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 return qs422016 -//line app/vmalert/web.qtpl:593 +//line app/vmalert/web.qtpl:612 } -//line app/vmalert/web.qtpl:595 +//line app/vmalert/web.qtpl:614 func streamseriesFetchedWarn(qw422016 *qt422016.Writer, r apiRule) { -//line app/vmalert/web.qtpl:595 +//line app/vmalert/web.qtpl:614 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:596 +//line app/vmalert/web.qtpl:615 if isNoMatch(r) { -//line app/vmalert/web.qtpl:596 +//line app/vmalert/web.qtpl:615 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:605 +//line app/vmalert/web.qtpl:624 } -//line app/vmalert/web.qtpl:605 +//line app/vmalert/web.qtpl:624 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 } -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 func writeseriesFetchedWarn(qq422016 qtio422016.Writer, r apiRule) { -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 qw422016 := qt422016.AcquireWriter(qq422016) -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 streamseriesFetchedWarn(qw422016, r) -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 qt422016.ReleaseWriter(qw422016) -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 } -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 func seriesFetchedWarn(r apiRule) string { -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 qb422016 := qt422016.AcquireByteBuffer() -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 writeseriesFetchedWarn(qb422016, r) -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 qs422016 := string(qb422016.B) -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 qt422016.ReleaseByteBuffer(qb422016) -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 return qs422016 -//line app/vmalert/web.qtpl:606 +//line app/vmalert/web.qtpl:625 } -//line app/vmalert/web.qtpl:609 +//line app/vmalert/web.qtpl:628 func isNoMatch(r apiRule) bool { return r.LastSamples == 0 && r.LastSeriesFetched != nil && *r.LastSeriesFetched == 0 } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6a4bc7ec2a..ad568fd2c6 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -62,6 +62,7 @@ Released at 2024-02-14 * FEATURE: [dashboards/vmagent](https://grafana.com/grafana/dashboards/12683): add `Targets scraped/s` stat panel showing the number of targets scraped by the vmagent per-second. * FEATURE: [dashboards/all](https://grafana.com/orgs/victoriametrics): add new panel `CPU spent on GC`. It should help identifying cases when too much CPU is spent on garbage collection, and advice users on how this can be addressed. * FEATURE: [vmalert](https://docs.victoriametrics.com/#vmalert): support [filtering](https://prometheus.io/docs/prometheus/2.49/querying/api/#rules) for `/api/v1/rules` API. See [the pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5749) by @victoramsantos. +* FEATURE: [vmalert](https://docs.victoriametrics.com/#vmalert): support filtering by group, rule or labels in [vmalert's UI](https://docs.victoriametrics.com/vmalert/#web) for `/groups` and `/alerts` pages. See [the pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5791) by @victoramsantos. * FEATURE: [vmbackup](https://docs.victoriametrics.com/vmbackup.html): support client-side TLS configuration for creating and deleting snapshots via `-snapshot.tls*` cmd-line flags. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5724). Thanks to @khushijain21 for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5738). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): reduce CPU usage when `-promscrape.dropOriginalLabels` command-line flag is set. This issue has been introduced in [v1.96.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.96.0) when addressing [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5389).
Updated at SamplesSeries fetchedDuration Executed at
`) -//line app/vmalert/web.qtpl:552 +//line app/vmalert/web.qtpl:571 qw422016.E().S(u.Time.Format(time.RFC3339)) -//line app/vmalert/web.qtpl:552 +//line app/vmalert/web.qtpl:571 qw422016.N().S(` `) -//line app/vmalert/web.qtpl:554 +//line app/vmalert/web.qtpl:573 qw422016.N().D(u.Samples) -//line app/vmalert/web.qtpl:554 +//line app/vmalert/web.qtpl:573 qw422016.N().S(``) -//line app/vmalert/web.qtpl:555 +//line app/vmalert/web.qtpl:574 if u.SeriesFetched != nil { -//line app/vmalert/web.qtpl:555 +//line app/vmalert/web.qtpl:574 qw422016.N().D(*u.SeriesFetched) -//line app/vmalert/web.qtpl:555 +//line app/vmalert/web.qtpl:574 } -//line app/vmalert/web.qtpl:555 +//line app/vmalert/web.qtpl:574 qw422016.N().S(``) -//line app/vmalert/web.qtpl:556 +//line app/vmalert/web.qtpl:575 qw422016.N().FPrec(u.Duration.Seconds(), 3) -//line app/vmalert/web.qtpl:556 +//line app/vmalert/web.qtpl:575 qw422016.N().S(`s `) -//line app/vmalert/web.qtpl:557 +//line app/vmalert/web.qtpl:576 qw422016.E().S(u.At.Format(time.RFC3339)) -//line app/vmalert/web.qtpl:557 +//line app/vmalert/web.qtpl:576 qw422016.N().S(`
`) -//line app/vmalert/web.qtpl:566 +//line app/vmalert/web.qtpl:585 qw422016.E().V(u.Err) -//line app/vmalert/web.qtpl:566 +//line app/vmalert/web.qtpl:585 qw422016.N().S(`