2023-06-22 14:59:23 -07:00
|
|
|
package alert
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/wormhole-foundation/wormhole-explorer/common/client/alert"
|
|
|
|
)
|
|
|
|
|
|
|
|
// alert key constants definition.
|
|
|
|
const (
|
2023-06-27 08:17:33 -07:00
|
|
|
ErrorSaveVAA = "ERROR_SAVE_VAA"
|
|
|
|
ErrorSavePyth = "ERROR_SAVE_PYTH"
|
|
|
|
ErrorSaveObservation = "ERROR_SAVE_OBSERVATION"
|
|
|
|
ErrorSaveHeartbeat = "ERROR_SAVE_HEARTBEAT"
|
|
|
|
ErrorSaveGovernorStatus = "ERROR_SAVE_GOVERNOR_STATUS"
|
2023-07-25 11:39:27 -07:00
|
|
|
ErrorSaveGovernorConfig = "ERROR_SAVE_GOVERNOR_CONFIG"
|
|
|
|
|
|
|
|
// warning alerts
|
|
|
|
GuardianSetUnknown = "GUARDIAN_SET_UNKNOWN"
|
|
|
|
ObservationWithoutTxHash = "OBSERVATION_WITHOUT_TX_HASH"
|
2023-06-22 14:59:23 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func LoadAlerts(cfg alert.AlertConfig) map[string]alert.Alert {
|
|
|
|
alerts := make(map[string]alert.Alert)
|
|
|
|
|
2023-06-27 08:17:33 -07:00
|
|
|
// Alert error saving vaa.
|
2023-06-22 14:59:23 -07:00
|
|
|
alerts[ErrorSaveVAA] = alert.Alert{
|
|
|
|
Alias: ErrorSaveVAA,
|
2023-07-06 07:20:18 -07:00
|
|
|
Message: fmt.Sprintf("[%s] %s", cfg.Environment, "Error saving VAA in vaas collection"),
|
2023-06-22 14:59:23 -07:00
|
|
|
Description: "An error was found persisting the vaa in mongo in the vaas collection.",
|
|
|
|
Actions: []string{"check vaas collection, vaa may have persisted by retry", "check dead letter queue"},
|
2023-07-06 07:20:18 -07:00
|
|
|
Tags: []string{cfg.Environment, "fly", "vaa", "mongo"},
|
2023-06-22 14:59:23 -07:00
|
|
|
Entity: "fly",
|
|
|
|
Priority: alert.CRITICAL,
|
|
|
|
}
|
2023-06-27 08:17:33 -07:00
|
|
|
// Alert error saving pyth
|
|
|
|
alerts[ErrorSavePyth] = alert.Alert{
|
|
|
|
Alias: ErrorSavePyth,
|
2023-07-06 07:20:18 -07:00
|
|
|
Message: fmt.Sprintf("[%s] %s", cfg.Environment, "Error saving pyth in vaasPythnet collection"),
|
2023-06-27 08:17:33 -07:00
|
|
|
Description: "An error was found persisting the pyth in mongo in the vaasPythnet collection.",
|
|
|
|
Actions: []string{"pyth may have persisted by retry"},
|
2023-07-06 07:20:18 -07:00
|
|
|
Tags: []string{cfg.Environment, "fly", "vaasPythnet", "mongo"},
|
2023-06-27 08:17:33 -07:00
|
|
|
Entity: "fly",
|
|
|
|
Priority: alert.INFORMATIONAL,
|
|
|
|
}
|
|
|
|
// Alert error saving observation
|
|
|
|
alerts[ErrorSaveObservation] = alert.Alert{
|
|
|
|
Alias: ErrorSaveObservation,
|
2023-07-06 07:20:18 -07:00
|
|
|
Message: fmt.Sprintf("[%s] %s", cfg.Environment, "Error saving observation in observations collection"),
|
2023-06-27 08:17:33 -07:00
|
|
|
Description: "An error was found persisting the observation in mongo in the observations collection.",
|
|
|
|
Actions: []string{},
|
2023-07-06 07:20:18 -07:00
|
|
|
Tags: []string{cfg.Environment, "fly", "observations", "mongo"},
|
2023-06-27 08:17:33 -07:00
|
|
|
Entity: "fly",
|
|
|
|
Priority: alert.CRITICAL,
|
|
|
|
}
|
|
|
|
// Alert error saving heartbeat
|
|
|
|
alerts[ErrorSaveHeartbeat] = alert.Alert{
|
|
|
|
Alias: ErrorSaveHeartbeat,
|
2023-07-06 07:20:18 -07:00
|
|
|
Message: fmt.Sprintf("[%s] %s", cfg.Environment, "Error saving heartbeat in heartbeats collection"),
|
2023-06-27 08:17:33 -07:00
|
|
|
Description: "An error was found persisting the heartbeat in mongo in the heartbeats collection.",
|
|
|
|
Actions: []string{},
|
2023-07-06 07:20:18 -07:00
|
|
|
Tags: []string{cfg.Environment, "fly", "heartbeats", "mongo"},
|
2023-06-27 08:17:33 -07:00
|
|
|
Entity: "fly",
|
|
|
|
Priority: alert.CRITICAL,
|
|
|
|
}
|
|
|
|
alerts[ErrorSaveGovernorStatus] = alert.Alert{
|
|
|
|
Alias: ErrorSaveGovernorStatus,
|
2023-07-06 07:20:18 -07:00
|
|
|
Message: fmt.Sprintf("[%s] %s", cfg.Environment, "Error saving governor status in governorStatus collection"),
|
2023-06-27 08:17:33 -07:00
|
|
|
Description: "An error was found persisting the governor status in mongo in the governorStatus collection.",
|
|
|
|
Actions: []string{},
|
2023-07-06 07:20:18 -07:00
|
|
|
Tags: []string{cfg.Environment, "fly", "governorStatus", "mongo"},
|
2023-06-27 08:17:33 -07:00
|
|
|
Entity: "fly",
|
|
|
|
Priority: alert.CRITICAL,
|
|
|
|
}
|
2023-07-25 11:39:27 -07:00
|
|
|
alerts[ErrorSaveGovernorConfig] = alert.Alert{
|
|
|
|
Alias: ErrorSaveGovernorConfig,
|
2023-07-06 07:20:18 -07:00
|
|
|
Message: fmt.Sprintf("[%s] %s", cfg.Environment, "Error saving governor config in governorConfig collection"),
|
2023-06-27 08:17:33 -07:00
|
|
|
Description: "An error was found persisting the governor config in mongo in the governorConfig collection.",
|
|
|
|
Actions: []string{},
|
2023-07-06 07:20:18 -07:00
|
|
|
Tags: []string{cfg.Environment, "fly", "governorConfig", "mongo"},
|
2023-06-27 08:17:33 -07:00
|
|
|
Entity: "fly",
|
|
|
|
Priority: alert.CRITICAL,
|
|
|
|
}
|
2023-07-25 11:39:27 -07:00
|
|
|
alerts[GuardianSetUnknown] = alert.Alert{
|
|
|
|
Alias: GuardianSetUnknown,
|
|
|
|
Message: fmt.Sprintf("[%s] %s", cfg.Environment, "Guardian set unknown"),
|
|
|
|
Description: "The guardian set from the vaa is unknown.",
|
|
|
|
Actions: []string{},
|
|
|
|
Tags: []string{cfg.Environment, "fly", "guardianSet", "vaa"},
|
|
|
|
Entity: "fly",
|
|
|
|
Priority: alert.INFORMATIONAL,
|
|
|
|
}
|
2023-06-22 14:59:23 -07:00
|
|
|
return alerts
|
|
|
|
}
|