mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-26 20:30:10 +01:00
2ac5f00d98
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.
87 lines
3.4 KiB
Go
87 lines
3.4 KiB
Go
// Code generated by qtc from "labels_count_response.qtpl". DO NOT EDIT.
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:1
|
|
package prometheus
|
|
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:1
|
|
import "github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
|
|
|
|
// LabelsCountResponse generates response for /api/v1/labels/count .
|
|
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:5
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:5
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:5
|
|
func StreamLabelsCountResponse(qw422016 *qt422016.Writer, isPartial bool, labelEntries []storage.TagEntry) {
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:5
|
|
qw422016.N().S(`{"status":"success","isPartial":`)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:8
|
|
if isPartial {
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:8
|
|
qw422016.N().S(`true`)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:8
|
|
} else {
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:8
|
|
qw422016.N().S(`false`)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:8
|
|
}
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:8
|
|
qw422016.N().S(`,"data":{`)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:10
|
|
for i, e := range labelEntries {
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:11
|
|
qw422016.N().Q(e.Key)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:11
|
|
qw422016.N().S(`:`)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:11
|
|
qw422016.N().D(len(e.Values))
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:12
|
|
if i+1 < len(labelEntries) {
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:12
|
|
qw422016.N().S(`,`)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:12
|
|
}
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:13
|
|
}
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:13
|
|
qw422016.N().S(`}}`)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
}
|
|
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
func WriteLabelsCountResponse(qq422016 qtio422016.Writer, isPartial bool, labelEntries []storage.TagEntry) {
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
StreamLabelsCountResponse(qw422016, isPartial, labelEntries)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
}
|
|
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
func LabelsCountResponse(isPartial bool, labelEntries []storage.TagEntry) string {
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
WriteLabelsCountResponse(qb422016, isPartial, labelEntries)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
return qs422016
|
|
//line app/vmselect/prometheus/labels_count_response.qtpl:16
|
|
}
|