Documentation
¶
Overview ¶
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Package metrics provides a metrics collector that stores metrics in Prometheus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Path is the default path to write metrics. Path = "/var/log/peerdmetrics" // ReportInterval is the interval to report metrics. ReportInterval = 3 * time.Minute // AggregationInterval is the interval to aggregate metrics. AggregationInterval = 2 * time.Minute // RetentionPeriod is the retention period of metrics. RetentionPeriod = 10 * time.Minute )
Functions ¶
func NewPromMetrics ¶
func NewPromMetrics(reg prometheus.Registerer) *promMetrics
NewPromMetrics creates a new instance of promMetrics.
Types ¶
type Metrics ¶
type Metrics interface {
// RecordRequest records the time it takes to process a request.
RecordRequest(method, handler string, duration float64)
// RecordPeerDiscovery records the time it takes to discover a peer.
RecordPeerDiscovery(ip string, duration float64)
// RecordPeerResponse records the time it takes for a peer to respond for a key.
RecordPeerResponse(ip, key, op string, duration float64, count int64)
// RecordUpstreamResponse records the time it takes for an upstream to respond for a key.
RecordUpstreamResponse(hostname, key, op string, duration float64, count int64)
}
Metrics defines an interface to collect p2p metrics.
var Global Metrics = NewPromMetrics(prometheus.DefaultRegisterer)
Global is the global metrics collector.
func NewMemoryMetrics ¶
func NewMemoryMetrics() Metrics
NewMemoryMetrics returns a new memory metrics collector.
Click to show internal directories.
Click to hide internal directories.