Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Sentinel) Add missing check increment #2248

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions node/pkg/checker/event/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,19 @@ func checkGroupedFeeds(ctx context.Context, feedsByInterval map[int][]FeedToChec
}

func checkFeeds(ctx context.Context, feedsToCheck []FeedToCheck) {
log.Debug().Msg("Checking feed submissions")
msg := ""
totalDelayed := 0
for i := range feedsToCheck {
// msg += checkEachFeed(ctx, &feedsToCheck[i])
offset, err := timeSinceLastFeedEvent(ctx, feedsToCheck[i])
if err != nil {
log.Error().Err(err).Str("feed", feedsToCheck[i].FeedName).Msg("Failed to check feed")
continue
}

if offset > time.Duration(feedsToCheck[i].ExpectedInterval)*time.Millisecond*2 {
feedsToCheck[i].LatencyChecked++

log.Warn().Str("feed", feedsToCheck[i].FeedName).Msg(fmt.Sprintf("%s delayed by %s", feedsToCheck[i].FeedName, offset-time.Duration(feedsToCheck[i].ExpectedInterval)*time.Millisecond))
if feedsToCheck[i].LatencyChecked > AlarmOffsetPerPair {
msg += fmt.Sprintf("(REPORTER) %s delayed by %s\n", feedsToCheck[i].FeedName, offset-time.Duration(feedsToCheck[i].ExpectedInterval)*time.Millisecond)
Expand All @@ -174,6 +176,7 @@ func checkFeeds(ctx context.Context, feedsToCheck []FeedToCheck) {
if msg != "" {
alert.SlackAlert(msg)
}
log.Debug().Msg("Checked feed submission delays")
}

func checkPorAndVrf(ctx context.Context, checkList *CheckList) {
Expand Down Expand Up @@ -297,19 +300,3 @@ func loadSubgraphInfoMap(ctx context.Context) (map[string]SubgraphInfo, error) {

return subgraphInfoMap, nil
}

func handleFeedSubmissionDelay(offset time.Duration, feed *FeedToCheck) string {
msg := ""
if offset > time.Duration(feed.ExpectedInterval)*time.Millisecond*2 {
log.Warn().Str("feed", feed.FeedName).Msg(fmt.Sprintf("%s delayed by %s", feed.FeedName, offset-time.Duration(feed.ExpectedInterval)*time.Millisecond))
feed.LatencyChecked++
if feed.LatencyChecked > AlarmOffsetPerPair {
msg += fmt.Sprintf("(REPORTER) %s delayed by %s\n", feed.FeedName, offset-time.Duration(feed.ExpectedInterval)*time.Millisecond)
feed.LatencyChecked = 0
}
} else {
feed.LatencyChecked = 0
}

return msg
}