mirror of
https://github.com/henrygd/beszel.git
synced 2026-05-06 19:01:48 +02:00
updates
This commit is contained in:
@@ -38,15 +38,19 @@ type SyncResponse struct {
|
||||
//
|
||||
// 0: avg response in microseconds
|
||||
//
|
||||
// 1: average response over the last hour in microseconds
|
||||
// 1: 1h average response in microseconds
|
||||
//
|
||||
// 2: min response over the last hour in microseconds
|
||||
// 2: min response in microseconds
|
||||
//
|
||||
// 3: max response over the last hour in microseconds
|
||||
// 3: 1h min response in microseconds
|
||||
//
|
||||
// 4: packet loss percentage (0-100)
|
||||
// 4: max response in microseconds
|
||||
//
|
||||
// 5: packet loss percentage over the last hour (0-100)
|
||||
// 5: 1h max response in microseconds
|
||||
//
|
||||
// 6: packet loss percentage (0-100)
|
||||
//
|
||||
// 7: 1h packet loss percentage (0-100)
|
||||
type Result []float64
|
||||
|
||||
// Get returns the value at the specified index or 0 if the index is out of range.
|
||||
@@ -56,3 +60,23 @@ func (r Result) Get(index int) float64 {
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Stats holds only 1m values for a single target, which are used for charts.
|
||||
//
|
||||
// 0: avg response in microseconds
|
||||
//
|
||||
// 1: min response in microseconds
|
||||
//
|
||||
// 2: max response in microseconds
|
||||
//
|
||||
// 3: packet loss percentage (0-100)
|
||||
type Stats []float64
|
||||
|
||||
func (s Stats) FromResult(result Result) Stats {
|
||||
return Stats{
|
||||
result.Get(0), // avg response
|
||||
result.Get(2), // min response
|
||||
result.Get(4), // max response
|
||||
result.Get(6), // packet loss
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user