metrics

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright 2017 Monax Industries Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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