Skip to content
Draft
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
17 changes: 12 additions & 5 deletions alertmanager/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ var pdpTasks = []string{
// taskFailureCheckWith is the parameterized core shared by taskFailureCheck
// and pdpTaskFailureCheck. It alerts on final task failures over the given
// interval: any final failure in sensitiveTasks, and >5 final failures for all
// other tasks or machines.
func taskFailureCheckWith(al *alerts, name AlertName, interval time.Duration, sensitiveTasks []string) {
// other in-scope tasks or machines.
func taskFailureCheckWith(al *alerts, name AlertName, interval time.Duration, sensitiveTasks []string, inScope func(taskName string) bool) {
al.alertMap[name] = &alertOut{}

type taskFailure struct {
Expand Down Expand Up @@ -231,6 +231,9 @@ func taskFailureCheckWith(al *alerts, name AlertName, interval time.Duration, se
tmap := make(map[string]int)

for _, tf := range taskFailures {
if !inScope(tf.Name) {
continue
}
tmap[tf.Name] += tf.Failures
mmap[tf.Machine] += tf.Failures
}
Expand All @@ -248,15 +251,19 @@ func taskFailureCheckWith(al *alerts, name AlertName, interval time.Duration, se
}
}

// taskFailureCheck checks all tasks over the last FullAlertInterval.
// taskFailureCheck checks all non-PDP tasks over the last FullAlertInterval.
func taskFailureCheck(al *alerts) {
taskFailureCheckWith(al, Name_TaskFailures, FullAlertInterval, sealingTasks)
taskFailureCheckWith(al, Name_TaskFailures, FullAlertInterval, sealingTasks, func(taskName string) bool {
return !slices.Contains(pdpTasks, taskName)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will basically ensure that any important task not part of the array will be ignored. That's not a good choice.

})
}

// pdpTaskFailureCheck checks PDP (v1 and v0) tasks over the last
// AlertMangerInterval so failures surface on every ping-health cadence.
func pdpTaskFailureCheck(al *alerts) {
taskFailureCheckWith(al, Name_PDPTaskFailures, AlertManagerInterval, pdpTasks)
taskFailureCheckWith(al, Name_PDPTaskFailures, AlertManagerInterval, pdpTasks, func(taskName string) bool {
return slices.Contains(pdpTasks, taskName)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will basically ensure that any important task not part of the array will be ignored. That's not a good choice.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be an inaccuracy here. But the tasks in the list all take a 5-minute route, and the rest that are not here still follow the previous 30-minute route?

})
}

// permanentStorageCheck retrieves the storage details from the database and checks if there is sufficient space for sealing sectors.
Expand Down
Loading