clientinfo

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 9 Imported by: 3 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ConnectedPeersCountMetricName     = "connected_peers_count"
	ConnectedBootstrapCountMetricName = "connected_bootstrap_count"
	EthConnectivityMetricName         = "eth_connectivity"
	BtcConnectivityMetricName         = "btc_connectivity"
	ClientInfoMetricName              = "client_info"
)

Names under which metrics are exposed.

View Source
const (
	// DefaultNetworkMetricsTick is the default duration of the
	// observation tick for network metrics.
	DefaultNetworkMetricsTick = 1 * time.Minute
	// DefaultEthereumMetricsTick is the default duration of the
	// observation tick for Ethereum metrics.
	DefaultEthereumMetricsTick = 10 * time.Minute
	// DefaultBitcoinMetricsTick is the default duration of the
	// observation tick for Bitcoin metrics.
	DefaultBitcoinMetricsTick = 10 * time.Minute
	// The duration of the observation tick for all application-specific
	// metrics.
	ApplicationMetricsTick = 1 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationInfo

type ApplicationInfo map[string]interface{}

ApplicationInfo describes data structure of application information.

type Chain

type Chain struct {
	LatestBlockNumber uint `json:"latest_block_number"`
}

Chain describes data structure of a chain information.

type Client

type Client struct {
	ChainAddress string `json:"chain_address"`
	NetworkID    string `json:"network_id"`
	Version      string `json:"version"`
	Revision     string `json:"revision"`
}

Client describes data structure of client information.

type Config

type Config struct {
	Port                int
	NetworkMetricsTick  time.Duration
	EthereumMetricsTick time.Duration
	BitcoinMetricsTick  time.Duration
}

Config stores configuration for the client info.

type Diagnostics

type Diagnostics struct {
	ClientInfo     Client `json:"client_info"`
	ConnectedPeers []Peer `json:"connected_peers"`
	EthChainInfo   Chain  `json:"eth_chain_info"`
	BtcChainInfo   Chain  `json:"btc_chain_info"`
}

Diagnostics describes data structure returned by the diagnostics endpoint.

type Peer

type Peer struct {
	ChainAddress          string   `json:"chain_address"`
	NetworkID             string   `json:"network_id"`
	NetworkMultiAddresses []string `json:"multiaddrs"`
}

Peer describes data structure of peer information.

type Registry

type Registry struct {
	*clientinfo.Registry
	// contains filtered or unexported fields
}

Registry wraps keep-common clientinfo registry and exposes additional functions for registering client-custom metrics and diagnostics

func Initialize

func Initialize(
	ctx context.Context,
	port int,
) (*Registry, bool)

Initialize set up the client info registry and enables metrics and diagnostics server.

func (*Registry) ObserveApplicationSource

func (r *Registry) ObserveApplicationSource(
	application string,
	inputs map[string]Source,
)

ObserveApplicationSource triggers an observation process of application-specific metrics.

func (*Registry) ObserveBtcConnectivity

func (r *Registry) ObserveBtcConnectivity(
	btcChain bitcoin.Chain,
	tick time.Duration,
)

ObserveBtcConnectivity triggers an observation process of the btc_connectivity metric.

func (*Registry) ObserveConnectedBootstrapCount

func (r *Registry) ObserveConnectedBootstrapCount(
	netProvider net.Provider,
	bootstraps []string,
	tick time.Duration,
)

ObserveConnectedBootstrapCount triggers an observation process of the connected_bootstrap_count metric.

func (*Registry) ObserveConnectedPeersCount

func (r *Registry) ObserveConnectedPeersCount(
	netProvider net.Provider,
	tick time.Duration,
)

ObserveConnectedPeersCount triggers an observation process of the connected_peers_count metric.

func (*Registry) ObserveEthConnectivity

func (r *Registry) ObserveEthConnectivity(
	blockCounter chain.BlockCounter,
	tick time.Duration,
)

ObserveEthConnectivity triggers an observation process of the eth_connectivity metric.

func (*Registry) RegisterApplicationSource

func (r *Registry) RegisterApplicationSource(
	application string,
	fetchApplicationDiagnostics func() ApplicationInfo,
)

RegisterApplicationSource registers the diagnostics source providing information about the application.

func (*Registry) RegisterBtcChainInfoSource

func (r *Registry) RegisterBtcChainInfoSource(
	btcChain bitcoin.Chain,
)

RegisterBtcChainInfoSource registers the diagnostics source providing information about btc chain.

func (*Registry) RegisterClientInfoSource

func (r *Registry) RegisterClientInfoSource(
	netProvider net.Provider,
	signing chain.Signing,
	clientVersion string,
	clientRevision string,
)

RegisterClientInfoSource registers the diagnostics source providing information about the client itself.

func (*Registry) RegisterConnectedPeersSource

func (r *Registry) RegisterConnectedPeersSource(
	netProvider net.Provider,
	signing chain.Signing,
)

RegisterConnectedPeersSource registers the diagnostics source providing information about connected peers.

func (*Registry) RegisterEthChainInfoSource

func (r *Registry) RegisterEthChainInfoSource(
	blockCounter chain.BlockCounter,
)

RegisterEthChainInfoSource registers the diagnostics source providing information about eth chain.

func (*Registry) RegisterMetricClientInfo

func (r *Registry) RegisterMetricClientInfo(version string)

RegisterMetricClientInfo registers static client information labels for metrics.

type Source

type Source func() float64

Jump to

Keyboard shortcuts

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