cmd

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RPCTimeoutSeconds = 5
)

Variables

This section is empty.

Functions

func Execute

func Execute()

Types

type AlertActive

type AlertActive interface {
	Active(config AlertConfig) bool
}

type AlertConfig

type AlertConfig struct {
	IgnoreAlerts []*AlertType `yaml:"ignore-alerts"`
}

func (*AlertConfig) AlertActive

func (at *AlertConfig) AlertActive(alert AlertType) bool

type AlertLevel

type AlertLevel int8

type AlertType

type AlertType string

func (*AlertType) UnmarshalYAML

func (at *AlertType) UnmarshalYAML(unmarshal func(interface{}) error) error

type BlockFetchError

type BlockFetchError struct {
	// contains filtered or unexported fields
}

func (*BlockFetchError) Active

func (e *BlockFetchError) Active(config AlertConfig) bool

func (*BlockFetchError) Error

func (e *BlockFetchError) Error() string

type ChainHaltError

type ChainHaltError struct {
	// contains filtered or unexported fields
}

func (*ChainHaltError) Active

func (e *ChainHaltError) Active(config AlertConfig) bool

func (*ChainHaltError) Error

func (e *ChainHaltError) Error() string

type DiscordChannelConfig

type DiscordChannelConfig struct {
	Webhook      DiscordWebhookConfig `yaml:"webhook"`
	AlertUserIDs []string             `yaml:"alert-user-ids"`
	Username     string               `yaml:"username"`
}

type DiscordNotificationService

type DiscordNotificationService struct {
	// contains filtered or unexported fields
}

func NewDiscordNotificationService

func NewDiscordNotificationService(webhookID, webhookToken string) *DiscordNotificationService

func (*DiscordNotificationService) SendValidatorAlertNotification

func (service *DiscordNotificationService) SendValidatorAlertNotification(
	config *HalfLifeConfig,
	vm *ValidatorMonitor,
	stats ValidatorStats,
	alertNotification *ValidatorAlertNotification,
)

implements NotificationService interface

func (*DiscordNotificationService) UpdateValidatorRealtimeStatus

func (service *DiscordNotificationService) UpdateValidatorRealtimeStatus(
	statusFile string,
	config *HalfLifeConfig,
	status *HalfLifeStatus,
	vm *ValidatorMonitor,
	vmStatus *ValidatorStatus,
	stats ValidatorStats,

	writeConfigMutex *sync.Mutex,
)

implements NotificationService interface

type DiscordWebhookConfig

type DiscordWebhookConfig struct {
	ID    string `yaml:"id"`
	Token string `yaml:"token"`
}

type GenericRPCError

type GenericRPCError struct {
	// contains filtered or unexported fields
}

func (*GenericRPCError) Active

func (e *GenericRPCError) Active(config AlertConfig) bool

func (*GenericRPCError) Error

func (e *GenericRPCError) Error() string

type HalfLifeConfig

type HalfLifeConfig struct {
	AlertConfig   AlertConfig          `yaml:"alerts"`
	Notifications *NotificationsConfig `yaml:"notifications"`
	Validators    []*ValidatorMonitor  `yaml:"validators"`
}

type HalfLifeStatus

type HalfLifeStatus struct {
	Validators []*ValidatorStatus `yaml:"validators"`
}

type IgnorableError

type IgnorableError interface {
	error
	AlertActive
}

type JailedError

type JailedError struct {
	// contains filtered or unexported fields
}

func (*JailedError) Active

func (e *JailedError) Active(config AlertConfig) bool

func (*JailedError) Error

func (e *JailedError) Error() string

type MissedRecentBlocksError

type MissedRecentBlocksError struct {
	// contains filtered or unexported fields
}

func (*MissedRecentBlocksError) Active

func (e *MissedRecentBlocksError) Active(config AlertConfig) bool

func (*MissedRecentBlocksError) Error

func (e *MissedRecentBlocksError) Error() string

type NotificationService

type NotificationService interface {
	// send one time alert for validator
	SendValidatorAlertNotification(config *HalfLifeConfig, vm *ValidatorMonitor, stats ValidatorStats, alertNotification *ValidatorAlertNotification)

	// update (or create) realtime status for validator
	UpdateValidatorRealtimeStatus(statusFile string, config *HalfLifeConfig, status *HalfLifeStatus, vm *ValidatorMonitor, vmStatus *ValidatorStatus, stats ValidatorStats, writeConfigMutex *sync.Mutex)
}

type NotificationsConfig

type NotificationsConfig struct {
	Service string                `yaml:"service"`
	Discord *DiscordChannelConfig `yaml:"discord"`
}

type OutOfSyncError

type OutOfSyncError struct {
	// contains filtered or unexported fields
}

func (*OutOfSyncError) Active

func (e *OutOfSyncError) Active(config AlertConfig) bool

func (*OutOfSyncError) Error

func (e *OutOfSyncError) Error() string

type Sentry

type Sentry struct {
	Name string `yaml:"name"`
	GRPC string `yaml:"grpc"`
}

type SentryAlertType

type SentryAlertType int8

type SentryGRPCError

type SentryGRPCError struct {
	// contains filtered or unexported fields
}

func (*SentryGRPCError) Error

func (e *SentryGRPCError) Error() string

type SentryHaltError

type SentryHaltError struct {
	// contains filtered or unexported fields
}

func (*SentryHaltError) Error

func (e *SentryHaltError) Error() string

type SentryOutOfSyncError

type SentryOutOfSyncError struct {
	// contains filtered or unexported fields
}

func (*SentryOutOfSyncError) Error

func (e *SentryOutOfSyncError) Error() string

type SentryStats

type SentryStats struct {
	Name            string
	Version         string
	Height          int64
	SentryAlertType SentryAlertType
}

type SlashingSLAError

type SlashingSLAError struct {
	// contains filtered or unexported fields
}

func (*SlashingSLAError) Active

func (e *SlashingSLAError) Active(config AlertConfig) bool

func (*SlashingSLAError) Error

func (e *SlashingSLAError) Error() string

type TombstonedError

type TombstonedError struct{}

func (*TombstonedError) Active

func (e *TombstonedError) Active(config AlertConfig) bool

func (*TombstonedError) Error

func (e *TombstonedError) Error() string

type ValidatorAlertNotification

type ValidatorAlertNotification struct {
	Alerts         []string
	ClearedAlerts  []string
	NotifyForClear bool
	AlertLevel     AlertLevel
}

type ValidatorAlertState

type ValidatorAlertState struct {
	AlertTypeCounts              map[AlertType]int64
	SentryGRPCErrorCounts        map[string]int64
	SentryOutOfSyncErrorCounts   map[string]int64
	SentryHaltErrorCounts        map[string]int64
	WalletBalanceErrorCounts     map[string]int64
	WalletRPCErrorCounts         map[string]int64
	SentryLatestHeight           map[string]int64
	RecentMissedBlocksCounter    int64
	RecentMissedBlocksCounterMax int64
	LatestBlockChecked           int64
	LatestBlockSigned            int64
}

type ValidatorMonitor

type ValidatorMonitor struct {
	Name     string `yaml:"name"`
	RPC      string `yaml:"rpc"`
	FullNode bool   `yaml:"fullnode"`
	Address  string `yaml:"address"`
	ChainID  string `yaml:"chain-id"`
	//	DiscordStatusMessageID   *string   `yaml:"discord-status-message-id"`
	RPCRetries               *int      `yaml:"rpc-retries"`
	MissedBlocksThreshold    *int64    `yaml:"missed-blocks-threshold"`
	SentryGRPCErrorThreshold *int64    `yaml:"sentry-grpc-error-threshold"`
	Sentries                 *[]Sentry `yaml:"sentries"`
	Wallets                  *[]Wallet `yaml:"wallets"`

	SlashingPeriodUptimeWarningThreshold float64 `yaml:"slashing_warn_threshold"`
	SlashingPeriodUptimeErrorThreshold   float64 `yaml:"slashing_error_threshold"`
	RecentBlocksToCheck                  int64   `yaml:"recent_blocks_to_check"`
	NotifyEvery                          int64   `yaml:"notify_every"`
	RecentMissedBlocksNotifyThreshold    int64   `yaml:"recent_missed_blocks_notify_threshold"`
}

type ValidatorStats

type ValidatorStats struct {
	Timestamp                   time.Time
	Height                      int64
	RecentMissedBlocks          int64
	LastSignedBlockHeight       int64
	RecentMissedBlockAlertLevel AlertLevel
	LastSignedBlockTimestamp    time.Time
	SlashingPeriodUptime        float64
	SentryStats                 []*SentryStats
	WalletStats                 []*WalletStats
	AlertLevel                  AlertLevel
	RPCError                    bool
}

type ValidatorStatus

type ValidatorStatus struct {
	Name string `yaml:"name"`

	DiscordStatusMessageID *string `yaml:"discord-status-message-id"`
}

type Wallet

type Wallet struct {
	Address             string `yaml:"address"`
	Name                string `yaml:"name"`
	MinimumBalance      *int64 `yaml:"minimum"`
	MinimumBalanceDenom string `yaml:"denom"`
}

type WalletAlertBalanceError

type WalletAlertBalanceError struct {
	// contains filtered or unexported fields
}

func (*WalletAlertBalanceError) Error

func (e *WalletAlertBalanceError) Error() string

type WalletAlertRPCError

type WalletAlertRPCError struct {
	// contains filtered or unexported fields
}

func (*WalletAlertRPCError) Error

func (e *WalletAlertRPCError) Error() string

type WalletAlertType

type WalletAlertType int8

type WalletStats

type WalletStats struct {
	Name            string
	Address         string
	Balance         int64
	BalanceDenom    string
	WalletAlertType WalletAlertType
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL