Skip to content

Commit 8249e16

Browse files
committed
If metrics are not supported, set metric to -1
Signed-off-by: Davanum Srinivas <[email protected]>
1 parent 3314372 commit 8249e16

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

fault-quarantine/pkg/eventwatcher/event_watcher.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ type EventWatcherInterface interface {
4646
Start(ctx context.Context) error
4747
SetProcessEventCallback(
4848
callback func(
49-
ctx context.Context,
50-
event *model.HealthEventWithStatus,
51-
) *model.Status,
49+
ctx context.Context,
50+
event *model.HealthEventWithStatus,
51+
) *model.Status,
5252
)
5353
CancelLatestQuarantiningEvents(ctx context.Context, nodeName string) error
5454
}
@@ -69,9 +69,9 @@ func NewEventWatcher(
6969

7070
func (w *EventWatcher) SetProcessEventCallback(
7171
callback func(
72-
ctx context.Context,
73-
event *model.HealthEventWithStatus,
74-
) *model.Status,
72+
ctx context.Context,
73+
event *model.HealthEventWithStatus,
74+
) *model.Status,
7575
) {
7676
w.processEventCallback = callback
7777
}
@@ -196,9 +196,8 @@ func (w *EventWatcher) updateUnprocessedEventsMetric(ctx context.Context) {
196196
metrics.EventBacklogSize.Set(float64(unprocessedCount))
197197
slog.Debug("Updated unprocessed events metric", "count", unprocessedCount, "afterObjectID", objID)
198198
} else {
199-
// If metrics are not supported, set metric to 0 or skip
200199
slog.Debug("Change stream watcher does not support metrics")
201-
metrics.EventBacklogSize.Set(0)
200+
metrics.EventBacklogSize.Set(-1)
202201
}
203202
}
204203
}

0 commit comments

Comments
 (0)