@@ -2,7 +2,6 @@ package instancehealth
22
33import (
44 "fmt"
5- "strings"
65 "time"
76
87 "github.com/sourcegraph/sourcegraph/lib/errors"
@@ -31,11 +30,6 @@ func NewChecks(
3130 defer b .Close ()
3231 return checkSiteConfiguration (b , instanceHealth )
3332 },
34- func (out * output.Output ) error {
35- b := out .Block (output .Styled (output .StyleBold , "Monitoring alerts" ))
36- defer b .Close ()
37- return checkMonitoringAlerts (b , since , instanceHealth )
38- },
3933 func (out * output.Output ) error {
4034 b := out .Block (output .Styled (output .StyleBold , "External services" ))
4135 defer b .Close ()
@@ -86,33 +80,6 @@ func checkSiteConfiguration(
8680 return nil
8781}
8882
89- // checkMonitoringAlerts indicates if there are any alerts issued by monitoring infra
90- func checkMonitoringAlerts (
91- out output.Writer ,
92- since time.Duration ,
93- instanceHealth Indicators ,
94- ) error {
95- var criticalAlerts int
96- for _ , a := range instanceHealth .Site .MonitoringStatistics .Alerts {
97- if a .Average == 0 || ! strings .Contains (strings .ToLower (a .Name ), "critical" ) {
98- continue
99- }
100- // average is ratio of 12h windows that alert was active, so we set the threshold
101- // if it's possible this alert could have been active in this 'since' window.
102- if a .Average * 0.5 >= since .Hours ()/ 12 {
103- criticalAlerts += 1
104- out .WriteLine (output .Linef (output .EmojiWarning , output .StyleWarning ,
105- "Found recently active alert: %q" , a .Name ))
106- }
107- }
108- if criticalAlerts == 0 {
109- out .WriteLine (output .Emoji (output .EmojiSuccess , "No critical monitoring alerts!" ))
110- }
111- // never error, just issue printed warning, since critical alerts aren't all _that_
112- // reliable today, though they provide a potentially useful signal.
113- return nil
114- }
115-
11683// checkExternalServices checks the health of external service syncing
11784func checkExternalServices (
11885 out output.Writer ,
0 commit comments