Documentation ¶
Index ¶
- type BasePrometheusQuery
- type Client
- func (client Client) ConvertErrorToErrorResponse(err error) rpcmessages.ErrorResponse
- func (client *Client) GetFloat(query BasePrometheusQuery) (float64, error)
- func (client *Client) GetInt(query BasePrometheusQuery) (int64, error)
- func (client *Client) GetMetricString(query BasePrometheusQuery, metric string) (string, error)
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 ¶
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.