diff --git a/api/prometheus/v1/api.go b/api/prometheus/v1/api.go index 4637e3c7a..9b4fc5725 100644 --- a/api/prometheus/v1/api.go +++ b/api/prometheus/v1/api.go @@ -407,16 +407,16 @@ type queryResult struct { v model.Value } -// TSDBResult contains the result from querying the tsdb endpoint +// TSDBResult contains the result from querying the tsdb endpoint. type TSDBResult struct { - SeriesCountByMetricName []MetricCountPair `json:"seriesCountByMetricName"` - LabelValueCountByLabelName []MetricCountPair `json:"labelValueCountByLabelName"` - MemoryInBytesByLabelName []MetricCountPair `json:"memoryInBytesByLabelName"` - SeriesCountByLabelValuePair []MetricCountPair `json:"seriesCountByLabelValuePair"` + SeriesCountByMetricName []Stat `json:"seriesCountByMetricName"` + LabelValueCountByLabelName []Stat `json:"labelValueCountByLabelName"` + MemoryInBytesByLabelName []Stat `json:"memoryInBytesByLabelName"` + SeriesCountByLabelValuePair []Stat `json:"seriesCountByLabelValuePair"` } -// MetricCountPair models information about metric name and count -type MetricCountPair struct { +// Stat models information about statistic value. +type Stat struct { Name string `json:"name"` Value uint64 `json:"value"` } diff --git a/api/prometheus/v1/api_test.go b/api/prometheus/v1/api_test.go index 053efd695..1cc6d2007 100644 --- a/api/prometheus/v1/api_test.go +++ b/api/prometheus/v1/api_test.go @@ -1000,25 +1000,25 @@ func TestAPIs(t *testing.T) { }, }, res: TSDBResult{ - SeriesCountByMetricName: []MetricCountPair{ + SeriesCountByMetricName: []Stat{ { Name: "kubelet_http_requests_duration_seconds_bucket", Value: 1000, }, }, - LabelValueCountByLabelName: []MetricCountPair{ + LabelValueCountByLabelName: []Stat{ { Name: "__name__", Value: 200, }, }, - MemoryInBytesByLabelName: []MetricCountPair{ + MemoryInBytesByLabelName: []Stat{ { Name: "id", Value: 4096, }, }, - SeriesCountByLabelValuePair: []MetricCountPair{ + SeriesCountByLabelValuePair: []Stat{ { Name: "job=kubelet", Value: 30000,