telemetry

package
v0.0.0-...-c69f244 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimoutMessageSending = errors.New("timeout sending telemetry message")

Functions

This section is empty.

Types

type AfgAuthoritySet

type AfgAuthoritySet struct {
	AuthorityID    string `json:"authority_id"`
	AuthoritySetID string `json:"authority_set_id"`
	// Substrate creates an array of string of authority IDs. It JSON-serialises
	// that array and send that as a string.
	Authorities string `json:"authorities"`
}

AfgAuthoritySet is a telemetry message of type `afg.authority_set` which is meant to be sent when authority set changes (generally when a round is initiated)

func NewAfgAuthoritySet

func NewAfgAuthoritySet(authorityID, authoritySetID, authorities string) *AfgAuthoritySet

NewAfgAuthoritySet creates a new AfgAuthoritySetTM struct.

func (AfgAuthoritySet) MarshalJSON

func (afg AfgAuthoritySet) MarshalJSON() ([]byte, error)

type AfgFinalizedBlocksUpTo

type AfgFinalizedBlocksUpTo struct {
	Hash   common.Hash `json:"hash"`
	Number string      `json:"number"`
}

AfgFinalizedBlocksUpTo holds telemetry message of type `afg.finalized_blocks_up_to`, which is supposed to be sent when GRANDPA client finalises new blocks.

func NewAfgFinalizedBlocksUpTo

func NewAfgFinalizedBlocksUpTo(hash common.Hash, number string) *AfgFinalizedBlocksUpTo

NewAfgFinalizedBlocksUpTo creates a new AfgFinalizedBlocksUpToTM struct.

func (AfgFinalizedBlocksUpTo) MarshalJSON

func (afg AfgFinalizedBlocksUpTo) MarshalJSON() ([]byte, error)

type AfgReceivedCommit

type AfgReceivedCommit struct {
	TargetHash                 common.Hash `json:"target_hash"`
	TargetNumber               string      `json:"target_number"`
	ContainsPrecommitsSignedBy []string    `json:"contains_precommits_signed_by"`
}

AfgReceivedCommit holds `afg.received_commit` telemetry message which is supposed to be sent when grandpa client receives a commit.

func NewAfgReceivedCommit

func NewAfgReceivedCommit(targetHash common.Hash, targetNumber string,
	containsPrecommitsSignedBy []string) *AfgReceivedCommit

NewAfgReceivedCommit gets a new AfgReceivedCommit* struct.

func (AfgReceivedCommit) MarshalJSON

func (afg AfgReceivedCommit) MarshalJSON() ([]byte, error)

type AfgReceivedPrecommit

type AfgReceivedPrecommit afgReceived

AfgReceivedPrecommit holds `afg.received_precommit` telemetry message which is supposed to be sent when grandpa client receives a precommit.

func NewAfgReceivedPrecommit

func NewAfgReceivedPrecommit(targetHash common.Hash, targetNumber, voter string) *AfgReceivedPrecommit

NewAfgReceivedPrecommit gets a new AfgReceivedPrecommitTM struct.

func (AfgReceivedPrecommit) MarshalJSON

func (afg AfgReceivedPrecommit) MarshalJSON() ([]byte, error)

type AfgReceivedPrevote

type AfgReceivedPrevote afgReceived

AfgReceivedPrevote holds `afg.received_prevote` telemetry message which is supposed to be sent when grandpa client receives a prevote.

func NewAfgReceivedPrevote

func NewAfgReceivedPrevote(targetHash common.Hash, targetNumber, voter string) *AfgReceivedPrevote

NewAfgReceivedPrevote gets a new AfgReceivedPrevote* struct.

func (AfgReceivedPrevote) MarshalJSON

func (afg AfgReceivedPrevote) MarshalJSON() ([]byte, error)

type BlockImport

type BlockImport struct {
	BestHash *common.Hash `json:"best"`
	Height   uint         `json:"height"`
	Origin   string       `json:"origin"`
}

BlockImport struct to hold block import telemetry messages

func NewBlockImport

func NewBlockImport(bestHash *common.Hash, height uint, origin string) *BlockImport

NewBlockImport function to create new Block Import Telemetry Message

func (BlockImport) MarshalJSON

func (bi BlockImport) MarshalJSON() ([]byte, error)

type Client

type Client interface {
	SendMessage(msg Message)
}

Client is the interface to send messages to telemetry servers

type Mailer

type Mailer struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Mailer can send messages to the telemetry servers.

func BootstrapMailer

func BootstrapMailer(ctx context.Context, conns []*genesis.TelemetryEndpoint, enabled bool, logger log.LeveledLogger) (
	mailer *Mailer, err error)

BootstrapMailer setup the mailer, the connections and start the async message shipment

func (*Mailer) SendMessage

func (m *Mailer) SendMessage(msg Message)

SendMessage sends Message to connected telemetry listeners through messageReceiver

type Message

type Message interface {
	MarshalJSON() ([]byte, error)
}

Message interface for Message functions

type NoopClient

type NoopClient struct{}

NoopClient used for minimal implementation of the Client interface

func (NoopClient) SendMessage

func (NoopClient) SendMessage(msg Message)

SendMessage is an empty implementation used for testing

type NotifyFinalized

type NotifyFinalized struct {
	Best common.Hash `json:"best"`
	// Height is same as block.Header.Number
	Height string `json:"height"`
}

NotifyFinalized holds `notify.finalized` telemetry message, which is supposed to be send when a new block gets finalised.

func NewNotifyFinalized

func NewNotifyFinalized(best common.Hash, height string) *NotifyFinalized

NewNotifyFinalized gets a new NotifyFinalizedTM struct.

func (NotifyFinalized) MarshalJSON

func (nf NotifyFinalized) MarshalJSON() ([]byte, error)

type PreparedBlockForProposing

type PreparedBlockForProposing struct {
	Hash common.Hash `json:"hash"`
	// Height of the chain, Block.Header.Number
	Number string `json:"number"`
}

PreparedBlockForProposing holds a 'prepared_block_for_proposing' telemetry message, which is supposed to be sent when a new block is built.

func NewPreparedBlockForProposing

func NewPreparedBlockForProposing(hash common.Hash, number string) *PreparedBlockForProposing

NewPreparedBlockForProposing gets a new PreparedBlockForProposingTM struct.

func (PreparedBlockForProposing) MarshalJSON

func (pb PreparedBlockForProposing) MarshalJSON() ([]byte, error)

type SystemConnected

type SystemConnected struct {
	Authority      bool         `json:"authority"`
	Chain          string       `json:"chain"`
	GenesisHash    *common.Hash `json:"genesis_hash"`
	Implementation string       `json:"implementation"`
	Name           string       `json:"name"`
	NetworkID      string       `json:"network_id"`
	StartupTime    string       `json:"startup_time"`
	Version        string       `json:"version"`
}

SystemConnected struct to hold system connected telemetry messages

func NewSystemConnected

func NewSystemConnected(authority bool, chain string, genesisHash *common.Hash,
	implementation, name, networkID, startupTime, version string) *SystemConnected

NewSystemConnected function to create new System Connected Telemetry Message

func (SystemConnected) MarshalJSON

func (sc SystemConnected) MarshalJSON() ([]byte, error)

type SystemInterval

type SystemInterval struct {
	BandwidthDownload  float64      `json:"bandwidth_download,omitempty"`
	BandwidthUpload    float64      `json:"bandwidth_upload,omitempty"`
	Peers              int          `json:"peers,omitempty"`
	BestHash           *common.Hash `json:"best,omitempty"`
	BestHeight         uint         `json:"height,omitempty"`
	FinalisedHash      *common.Hash `json:"finalized_hash,omitempty"`
	FinalisedHeight    uint         `json:"finalized_height,omitempty"`
	TxCount            *big.Int     `json:"txcount,omitempty"`
	UsedStateCacheSize *big.Int     `json:"used_state_cache_size,omitempty"`
}

SystemInterval struct to hold system interval telemetry messages

func NewBandwidth

func NewBandwidth(bandwidthDownload, bandwidthUpload float64, peers int) *SystemInterval

NewBandwidth function to create new Bandwidth Telemetry Message

func NewBlockInterval

func NewBlockInterval(beshHash *common.Hash, bestHeight uint, finalisedHash *common.Hash,
	finalisedHeight uint, txCount, usedStateCacheSize *big.Int) *SystemInterval

NewBlockInterval function to create new Block Interval Telemetry Message

func (SystemInterval) MarshalJSON

func (si SystemInterval) MarshalJSON() ([]byte, error)

type TxpoolImport

type TxpoolImport struct {
	Ready  uint `json:"ready"`
	Future uint `json:"future"`
}

TxpoolImport holds `txpool.import` telemetry message, which is supposed to be sent when a new transaction gets imported in the transaction pool.

func NewTxpoolImport

func NewTxpoolImport(ready, future uint) *TxpoolImport

NewTxpoolImport creates a new TxpoolImportTM struct

func (TxpoolImport) MarshalJSON

func (tx TxpoolImport) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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