burrow: github.com/hyperledger/burrow/rpc/metrics Index | Files

package metrics

import "github.com/hyperledger/burrow/rpc/metrics"

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

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


Package Files

const_info.go exporter.go metrics.go server.go


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"})
var MetricDescriptions = make(map[string]*prometheus.Desc)

func StartServer Uses

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

type Datum Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

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

type HistogramBuilder Uses

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

type InfoService Uses

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

Package metrics imports 14 packages (graph) and is imported by 4 packages. Updated 2020-02-24. Refresh now. Tools for package owners.