mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-24 03:06:48 +01:00
c448189f69
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6943 Updates https://github.com/VictoriaMetrics/victorialogs-datasource/issues/61
189 lines
7.7 KiB
Go
189 lines
7.7 KiB
Go
// Code generated by qtc from "stats_query_range_response.qtpl". DO NOT EDIT.
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
// StatsQueryRangeResponse generates response for /select/logsql/stats_query_range
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:4
|
|
package logsql
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:4
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:4
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:4
|
|
func StreamStatsQueryRangeResponse(qw422016 *qt422016.Writer, rows []*statsSeries) {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:4
|
|
qw422016.N().S(`{"status":"success","data":{"resultType":"matrix","result":[`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:10
|
|
if len(rows) > 0 {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:11
|
|
streamformatStatsSeries(qw422016, rows[0])
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:12
|
|
rows = rows[1:]
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:13
|
|
for i := range rows {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:13
|
|
qw422016.N().S(`,`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:14
|
|
streamformatStatsSeries(qw422016, rows[i])
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:15
|
|
}
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:16
|
|
}
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:16
|
|
qw422016.N().S(`]}}`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
}
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
func WriteStatsQueryRangeResponse(qq422016 qtio422016.Writer, rows []*statsSeries) {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
StreamStatsQueryRangeResponse(qw422016, rows)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
}
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
func StatsQueryRangeResponse(rows []*statsSeries) string {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
WriteStatsQueryRangeResponse(qb422016, rows)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
return qs422016
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:20
|
|
}
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:22
|
|
func streamformatStatsSeries(qw422016 *qt422016.Writer, ss *statsSeries) {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:22
|
|
qw422016.N().S(`{"metric":{"__name__":`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:25
|
|
qw422016.N().Q(ss.Name)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:26
|
|
if len(ss.Labels) > 0 {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:27
|
|
for _, label := range ss.Labels {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:27
|
|
qw422016.N().S(`,`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:28
|
|
qw422016.N().Q(label.Name)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:28
|
|
qw422016.N().S(`:`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:28
|
|
qw422016.N().Q(label.Value)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:29
|
|
}
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:30
|
|
}
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:30
|
|
qw422016.N().S(`},"values":[`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:33
|
|
points := ss.Points
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:34
|
|
if len(points) > 0 {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:35
|
|
streamformatStatsPoint(qw422016, &points[0])
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:36
|
|
points = points[1:]
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:37
|
|
for i := range points {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:37
|
|
qw422016.N().S(`,`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:38
|
|
streamformatStatsPoint(qw422016, &points[i])
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:39
|
|
}
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:40
|
|
}
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:40
|
|
qw422016.N().S(`]}`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
}
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
func writeformatStatsSeries(qq422016 qtio422016.Writer, ss *statsSeries) {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
streamformatStatsSeries(qw422016, ss)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
}
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
func formatStatsSeries(ss *statsSeries) string {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
writeformatStatsSeries(qb422016, ss)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
return qs422016
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:43
|
|
}
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:45
|
|
func streamformatStatsPoint(qw422016 *qt422016.Writer, p *statsPoint) {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:45
|
|
qw422016.N().S(`[`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:47
|
|
qw422016.N().F(float64(p.Timestamp) / 1e9)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:47
|
|
qw422016.N().S(`,`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:48
|
|
qw422016.N().Q(p.Value)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:48
|
|
qw422016.N().S(`]`)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
}
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
func writeformatStatsPoint(qq422016 qtio422016.Writer, p *statsPoint) {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
streamformatStatsPoint(qw422016, p)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
}
|
|
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
func formatStatsPoint(p *statsPoint) string {
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
writeformatStatsPoint(qb422016, p)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
qs422016 := string(qb422016.B)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
return qs422016
|
|
//line app/vlselect/logsql/stats_query_range_response.qtpl:50
|
|
}
|