metrics

package
v0.2.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package metrics defines telemetry primitives to be used across components. it uses the prometheus format.

Index

Constants

View Source
const (
	// Namespace is the basic namespace where all metrics are defined under.
	Namespace = "spacemesh"
	// ResultLabel makes a consistent name for results.
	ResultLabel = "result"
)

Variables

View Source
var Enabled = false

Enabled variable is used to turn on or of the metrics server. when set to false nop metrics are used.

Functions

func StartMetricsServer added in v1.0.0

func StartMetricsServer(metricsPort int)

StartMetricsServer begins listening and supplying metrics on localhost:`metricsPort`/metrics

func StartPushingMetrics added in v1.0.0

func StartPushingMetrics(url string, periodSec int, nodeID, networkID string)

StartPushingMetrics begins pushing metrics to the url specified by the --metrics-push flag with period specified by the --metrics-push-period flag

Types

type Cache

type Cache interface {
	Add(key, value interface{}) (evicted bool)
	Get(key interface{}) (value interface{}, ok bool)
}

Cache is a basic cache interface that we can wrap to meter.

type Counter

type Counter metrics.Counter

Counter is a metric type used to represent a monotonically increased/decreased numeric value.

func NewCounter

func NewCounter(name, subsystem, help string, labels []string) Counter

NewCounter creates a Counter metrics under the global namespace returns nop if metrics are disabled.

type Gauge

type Gauge metrics.Gauge

Gauge is a metric type used to represent a numeric value

func NewGauge

func NewGauge(name, subsystem, help string, labels []string) Gauge

NewGauge creates a Gauge metrics under the global namespace returns nop if metrics are disabled.

type Histogram

type Histogram metrics.Histogram

Histogram is a metric type used to count multiple observations in buckets.

func NewHistogram

func NewHistogram(name, subsystem, help string, labels []string) Histogram

NewHistogram creates a Histogram metrics under the global namespace returns nop if metrics are disabled.

func NewSummary

func NewSummary(name, subsystem, help string, labels []string, objectives map[float64]float64) Histogram

NewSummary creates a Summary metrics under the global namespace returns nop if metrics are disabled.

type MeteredCache

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

MeteredCache is a wrapper around a cache that monitors size, hits and misses.

func NewMeteredCache

func NewMeteredCache(cache Cache, subsystem, name, help string, labels []string) *MeteredCache

NewMeteredCache wraps cache with metrics are returns a monitored cache.

func (*MeteredCache) Add

func (m *MeteredCache) Add(key, value interface{}) bool

Add adds a key-value to the cache and increases the counter if needed.

func (*MeteredCache) Get

func (m *MeteredCache) Get(key interface{}) (value interface{}, ok bool)

Get returns a value from the cache and counts a hit or a miss.

type Summary

type Summary prmkit.Summary

Summary is a metric type used to sum up multiple observations over time.

Jump to

Keyboard shortcuts

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