telegraf/plugins/inputs/nomad/nomad_metrics.go

55 lines
1.3 KiB
Go
Raw Normal View History

2021-12-09 00:34:11 +08:00
package nomad
import (
"time"
)
type metricsSummary struct {
2021-12-09 00:34:11 +08:00
Timestamp string `json:"timestamp"`
Gauges []gaugeValue `json:"gauges"`
Points []pointValue `json:"points"`
Counters []sampledValue `json:"counters"`
Samples []sampledValue `json:"samples"`
2021-12-09 00:34:11 +08:00
}
type gaugeValue struct {
2021-12-09 00:34:11 +08:00
Name string `json:"name"`
Hash string `json:"-"`
Value float32 `json:"value"`
Labels []label `json:"-"`
2021-12-09 00:34:11 +08:00
DisplayLabels map[string]string `json:"Labels"`
}
type pointValue struct {
2021-12-09 00:34:11 +08:00
Name string `json:"name"`
Points []float32 `json:"points"`
}
type sampledValue struct {
2021-12-09 00:34:11 +08:00
Name string `json:"name"`
Hash string `json:"-"`
*AggregateSample
Mean float64 `json:"mean"`
Stddev float64 `json:"stddev"`
Labels []label `json:"-"`
2021-12-09 00:34:11 +08:00
DisplayLabels map[string]string `json:"Labels"`
}
// AggregateSample needs to be exported, because JSON decode cannot set embedded pointer to unexported struct
2021-12-09 00:34:11 +08:00
type AggregateSample struct {
Count int `json:"count"`
Rate float64 `json:"rate"`
Sum float64 `json:"sum"`
SumSq float64 `json:"-"`
Min float64 `json:"min"`
Max float64 `json:"max"`
LastUpdated time.Time `json:"-"`
}
type label struct {
2021-12-09 00:34:11 +08:00
Name string `json:"name"`
Value string `json:"value"`
}