prometheus

package
v0.0.0-...-e5c7075 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasePrometheusQuery

type BasePrometheusQuery string

BasePrometheusQuery is a string representing a Prometheus query used in the BitBoxBase.

const (
	BitcoinVerificationProgress BasePrometheusQuery = "bitcoin_verification_progress"
	BitcoinBlockCount           BasePrometheusQuery = "bitcoin_blocks"
	BitcoinHeaderCount          BasePrometheusQuery = "bitcoin_headers"
	BitcoinPeers                BasePrometheusQuery = "bitcoin_peers"
	BitcoinIBD                  BasePrometheusQuery = "bitcoin_ibd"
	BaseSystemInfo              BasePrometheusQuery = "base_system_info"
	BaseFreeDiskspace           BasePrometheusQuery = "node_filesystem_free_bytes{fstype=\"ext4\", mountpoint=\"/mnt/ssd\"}"
	BaseTotalDiskspace          BasePrometheusQuery = "node_filesystem_size_bytes{fstype=\"ext4\", mountpoint=\"/mnt/ssd\"}"
	LightningBlocks             BasePrometheusQuery = "lightning_node_blockheight"
	ElectrsBlocks               BasePrometheusQuery = "electrs_index_height"
	LightningActiveChannels     BasePrometheusQuery = "sum(lightning_peer_channels) or vector(0)"
)

Queries for the Prometheus server running on the BitBoxBase

type Client

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

Client is a Prometheus client

func NewClient

func NewClient(address string) Client

NewClient returns a new Prometheus client. It does not ensure that the client has connectivity.

func (Client) ConvertErrorToErrorResponse

func (client Client) ConvertErrorToErrorResponse(err error) rpcmessages.ErrorResponse

ConvertErrorToErrorResponse converts an error returned by Prometheus to an ErrorResponse

func (*Client) GetFloat

func (client *Client) GetFloat(query BasePrometheusQuery) (float64, error)

GetFloat queries Prometheus with the provided query and returns an int64.

func (*Client) GetInt

func (client *Client) GetInt(query BasePrometheusQuery) (int64, error)

GetInt queries Prometheus with the provided query and returns an int64.

func (*Client) GetMetricString

func (client *Client) GetMetricString(query BasePrometheusQuery, metric string) (string, error)

GetMetricString gets a metric from a Prometheus query. Metrics are returned by Prometheus as extra information for the result.

Jump to

Keyboard shortcuts

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