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

feat: alert: Add FVM_CONCURRENCY alert #10933

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions node/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const (

// health checks
CheckFDLimit
CheckFvmConcurrency
LegacyMarketsEOL

// libp2p
Expand Down Expand Up @@ -165,6 +166,7 @@ func defaults() []Option {
Override(new(dtypes.NodeStartTime), FromVal(dtypes.NodeStartTime(time.Now()))),

Override(CheckFDLimit, modules.CheckFdLimit(build.DefaultFDLimit)),
Override(CheckFvmConcurrency, modules.CheckFvmConcurrency()),

Override(new(system.MemoryConstraints), modules.MemoryConstraints),
Override(InitMemoryWatchdog, modules.MemoryWatchdog),
Expand Down
32 changes: 32 additions & 0 deletions node/modules/alerts.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package modules

import (
"os"
"strconv"

"github.com/filecoin-project/lotus/journal/alerting"
"github.com/filecoin-project/lotus/lib/ulimit"
)
Expand Down Expand Up @@ -42,6 +45,35 @@ func LegacyMarketsEOL(al *alerting.Alerting) {
})
}

func CheckFvmConcurrency() func(al *alerting.Alerting) {
return func(al *alerting.Alerting) {
fvmConcurrency, ok := os.LookupEnv("LOTUS_FVM_CONCURRENCY")
if !ok {
return
}

fvmConcurrencyVal, err := strconv.Atoi(fvmConcurrency)
if err != nil {
alert := al.AddAlertType("process", "fvm-concurrency")
al.Raise(alert, map[string]string{
"message": "LOTUS_FVM_CONCURRENCY is not an integer",
"error": err.Error(),
})
return
}

// Raise alert if LOTUS_FVM_CONCURRENCY is set to a high value
if fvmConcurrencyVal > 24 {
alert := al.AddAlertType("process", "fvm-concurrency")
al.Raise(alert, map[string]interface{}{
"message": "LOTUS_FVM_CONCURRENCY is set to a high value that can cause chain sync panics on network migrations/upgrades",
"set_value": fvmConcurrencyVal,
"recommended": "24 or less during network upgrades",
})
}
}
}

// TODO: More things:
// * Space in repo dirs (taking into account mounts)
// * Miner
Expand Down