Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Path is the default path to write metrics. Path = "/var/log/p2pmetrics" // 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 ¶
This section is empty.
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 = NewMemoryMetrics()
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.