monitor

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GovProposalMonitorMemo = "New Governance Proposals"
	GovProposalMonitorName = "govProposal/new"
	GovVotingMonitorMemo   = "New Active Governance Proposals"
	GovVotingMonitorName   = "govProposal/voting"
)

Governance monitor alert related constants.

View Source
const (
	MissingSigMonitorMemo = "Missing Signatures From Validators"
	MissingSigMonitorName = "slashing/missingSig"
	DoubleSignMonitorMemo = "Discovered Double Signing Validators"
	DoubleSignMonitorName = "slashing/doubleSign"
)

Slashing monitor alert related constants.

View Source
const (
	JailedValidatorMonitorMemo = "New Jailed Validators"
	JailedValidatorMonitorName = "staking/jailed"
)

Staking monitor alert related constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoubleSignMonitor

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

DoubleSignMonitor defines a monitor responsible for monitoring when filtered validators double sign a block.

func NewDoubleSignMonitor

func NewDoubleSignMonitor(logger core.Logger, cfg config.Config, name, memo string) *DoubleSignMonitor

NewDoubleSignMonitor returns a reference to a new DoubleSignMonitor.

func (*DoubleSignMonitor) Exec

func (dsm *DoubleSignMonitor) Exec() (resp, id []byte, err error)

Exec implements the Monitor interface. It attempts to fetch validators that have double signed the latest block and match against a given filter of validator addresses. Upon success, the serialized encoding of the filtered validator addresses and an ID that is the SHA256 of said encoding will be returned and an error otherwise.

func (DoubleSignMonitor) Memo

func (sm DoubleSignMonitor) Memo() string

Memo implements the Monitor interface. It returns the monitor's memo.

func (DoubleSignMonitor) Name

func (sm DoubleSignMonitor) Name() string

Name implements the Monitor interface. It returns the monitor's name.

type DoubleSigners

type DoubleSigners struct {
	Height        int64    `json:"height"`
	DoubleSigners []string `json:"double_signers"`
}

DoubleSigners defines a structure for containing addresses of validators that have double signed for a given block height.

type GovProposalMonitor

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

GovProposalMonitor defines a monitor responsible for monitoring new governance proposals.

func NewGovProposalMonitor

func NewGovProposalMonitor(logger core.Logger, cfg config.Config, name, memo string) *GovProposalMonitor

NewGovProposalMonitor returns a reference to a new GovProposalMonitor.

func (*GovProposalMonitor) Exec

func (gpm *GovProposalMonitor) Exec() (resp, id []byte, err error)

Exec implements the Monitor interface. It will attempt to fetch new governance proposals. Upon success, the raw response body and an ID that is the SHA256 of the response body will be returned and an error otherwise.

func (GovProposalMonitor) Memo

func (gm GovProposalMonitor) Memo() string

Memo implements the Monitor interface. It returns the monitor's memo.

func (GovProposalMonitor) Name

func (gm GovProposalMonitor) Name() string

Name implements the Monitor interface. It returns the monitor's name.

type GovVotingMonitor

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

GovVotingMonitor defines a monitor responsible for monitoring governance proposals that are in the voting stage.

func NewGovVotingMonitor

func NewGovVotingMonitor(logger core.Logger, cfg config.Config, name, memo string) *GovVotingMonitor

NewGovVotingMonitor returns a reference to a new GovVotingMonitor.

func (*GovVotingMonitor) Exec

func (gvm *GovVotingMonitor) Exec() (resp, id []byte, err error)

Exec implements the Monitor interface. It will attempt to fetch governance proposals that are in the voting stage. Upon success, the raw response body and an ID that is the SHA256 of the response body will be returned and an error otherwise.

func (GovVotingMonitor) Memo

func (gm GovVotingMonitor) Memo() string

Memo implements the Monitor interface. It returns the monitor's memo.

func (GovVotingMonitor) Name

func (gm GovVotingMonitor) Name() string

Name implements the Monitor interface. It returns the monitor's name.

type JailedValidatorMonitor

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

JailedValidatorMonitor defines a monitor responsible for monitoring when certain validators become jailed.

func NewJailedValidatorMonitor

func NewJailedValidatorMonitor(logger core.Logger, cfg config.Config, name, memo string) *JailedValidatorMonitor

NewJailedValidatorMonitor returns a reference to a new JailedValidatorMonitor.

func (*JailedValidatorMonitor) Exec

func (jvm *JailedValidatorMonitor) Exec() (resp, id []byte, err error)

Exec implements the Monitor interface. It attempts to fetch validators that are jailed and match against a given filter of validator addresses. Upon success, the serialized encoding of the filtered validators and an ID that is the SHA256 of said encoding will be returned and an error otherwise.

func (JailedValidatorMonitor) Memo

func (sm JailedValidatorMonitor) Memo() string

Memo implements the Monitor interface. It returns the monitor's memo.

func (JailedValidatorMonitor) Name

func (sm JailedValidatorMonitor) Name() string

Name implements the Monitor interface. It returns the monitor's name.

type MissingSigMonitor

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

MissingSigMonitor defines a monitor responsible for monitoring when filtered validators fail to sign a block.

func NewMissingSigMonitor

func NewMissingSigMonitor(logger core.Logger, cfg config.Config, name, memo string) *MissingSigMonitor

NewMissingSigMonitor returns a reference to a new MissingSigMonitor.

func (*MissingSigMonitor) Exec

func (msm *MissingSigMonitor) Exec() (resp, id []byte, err error)

Exec implements the Monitor interface. It attempts to fetch validators that have missed signing the latest block based on a given filter of validator addresses. Any matches are serialized and an ID that is the SHA256 of said encoding will be returned and an error otherwise.

func (MissingSigMonitor) Memo

func (sm MissingSigMonitor) Memo() string

Memo implements the Monitor interface. It returns the monitor's memo.

func (MissingSigMonitor) Name

func (sm MissingSigMonitor) Name() string

Name implements the Monitor interface. It returns the monitor's name.

type MissingSigners

type MissingSigners struct {
	Height         int64    `json:"height"`
	MissingSigners []string `json:"missing_signers"`
}

MissingSigners defines a structure for containing addresses of validators that have missed a signature/precommit for a given block height.

type Monitor

type Monitor interface {
	Name() string
	Memo() string
	Exec() (resp, id []byte, err error)
}

Monitor defines an interface that is responsible for monitoring for a specific event that will ultimately trigger a potential alert.

func CreateMonitors

func CreateMonitors(cfg config.Config, logger core.Logger) (monitors []Monitor)

CreateMonitors returns a list of initialized monitors. The exact list of created monitors is based upon the enabled monitors in the provided configuration which is assumed to have been validated.

Jump to

Keyboard shortcuts

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