Documentation ¶
Overview ¶
Package metrics defines telemetry primitives to be used across components. it uses the prometheus format.
Index ¶
- Constants
- func NewCounter(name, subsystem, help string, labels []string) *prometheus.CounterVec
- func NewGauge(name, subsystem, help string, labels []string) *prometheus.GaugeVec
- func NewHistogram(name, subsystem, help string, labels []string) *prometheus.HistogramVec
- func NewHistogramWithBuckets(name, subsystem, help string, labels []string, buckets []float64) *prometheus.HistogramVec
- func ReportMessageLatency(protocol, msgType string, latency time.Duration)
- func StartMetricsServer(metricsPort int)
- func StartPushingMetrics(url, username, password string, periodSec int, nodeID, networkID string)
Constants ¶
const (
// Namespace is the basic namespace where all metrics are defined under.
Namespace = "spacemesh"
)
Variables ¶
This section is empty.
Functions ¶
func NewCounter ¶
func NewCounter(name, subsystem, help string, labels []string) *prometheus.CounterVec
NewCounter creates a Counter metrics under the global namespace returns nop if metrics are disabled.
func NewGauge ¶
func NewGauge(name, subsystem, help string, labels []string) *prometheus.GaugeVec
NewGauge creates a Gauge metrics under the global namespace returns nop if metrics are disabled.
func NewHistogram ¶
func NewHistogram(name, subsystem, help string, labels []string) *prometheus.HistogramVec
NewHistogram creates a Histogram metrics under the global namespace returns nop if metrics are disabled.
func NewHistogramWithBuckets ¶ added in v1.0.0
func NewHistogramWithBuckets(name, subsystem, help string, labels []string, buckets []float64) *prometheus.HistogramVec
NewHistogramWithBuckets creates a Histogram metrics with custom buckets.
func ReportMessageLatency ¶ added in v1.0.0
ReportMessageLatency records the latency for the given protocol and message type, if the protocol consists only of a single message then the protocol should be provided as the message type.
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
StartPushingMetrics begins pushing metrics to the url specified by the --metrics-push flag with period specified by the --metrics-push-period flag.
Types ¶
This section is empty.