Documentation
¶
Index ¶
- Variables
- type ContractData
- type DeviceCache
- type LatencyManager
- type LatencyResult
- type LatencyResults
- type Option
- func WithCacheUpdateInterval(interval time.Duration) Option
- func WithMetricsEnabled(enabled bool) Option
- func WithProbeInterval(interval time.Duration) Option
- func WithProberFunc(f ProberFunc) Option
- func WithProgramID(id string) Option
- func WithRpcEndpoint(endpoint string) Option
- func WithSmartContractFunc(f SmartContractorFunc) Option
- type ProberFunc
- type SmartContractorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MetricLatencyRttMin = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "doublezero_latency_rtt_min_nanoseconds", Help: "Minimum round-trip time latency to DoubleZero devices in nanoseconds.", }, latencyLabels, ) MetricLatencyRttAvg = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "doublezero_latency_rtt_avg_nanoseconds", Help: "Average round-trip time latency to DoubleZero devices in nanoseconds.", }, latencyLabels, ) MetricLatencyRttMax = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "doublezero_latency_rtt_max_nanoseconds", Help: "Maximum round-trip time latency to DoubleZero devices in nanoseconds.", }, latencyLabels, ) MetricLatencyLoss = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "doublezero_latency_loss_percentage", Help: "Packet loss percentage to DoubleZero devices.", }, latencyLabels, ) MetricLatencyReachable = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "doublezero_latency_reachable", Help: "Indicates if a device is reachable (1 for reachable, 0 for unreachable).", }, latencyLabels, ) )
Functions ¶
This section is empty.
Types ¶
type ContractData ¶
type ContractData struct {
Locations []serviceability.Location
Devices []serviceability.Device
Exchanges []serviceability.Exchange
Links []serviceability.Link
Users []serviceability.User
}
func FetchContractData ¶
type DeviceCache ¶
type DeviceCache struct {
Devices []serviceability.Device
Lock sync.Mutex
}
type LatencyManager ¶
type LatencyManager struct {
SmartContractFunc SmartContractorFunc
DeviceCache *DeviceCache
ResultsCache *LatencyResults
// contains filtered or unexported fields
}
func NewLatencyManager ¶
func NewLatencyManager(options ...Option) *LatencyManager
func (*LatencyManager) GetDeviceCache ¶
func (l *LatencyManager) GetDeviceCache() []serviceability.Device
func (*LatencyManager) GetResultsCache ¶
func (l *LatencyManager) GetResultsCache() []LatencyResult
func (*LatencyManager) ServeLatency ¶
func (l *LatencyManager) ServeLatency(w http.ResponseWriter, r *http.Request)
type LatencyResult ¶
type LatencyResult struct {
Min int64 `json:"min_latency_ns"`
Max int64 `json:"max_latency_ns"`
Avg int64 `json:"avg_latency_ns"`
Loss float64 `json:"loss_percentage"`
Device serviceability.Device `json:"-"`
Reachable bool `json:"reachable"`
}
func UdpPing ¶
func UdpPing(ctx context.Context, d serviceability.Device) LatencyResult
func (*LatencyResult) MarshalJSON ¶
func (l *LatencyResult) MarshalJSON() ([]byte, error)
type LatencyResults ¶
type LatencyResults struct {
Results []LatencyResult
Lock sync.RWMutex `json:"-"`
}
func (*LatencyResults) MarshalJSON ¶
func (l *LatencyResults) MarshalJSON() ([]byte, error)
type Option ¶ added in v0.7.2
type Option func(*LatencyManager)
func WithCacheUpdateInterval ¶ added in v0.7.2
func WithMetricsEnabled ¶ added in v0.7.2
func WithProbeInterval ¶ added in v0.7.2
func WithProberFunc ¶ added in v0.7.2
func WithProberFunc(f ProberFunc) Option
func WithProgramID ¶ added in v0.7.2
func WithRpcEndpoint ¶ added in v0.7.2
func WithSmartContractFunc ¶ added in v0.7.2
func WithSmartContractFunc(f SmartContractorFunc) Option
type ProberFunc ¶
type ProberFunc func(context.Context, serviceability.Device) LatencyResult
type SmartContractorFunc ¶
Click to show internal directories.
Click to hide internal directories.