Skip to content

Commit 90bd461

Browse files
authored
instancehealth: remove monitoring check (#920)
Removes usage of the endpoint deprecated in https://github.com/sourcegraph/sourcegraph/pull/46299, related to sourcegraph/customer#1525
1 parent 6d72b3f commit 90bd461

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

internal/instancehealth/checks.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package instancehealth
22

33
import (
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
11784
func checkExternalServices(
11885
out output.Writer,

0 commit comments

Comments
 (0)