forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealth.go
34 lines (26 loc) · 1.36 KB
/
health.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package network
import "time"
// HealthConfig describes parameters for network layer health checks.
type HealthConfig struct {
// Must be connected to at least this many peers to be considered healthy
MinConnectedPeers uint `json:"minConnectedPeers"`
// Must have received a message from the network within this duration
// to be considered healthy. Must be positive
MaxTimeSinceMsgReceived time.Duration `json:"maxTimeSinceMsgReceived"`
// Must have sent a message over the network within this duration
// to be considered healthy. Must be positive
MaxTimeSinceMsgSent time.Duration `json:"maxTimeSinceMsgSent"`
// If greater than this portion of the pending send byte queue is full,
// will report unhealthy. Must be in (0,1]
MaxPortionSendQueueBytesFull float64 `json:"maxPortionSendQueueBytesFull"`
// If greater than this portion of the attempts to send a message to a peer
// fail, will return unhealthy. Does not include send attempts that were not
// made due to benching. Must be in [0,1]
MaxSendFailRate float64 `json:"maxSendFailRate"`
// Halflife of averager used to calculate the send fail rate
// Must be > 0.
// Larger value --> Drop rate affected less by recent messages
MaxSendFailRateHalflife time.Duration `json:"maxSendFailRateHalflife"`
}