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 ¶
var ( Height = newDesc( prometheus.BuildFQName("hsc", "chain", "block_height"), "Current block height", []string{"chain_id", "moniker"}) TimePerBlock = newDesc( prometheus.BuildFQName("hsc", "chain", "block_time"), "Histogram metric of block duration", []string{"chain_id", "moniker"}) UnconfirmedTransactions = newDesc( prometheus.BuildFQName("hsc", "transactions", "in_mempool"), "Current depth of the mempool", []string{"chain_id", "moniker"}) TxPerBlock = newDesc( prometheus.BuildFQName("hsc", "transactions", "per_block"), "Histogram metric of transactions per block", []string{"chain_id", "moniker"}) TotalPeers = newDesc( prometheus.BuildFQName("hsc", "peers", "total"), "Current total peers", []string{"chain_id", "moniker"}) InboundPeers = newDesc( prometheus.BuildFQName("hsc", "peers", "inbound"), "Current inbound peers", []string{"chain_id", "moniker"}) OutboundPeers = newDesc( prometheus.BuildFQName("hsc", "peers", "outbound"), "Current outbound peers", []string{"chain_id", "moniker"}) Contracts = newDesc( prometheus.BuildFQName("hsc", "accounts", "contracts"), "Current contracts on the chain", []string{"chain_id", "moniker"}) Users = newDesc( prometheus.BuildFQName("hsc", "accounts", "users"), "Current users on the chain", []string{"chain_id", "moniker"}) )
var MetricDescriptions = make(map[string]*prometheus.Desc)
Functions ¶
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 ¶
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 HiveSmartChain 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 ¶
type InfoService ¶
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