metrics

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Copyright Monax Industries Limited SPDX-License-Identifier: Apache-2.0

Copyright Monax Industries Limited SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var (
	Height = newDesc(
		prometheus.BuildFQName("burrow", "chain", "block_height"),
		"Current block height",
		[]string{"chain_id", "moniker"})

	TimePerBlock = newDesc(
		prometheus.BuildFQName("burrow", "chain", "block_time"),
		"Histogram metric of block duration",
		[]string{"chain_id", "moniker"})

	UnconfirmedTransactions = newDesc(
		prometheus.BuildFQName("burrow", "transactions", "in_mempool"),
		"Current depth of the mempool",
		[]string{"chain_id", "moniker"})

	TxPerBlock = newDesc(
		prometheus.BuildFQName("burrow", "transactions", "per_block"),
		"Histogram metric of transactions per block",
		[]string{"chain_id", "moniker"})

	TotalPeers = newDesc(
		prometheus.BuildFQName("burrow", "peers", "total"),
		"Current total peers",
		[]string{"chain_id", "moniker"})

	InboundPeers = newDesc(
		prometheus.BuildFQName("burrow", "peers", "inbound"),
		"Current inbound peers",
		[]string{"chain_id", "moniker"})

	OutboundPeers = newDesc(
		prometheus.BuildFQName("burrow", "peers", "outbound"),
		"Current outbound peers",
		[]string{"chain_id", "moniker"})

	Contracts = newDesc(
		prometheus.BuildFQName("burrow", "accounts", "contracts"),
		"Current contracts on the chain",
		[]string{"chain_id", "moniker"})

	Users = newDesc(
		prometheus.BuildFQName("burrow", "accounts", "users"),
		"Current users on the chain",
		[]string{"chain_id", "moniker"})
)
View Source
var MetricDescriptions = make(map[string]*prometheus.Desc)

Functions

func StartServer

func StartServer(service *rpc.Service, pattern string, listener net.Listener, blockSampleSize int,
	logger *logging.Logger) (*http.Server, error)

Types

type Datum

type Datum struct {
	LatestBlockHeight   float64
	UnconfirmedTxs      float64
	TotalPeers          float64
	InboundPeers        float64
	OutboundPeers       float64
	BlockSampleSize     uint64
	TotalTxs            float64
	TxPerBlockBuckets   map[float64]uint64
	TotalTime           float64
	TimePerBlockBuckets map[float64]uint64
	AccountsWithCode    float64
	AccountsWithoutCode float64
}

Datum is used to store data from all the relevant endpoints

type Exporter

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

Exporter is used to store Metrics data and embeds the config struct. This is done so that the relevant functions have easy access to the user defined runtime configuration when the Collect method is called.

func NewExporter added in v0.24.6

func NewExporter(service InfoService, blockSampleSize int, logger *logging.Logger) (*Exporter, error)

Exporter uses the InfoService to provide pre-aggregated metrics of various types that are then passed to prometheus as Const metrics rather than being accumulated by individual operations throughout the rest of the Burrow code.

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect function, called on by Prometheus Client library This function is called when a scrape is performed by requesting /metrics

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe - loops through the API metrics and passes them to prometheus.Describe

type HistogramBuilder added in v0.24.6

type HistogramBuilder func(values []float64) (buckets map[float64]uint64, sum float64)

type InfoService added in v0.24.6

type InfoService interface {
	Status() (*rpc.ResultStatus, error)
	UnconfirmedTxs(maxTxs int64) (*rpc.ResultUnconfirmedTxs, error)
	Peers() []core_types.Peer
	Blocks(minHeight, maxHeight int64) (*rpc.ResultBlocks, error)
	Stats() acmstate.AccountStatsGetter
}

Subset of rpc.Service

Jump to

Keyboard shortcuts

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