VictoriaMetrics/app/vmselect/prometheus/tsdb_status_response.qtpl.go
Aliaksandr Valialkin 2ac5f00d98 app/vmselect: propagate errors from vmstorage to response to the client if -search.denyPartialResponse command-line flag is set
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/891

This commit also adds `"isPartial":{true|false}` field to `/api/v1/*` responses. `"isPartial":true` is set when the response
is based on a partial data because some of vmstorage nodes weren't available during query processing.
2020-11-14 13:20:10 +02:00

135 lines
5.6 KiB
Go

// Code generated by qtc from "tsdb_status_response.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
//line app/vmselect/prometheus/tsdb_status_response.qtpl:1
package prometheus
//line app/vmselect/prometheus/tsdb_status_response.qtpl:1
import "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
// TSDBStatusResponse generates response for /api/v1/status/tsdb .
//line app/vmselect/prometheus/tsdb_status_response.qtpl:5
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:5
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:5
func StreamTSDBStatusResponse(qw422016 *qt422016.Writer, isPartial bool, status *storage.TSDBStatus) {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:5
qw422016.N().S(`{"status":"success","isPartial":`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:8
if isPartial {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:8
qw422016.N().S(`true`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:8
} else {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:8
qw422016.N().S(`false`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:8
}
//line app/vmselect/prometheus/tsdb_status_response.qtpl:8
qw422016.N().S(`,"data":{"seriesCountByMetricName":`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:10
streamtsdbStatusEntries(qw422016, status.SeriesCountByMetricName)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:10
qw422016.N().S(`,"labelValueCountByLabelName":`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:11
streamtsdbStatusEntries(qw422016, status.LabelValueCountByLabelName)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:11
qw422016.N().S(`,"seriesCountByLabelValuePair":`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:12
streamtsdbStatusEntries(qw422016, status.SeriesCountByLabelValuePair)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:12
qw422016.N().S(`}}`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
}
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
func WriteTSDBStatusResponse(qq422016 qtio422016.Writer, isPartial bool, status *storage.TSDBStatus) {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
StreamTSDBStatusResponse(qw422016, isPartial, status)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
qt422016.ReleaseWriter(qw422016)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
}
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
func TSDBStatusResponse(isPartial bool, status *storage.TSDBStatus) string {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
qb422016 := qt422016.AcquireByteBuffer()
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
WriteTSDBStatusResponse(qb422016, isPartial, status)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
qs422016 := string(qb422016.B)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
qt422016.ReleaseByteBuffer(qb422016)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
return qs422016
//line app/vmselect/prometheus/tsdb_status_response.qtpl:15
}
//line app/vmselect/prometheus/tsdb_status_response.qtpl:17
func streamtsdbStatusEntries(qw422016 *qt422016.Writer, a []storage.TopHeapEntry) {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:17
qw422016.N().S(`[`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:19
for i, e := range a {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:19
qw422016.N().S(`{"name":`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:21
qw422016.N().Q(e.Name)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:21
qw422016.N().S(`,"value":`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:22
qw422016.N().D(int(e.Count))
//line app/vmselect/prometheus/tsdb_status_response.qtpl:22
qw422016.N().S(`}`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:24
if i+1 < len(a) {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:24
qw422016.N().S(`,`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:24
}
//line app/vmselect/prometheus/tsdb_status_response.qtpl:25
}
//line app/vmselect/prometheus/tsdb_status_response.qtpl:25
qw422016.N().S(`]`)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
}
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
func writetsdbStatusEntries(qq422016 qtio422016.Writer, a []storage.TopHeapEntry) {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
streamtsdbStatusEntries(qw422016, a)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
qt422016.ReleaseWriter(qw422016)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
}
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
func tsdbStatusEntries(a []storage.TopHeapEntry) string {
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
qb422016 := qt422016.AcquireByteBuffer()
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
writetsdbStatusEntries(qb422016, a)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
qs422016 := string(qb422016.B)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
qt422016.ReleaseByteBuffer(qb422016)
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
return qs422016
//line app/vmselect/prometheus/tsdb_status_response.qtpl:27
}