Skip to content

Commit 5fa97a8

Browse files
committed
fix linter
1 parent c099915 commit 5fa97a8

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

pkg/handler/alertingmock/alerting_mock.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package alertingmock
22

33
import (
4-
"context"
54
"encoding/json"
65
"fmt"
76
"math/rand/v2"
@@ -58,9 +57,8 @@ func randomState() int {
5857
return silenced
5958
} else if rndState < 3 {
6059
return pending
61-
} else {
62-
return firing
6360
}
61+
return firing
6462
}
6563

6664
func createAlert(probability float64, name, resourceName string, threshold int, targetLabels, resourceNames []string, annotations, labels model.LabelSet) (*Alert, int) {
@@ -158,8 +156,8 @@ func createRule(probability float64, name, severity string, threshold int, bynet
158156
}
159157
}
160158

161-
func GetRules(ctx context.Context) func(w http.ResponseWriter, r *http.Request) {
162-
return func(w http.ResponseWriter, r *http.Request) {
159+
func GetRules() func(w http.ResponseWriter, r *http.Request) {
160+
return func(w http.ResponseWriter, _ *http.Request) {
163161
alertingRules := []AlertingRule{
164162
createRule(0.4, "Packet delivery successfully failed", "info", 5, true, []string{"SrcK8S_Namespace", "DstK8S_Namespace"}, []string{}),
165163
createRule(0.3, "You have reached your hourly rate limit", "info", 5, true, []string{"SrcK8S_Namespace", "DstK8S_Namespace"}, []string{}),

pkg/server/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func setupRoutes(ctx context.Context, cfg *config.Config, authChecker auth.Check
7575

7676
if cfg.Loki.UseMocks {
7777
// Add route for alerts (otherwise, the route is provided by the Console itself)
78-
api.HandleFunc("/prometheus/api/v1/rules", alertingmock.GetRules(ctx))
78+
api.HandleFunc("/prometheus/api/v1/rules", alertingmock.GetRules())
7979
}
8080

8181
return r

web/src/components/health/health-drawer-container.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export const HealthDrawerContainer: React.FC<HealthDrawerContainerProps> = ({ ti
4646
setSelectedResource(fromStats);
4747
}
4848
}
49+
// we want to update selectedResource when stats changes, no more
50+
// eslint-disable-next-line react-hooks/exhaustive-deps
4951
}, [stats]);
5052

5153
return (

web/src/components/health/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export const computeAlertScore = (a: AlertWithRuleName, ignoreSeverity?: boolean
278278
};
279279

280280
export const isSilenced = (silence: SilenceMatcher[], labels: PrometheusLabels): boolean => {
281-
for (let matcher of silence) {
281+
for (const matcher of silence) {
282282
if (!(matcher.name in labels)) {
283283
return false;
284284
}

0 commit comments

Comments
 (0)