Update /api/v1/status/tsdb to include headStats (#925)
Current structs for v1 HTTP API assume that there is chunkCount and timeSeriesCount on /api/v1/status/runtimeinfo, which seems to be gone for at least a few releases. /api/v1/status/tsdb now holds an extra headStats block with chunkCount, numSeries and a few other fields. Update API models and tests to reflect this change. Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
This commit is contained in:
parent
e6e54e8082
commit
dc1559e8ef
|
@ -306,8 +306,6 @@ type RuntimeinfoResult struct {
|
|||
CWD string `json:"CWD"`
|
||||
ReloadConfigSuccess bool `json:"reloadConfigSuccess"`
|
||||
LastConfigTime time.Time `json:"lastConfigTime"`
|
||||
ChunkCount int `json:"chunkCount"`
|
||||
TimeSeriesCount int `json:"timeSeriesCount"`
|
||||
CorruptionCount int `json:"corruptionCount"`
|
||||
GoroutineCount int `json:"goroutineCount"`
|
||||
GOMAXPROCS int `json:"GOMAXPROCS"`
|
||||
|
@ -434,10 +432,20 @@ type queryResult struct {
|
|||
|
||||
// TSDBResult contains the result from querying the tsdb endpoint.
|
||||
type TSDBResult struct {
|
||||
SeriesCountByMetricName []Stat `json:"seriesCountByMetricName"`
|
||||
LabelValueCountByLabelName []Stat `json:"labelValueCountByLabelName"`
|
||||
MemoryInBytesByLabelName []Stat `json:"memoryInBytesByLabelName"`
|
||||
SeriesCountByLabelValuePair []Stat `json:"seriesCountByLabelValuePair"`
|
||||
HeadStats TSDBHeadStats `json:"headStats"`
|
||||
SeriesCountByMetricName []Stat `json:"seriesCountByMetricName"`
|
||||
LabelValueCountByLabelName []Stat `json:"labelValueCountByLabelName"`
|
||||
MemoryInBytesByLabelName []Stat `json:"memoryInBytesByLabelName"`
|
||||
SeriesCountByLabelValuePair []Stat `json:"seriesCountByLabelValuePair"`
|
||||
}
|
||||
|
||||
// TSDBHeadStats contains TSDB stats
|
||||
type TSDBHeadStats struct {
|
||||
NumSeries int `json:"numSeries"`
|
||||
NumLabelPairs int `json:"numLabelPairs"`
|
||||
ChunkCount int `json:"chunkCount"`
|
||||
MinTime int `json:"minTime"`
|
||||
MaxTime int `json:"maxTime"`
|
||||
}
|
||||
|
||||
// WalReplayStatus represents the wal replay status.
|
||||
|
|
|
@ -703,8 +703,6 @@ func TestAPIs(t *testing.T) {
|
|||
"CWD": "/prometheus",
|
||||
"reloadConfigSuccess": true,
|
||||
"lastConfigTime": "2020-05-18T15:52:56Z",
|
||||
"chunkCount": 72692,
|
||||
"timeSeriesCount": 18476,
|
||||
"corruptionCount": 0,
|
||||
"goroutineCount": 217,
|
||||
"GOMAXPROCS": 2,
|
||||
|
@ -717,8 +715,6 @@ func TestAPIs(t *testing.T) {
|
|||
CWD: "/prometheus",
|
||||
ReloadConfigSuccess: true,
|
||||
LastConfigTime: time.Date(2020, 5, 18, 15, 52, 56, 0, time.UTC),
|
||||
ChunkCount: 72692,
|
||||
TimeSeriesCount: 18476,
|
||||
CorruptionCount: 0,
|
||||
GoroutineCount: 217,
|
||||
GOMAXPROCS: 2,
|
||||
|
@ -1152,6 +1148,13 @@ func TestAPIs(t *testing.T) {
|
|||
reqMethod: "GET",
|
||||
reqPath: "/api/v1/status/tsdb",
|
||||
inRes: map[string]interface{}{
|
||||
"headStats": map[string]interface{}{
|
||||
"numSeries": 18476,
|
||||
"numLabelPairs": 4301,
|
||||
"chunkCount": 72692,
|
||||
"minTime": 1634644800304,
|
||||
"maxTime": 1634650590304,
|
||||
},
|
||||
"seriesCountByMetricName": []interface{}{
|
||||
map[string]interface{}{
|
||||
"name": "kubelet_http_requests_duration_seconds_bucket",
|
||||
|
@ -1178,6 +1181,13 @@ func TestAPIs(t *testing.T) {
|
|||
},
|
||||
},
|
||||
res: TSDBResult{
|
||||
HeadStats: TSDBHeadStats{
|
||||
NumSeries: 18476,
|
||||
NumLabelPairs: 4301,
|
||||
ChunkCount: 72692,
|
||||
MinTime: 1634644800304,
|
||||
MaxTime: 1634650590304,
|
||||
},
|
||||
SeriesCountByMetricName: []Stat{
|
||||
{
|
||||
Name: "kubelet_http_requests_duration_seconds_bucket",
|
||||
|
|
Loading…
Reference in New Issue