2019-05-22 21:16:55 +00:00
|
|
|
// Code generated by qtc from "util.qtpl". DO NOT EDIT.
|
|
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:1
|
|
|
|
package prometheus
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:1
|
|
|
|
import (
|
2022-05-31 23:29:19 +00:00
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/querytracer"
|
2019-05-22 21:16:55 +00:00
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
|
|
|
|
)
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:8
|
2019-05-22 21:16:55 +00:00
|
|
|
import (
|
|
|
|
qtio422016 "io"
|
|
|
|
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
|
|
)
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:8
|
2019-05-22 21:16:55 +00:00
|
|
|
var (
|
|
|
|
_ = qtio422016.Copy
|
|
|
|
_ = qt422016.AcquireByteBuffer
|
|
|
|
)
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:8
|
2019-05-22 21:16:55 +00:00
|
|
|
func streammetricNameObject(qw422016 *qt422016.Writer, mn *storage.MetricName) {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:8
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`{`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:10
|
2019-05-22 21:16:55 +00:00
|
|
|
if len(mn.MetricGroup) > 0 {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:10
|
2022-05-31 23:29:19 +00:00
|
|
|
qw422016.N().S(`"__name__":`)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:11
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().QZ(mn.MetricGroup)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:11
|
2019-05-22 21:16:55 +00:00
|
|
|
if len(mn.Tags) > 0 {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:11
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`,`)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:11
|
2022-05-31 23:29:19 +00:00
|
|
|
}
|
2019-05-22 21:16:55 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:12
|
2022-05-31 23:29:19 +00:00
|
|
|
}
|
2019-05-22 21:16:55 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:13
|
2022-05-31 23:29:19 +00:00
|
|
|
for j := range mn.Tags {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:14
|
2019-05-22 21:16:55 +00:00
|
|
|
tag := &mn.Tags[j]
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:15
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().QZ(tag.Key)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:15
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`:`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:15
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().QZ(tag.Value)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:15
|
2019-05-22 21:16:55 +00:00
|
|
|
if j+1 < len(mn.Tags) {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:15
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`,`)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:15
|
2022-05-31 23:29:19 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:16
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:16
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`}`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
func writemetricNameObject(qq422016 qtio422016.Writer, mn *storage.MetricName) {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
streammetricNameObject(qw422016, mn)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
func metricNameObject(mn *storage.MetricName) string {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
writemetricNameObject(qb422016, mn)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:18
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:20
|
2019-05-22 21:16:55 +00:00
|
|
|
func streammetricRow(qw422016 *qt422016.Writer, timestamp int64, value float64) {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:20
|
2022-05-31 23:29:19 +00:00
|
|
|
qw422016.N().S(`[`)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:21
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().F(float64(timestamp) / 1e3)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:21
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`,"`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:21
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().F(value)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:21
|
2022-05-31 23:29:19 +00:00
|
|
|
qw422016.N().S(`"]`)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
func writemetricRow(qq422016 qtio422016.Writer, timestamp int64, value float64) {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
streammetricRow(qw422016, timestamp, value)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
func metricRow(timestamp int64, value float64) string {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
writemetricRow(qb422016, timestamp, value)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:22
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2020-07-13 18:40:38 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:24
|
2022-05-31 23:29:19 +00:00
|
|
|
func streamvaluesWithTimestamps(qw422016 *qt422016.Writer, values []float64, timestamps []int64) {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:25
|
2020-07-13 18:40:38 +00:00
|
|
|
if len(values) == 0 {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:25
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().S(`[]`)
|
2020-07-13 18:31:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:27
|
2022-05-31 23:29:19 +00:00
|
|
|
return
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:28
|
2020-07-13 18:40:38 +00:00
|
|
|
}
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:28
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().S(`[`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:30
|
2020-07-13 18:40:38 +00:00
|
|
|
/* inline metricRow call here for the sake of performance optimization */
|
2019-05-22 21:16:55 +00:00
|
|
|
|
2020-07-13 18:40:38 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:30
|
2022-05-31 23:29:19 +00:00
|
|
|
qw422016.N().S(`[`)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:31
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().F(float64(timestamps[0]) / 1e3)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:31
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().S(`,"`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:31
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().F(values[0])
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:31
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().S(`"]`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:33
|
2020-07-13 18:40:38 +00:00
|
|
|
timestamps = timestamps[1:]
|
|
|
|
values = values[1:]
|
2019-05-22 21:16:55 +00:00
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:36
|
2020-07-13 18:40:38 +00:00
|
|
|
if len(values) > 0 {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:38
|
2020-07-13 18:40:38 +00:00
|
|
|
// Remove bounds check inside the loop below
|
|
|
|
_ = timestamps[len(values)-1]
|
|
|
|
|
2019-05-22 21:16:55 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:41
|
2022-05-31 23:29:19 +00:00
|
|
|
for i, v := range values {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:42
|
2020-07-13 18:40:38 +00:00
|
|
|
/* inline metricRow call here for the sake of performance optimization */
|
|
|
|
|
2020-07-13 18:31:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:42
|
2022-05-31 23:29:19 +00:00
|
|
|
qw422016.N().S(`,[`)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:43
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().F(float64(timestamps[i]) / 1e3)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:43
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().S(`,"`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:43
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().F(v)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:43
|
2022-05-31 23:29:19 +00:00
|
|
|
qw422016.N().S(`"]`)
|
2020-07-13 18:40:38 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:44
|
2022-05-31 23:29:19 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:45
|
2020-07-13 18:40:38 +00:00
|
|
|
}
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:45
|
2020-07-13 18:40:38 +00:00
|
|
|
qw422016.N().S(`]`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
func writevaluesWithTimestamps(qq422016 qtio422016.Writer, values []float64, timestamps []int64) {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
streamvaluesWithTimestamps(qw422016, values, timestamps)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
func valuesWithTimestamps(values []float64, timestamps []int64) string {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
2019-05-22 21:16:55 +00:00
|
|
|
writevaluesWithTimestamps(qb422016, values, timestamps)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
|
|
|
qs422016 := string(qb422016.B)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
|
|
|
return qs422016
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:47
|
|
|
|
}
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:49
|
|
|
|
func streamdumpQueryTrace(qw422016 *qt422016.Writer, qt *querytracer.Tracer) {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:50
|
|
|
|
traceJSON := qt.ToJSON()
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:51
|
|
|
|
if traceJSON != "" {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:51
|
|
|
|
qw422016.N().S(`,"trace":`)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:51
|
|
|
|
qw422016.N().S(traceJSON)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:51
|
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
}
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
func writedumpQueryTrace(qq422016 qtio422016.Writer, qt *querytracer.Tracer) {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
streamdumpQueryTrace(qw422016, qt)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
qt422016.ReleaseWriter(qw422016)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
}
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
func dumpQueryTrace(qt *querytracer.Tracer) string {
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
|
|
|
writedumpQueryTrace(qb422016, qt)
|
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/util.qtpl:52
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|