metrics

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the Apache License, Version 2.0.

Copyright (c) Microsoft Corporation. Licensed under the Apache License, Version 2.0.

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.

Jump to

Keyboard shortcuts

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