metrics

package
v0.0.0-...-5692789 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: ISC Imports: 4 Imported by: 0

README

metrics

ISC License

Package metrics implements a metrics collection manager.

Overview

Metrics manager handles the receiving metrics from other managers, and providing metrics to other parts of code through its methods.

The intent of the metrics manager was to expose run-time stats from various other managers to external systems via RPC calls.

Currently the metrics manager is used to expose block-mining metrics to external systems via the getblockmetrics RPC call.

Installation and Updating

$ go get -u github.com/totaloutput/soterd/metrics

License

Package metrics is licensed under the copyfree ISC License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func UseLogger

func UseLogger(logger soterlog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using soterlog.

Types

type Config

type Config struct {
	// Provide the metrics manager with the channels it will listen to for new metrics
	MinerSolveCount  *chan struct{}
	MinerSolveHashes *chan string
	MinerSolveTimes  *chan time.Duration
}

Config is a configuration struct used to initialize a new MetricsManager.

type MetricsManager

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

MetricsManager is used to collect metrics from other managers in code, and make the data available to other systems.

func New

func New(config *Config) (*MetricsManager, error)

New returns a new MetricsManager based on the given config. Use Start() to start processing metrics.

func (*MetricsManager) MinerSolveCount

func (mm *MetricsManager) MinerSolveCount() int64

MinerSolveCount returns the number of solved blocks by the miner(s)

func (*MetricsManager) MinerSolveHashes

func (mm *MetricsManager) MinerSolveHashes() []string

MinerSolveHashes returns the solved-block hash cache

func (*MetricsManager) MinerSolveTimes

func (mm *MetricsManager) MinerSolveTimes() []time.Duration

MinerSolveTimes returns the solve times cache

func (*MetricsManager) Start

func (mm *MetricsManager) Start()

Starts processing metrics in a new goroutine

func (*MetricsManager) Stop

func (mm *MetricsManager) Stop()

Stop ends processing of metrics

Jump to

Keyboard shortcuts

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