2019-05-22 21:16:55 +00:00
|
|
|
// Code generated by qtc from "export.qtpl". DO NOT EDIT.
|
|
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:1
|
|
|
|
package prometheus
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:1
|
|
|
|
import (
|
2020-10-12 17:01:51 +00:00
|
|
|
"bytes"
|
2022-04-29 09:49:47 +00:00
|
|
|
"math"
|
2020-10-12 17:01:51 +00:00
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
|
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"
|
|
|
|
"github.com/valyala/quicktemplate"
|
|
|
|
)
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:14
|
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/export.qtpl:14
|
2019-05-22 21:16:55 +00:00
|
|
|
var (
|
|
|
|
_ = qtio422016.Copy
|
|
|
|
_ = qt422016.AcquireByteBuffer
|
|
|
|
)
|
|
|
|
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:14
|
2022-05-31 23:29:19 +00:00
|
|
|
func StreamExportCSVLine(qw422016 *qt422016.Writer, xb *exportBlock, fieldNames []string) {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:15
|
2020-10-12 17:01:51 +00:00
|
|
|
if len(xb.timestamps) == 0 || len(fieldNames) == 0 {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:15
|
2020-10-12 17:01:51 +00:00
|
|
|
return
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:15
|
2022-05-31 23:29:19 +00:00
|
|
|
}
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:16
|
2022-05-31 23:29:19 +00:00
|
|
|
for i, timestamp := range xb.timestamps {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:17
|
2020-10-12 17:01:51 +00:00
|
|
|
value := xb.values[i]
|
|
|
|
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:18
|
2022-05-31 23:29:19 +00:00
|
|
|
streamexportCSVField(qw422016, xb.mn, fieldNames[0], timestamp, value)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:19
|
2020-10-12 17:01:51 +00:00
|
|
|
for _, fieldName := range fieldNames[1:] {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:19
|
2020-10-12 17:01:51 +00:00
|
|
|
qw422016.N().S(`,`)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:21
|
2022-05-31 23:29:19 +00:00
|
|
|
streamexportCSVField(qw422016, xb.mn, fieldName, timestamp, value)
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:22
|
2022-05-31 23:29:19 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:23
|
2020-10-12 17:01:51 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
`)
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:24
|
2022-05-31 23:29:19 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
func WriteExportCSVLine(qq422016 qtio422016.Writer, xb *exportBlock, fieldNames []string) {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
StreamExportCSVLine(qw422016, xb, fieldNames)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
func ExportCSVLine(xb *exportBlock, fieldNames []string) string {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
WriteExportCSVLine(qb422016, xb, fieldNames)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
return qs422016
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:25
|
2020-10-12 17:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:27
|
2024-02-22 19:31:22 +00:00
|
|
|
const rfc3339Milli = "2006-01-02T15:04:05.999Z07:00"
|
|
|
|
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:28
|
2024-02-22 19:31:22 +00:00
|
|
|
func streamexportCSVField(qw422016 *qt422016.Writer, mn *storage.MetricName, fieldName string, timestamp int64, value float64) {
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:29
|
2024-02-22 19:31:22 +00:00
|
|
|
if fieldName == "__value__" {
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:30
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().F(value)
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:31
|
2024-02-22 19:31:22 +00:00
|
|
|
return
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:32
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:33
|
2024-02-22 19:31:22 +00:00
|
|
|
if fieldName == "__timestamp__" {
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:34
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().DL(timestamp)
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:35
|
2024-02-22 19:31:22 +00:00
|
|
|
return
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:36
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:37
|
2024-02-22 19:31:22 +00:00
|
|
|
if strings.HasPrefix(fieldName, "__timestamp__:") {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:38
|
2020-10-12 17:01:51 +00:00
|
|
|
timeFormat := fieldName[len("__timestamp__:"):]
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:39
|
2024-02-22 19:31:22 +00:00
|
|
|
switch timeFormat {
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:40
|
2024-02-22 19:31:22 +00:00
|
|
|
case "unix_s":
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:41
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().DL(timestamp / 1000)
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:42
|
2024-02-22 19:31:22 +00:00
|
|
|
case "unix_ms":
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:43
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().DL(timestamp)
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:44
|
2024-02-22 19:31:22 +00:00
|
|
|
case "unix_ns":
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:45
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().DL(timestamp * 1e6)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:46
|
2020-10-12 17:01:51 +00:00
|
|
|
case "rfc3339":
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:48
|
2020-10-12 17:01:51 +00:00
|
|
|
bb := quicktemplate.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
bb.B = time.Unix(timestamp/1000, (timestamp%1000)*1e6).AppendFormat(bb.B[:0], rfc3339Milli)
|
2020-10-12 17:01:51 +00:00
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:51
|
2020-10-12 17:01:51 +00:00
|
|
|
qw422016.N().Z(bb.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:53
|
2020-10-12 17:01:51 +00:00
|
|
|
quicktemplate.ReleaseByteBuffer(bb)
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:55
|
2024-02-22 19:31:22 +00:00
|
|
|
default:
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:56
|
2020-10-12 17:01:51 +00:00
|
|
|
if strings.HasPrefix(timeFormat, "custom:") {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:58
|
2020-10-12 17:01:51 +00:00
|
|
|
layout := timeFormat[len("custom:"):]
|
|
|
|
bb := quicktemplate.AcquireByteBuffer()
|
|
|
|
bb.B = time.Unix(timestamp/1000, (timestamp%1000)*1e6).AppendFormat(bb.B[:0], layout)
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:62
|
2024-02-22 19:31:22 +00:00
|
|
|
if bytes.ContainsAny(bb.B, `"`+",\n") {
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:63
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.E().QZ(bb.B)
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:64
|
2024-02-22 19:31:22 +00:00
|
|
|
} else {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:65
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().Z(bb.B)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:66
|
2020-10-12 17:01:51 +00:00
|
|
|
}
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:68
|
2020-10-12 17:01:51 +00:00
|
|
|
quicktemplate.ReleaseByteBuffer(bb)
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:70
|
2020-10-12 17:01:51 +00:00
|
|
|
} else {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:70
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().S(`Unsupported timeFormat=`)
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:71
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().S(timeFormat)
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:72
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:73
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:74
|
2024-02-22 19:31:22 +00:00
|
|
|
return
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:75
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:76
|
2020-10-12 17:01:51 +00:00
|
|
|
v := mn.GetTagValue(fieldName)
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:77
|
2024-02-22 19:31:22 +00:00
|
|
|
if bytes.ContainsAny(v, `"`+",\n") {
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:78
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().QZ(v)
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:79
|
2024-02-22 19:31:22 +00:00
|
|
|
} else {
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:80
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().Z(v)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:81
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
func writeexportCSVField(qq422016 qtio422016.Writer, mn *storage.MetricName, fieldName string, timestamp int64, value float64) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
streamexportCSVField(qw422016, mn, fieldName, timestamp, value)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
func exportCSVField(mn *storage.MetricName, fieldName string, timestamp int64, value float64) string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
writeexportCSVField(qb422016, mn, fieldName, timestamp, value)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:82
|
2020-10-12 17:01:51 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:84
|
2024-02-22 19:31:22 +00:00
|
|
|
func StreamExportPrometheusLine(qw422016 *qt422016.Writer, xb *exportBlock) {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:85
|
2020-09-26 01:29:45 +00:00
|
|
|
if len(xb.timestamps) == 0 {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:85
|
2019-05-22 21:16:55 +00:00
|
|
|
return
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:85
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:86
|
2019-05-22 21:16:55 +00:00
|
|
|
bb := quicktemplate.AcquireByteBuffer()
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:87
|
2020-09-26 01:29:45 +00:00
|
|
|
writeprometheusMetricName(bb, xb.mn)
|
2019-05-22 21:16:55 +00:00
|
|
|
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:88
|
2024-02-22 19:31:22 +00:00
|
|
|
for i, ts := range xb.timestamps {
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:89
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().Z(bb.B)
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:89
|
2022-05-31 23:29:19 +00:00
|
|
|
qw422016.N().S(` `)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:90
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().F(xb.values[i])
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:90
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().S(` `)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:91
|
|
|
|
qw422016.N().DL(ts)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:91
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:92
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:93
|
2019-05-22 21:16:55 +00:00
|
|
|
quicktemplate.ReleaseByteBuffer(bb)
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2020-09-26 01:29:45 +00:00
|
|
|
func WriteExportPrometheusLine(qq422016 qtio422016.Writer, xb *exportBlock) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2020-09-26 01:29:45 +00:00
|
|
|
StreamExportPrometheusLine(qw422016, xb)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2020-09-26 01:29:45 +00:00
|
|
|
func ExportPrometheusLine(xb *exportBlock) string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2020-09-26 01:29:45 +00:00
|
|
|
WriteExportPrometheusLine(qb422016, xb)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:94
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:96
|
2024-02-22 19:31:22 +00:00
|
|
|
func StreamExportJSONLine(qw422016 *qt422016.Writer, xb *exportBlock) {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:97
|
2020-09-26 01:29:45 +00:00
|
|
|
if len(xb.timestamps) == 0 {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:97
|
2019-05-22 21:16:55 +00:00
|
|
|
return
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:97
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:97
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`{"metric":`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:99
|
2020-09-26 01:29:45 +00:00
|
|
|
streammetricNameObject(qw422016, xb.mn)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:99
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`,"values":[`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:101
|
2024-02-22 19:31:22 +00:00
|
|
|
if len(xb.values) > 0 {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:102
|
2020-09-26 01:29:45 +00:00
|
|
|
values := xb.values
|
2019-05-22 21:16:55 +00:00
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:103
|
2024-02-22 19:31:22 +00:00
|
|
|
streamconvertValueToSpecialJSON(qw422016, values[0])
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:104
|
2019-05-22 21:16:55 +00:00
|
|
|
values = values[1:]
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:105
|
2019-05-22 21:16:55 +00:00
|
|
|
for _, v := range values {
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:105
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().S(`,`)
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:106
|
2024-02-22 19:31:22 +00:00
|
|
|
streamconvertValueToSpecialJSON(qw422016, v)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:107
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:108
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:108
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`],"timestamps":[`)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:111
|
2024-02-22 19:31:22 +00:00
|
|
|
if len(xb.timestamps) > 0 {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:112
|
2020-09-26 01:29:45 +00:00
|
|
|
timestamps := xb.timestamps
|
2019-05-22 21:16:55 +00:00
|
|
|
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:113
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().DL(timestamps[0])
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:114
|
2019-05-22 21:16:55 +00:00
|
|
|
timestamps = timestamps[1:]
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:115
|
2019-05-22 21:16:55 +00:00
|
|
|
for _, ts := range timestamps {
|
2020-10-12 17:01:51 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:115
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().S(`,`)
|
2022-04-29 09:49:47 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:116
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().DL(ts)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:117
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:118
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:118
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`]}`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:120
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`
|
|
|
|
`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2020-09-26 01:29:45 +00:00
|
|
|
func WriteExportJSONLine(qq422016 qtio422016.Writer, xb *exportBlock) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2020-09-26 01:29:45 +00:00
|
|
|
StreamExportJSONLine(qw422016, xb)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2020-09-26 01:29:45 +00:00
|
|
|
func ExportJSONLine(xb *exportBlock) string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2020-09-26 01:29:45 +00:00
|
|
|
WriteExportJSONLine(qb422016, xb)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:121
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:123
|
2020-09-26 01:29:45 +00:00
|
|
|
func StreamExportPromAPILine(qw422016 *qt422016.Writer, xb *exportBlock) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:123
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`{"metric":`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:125
|
2020-09-26 01:29:45 +00:00
|
|
|
streammetricNameObject(qw422016, xb.mn)
|
2022-05-31 23:29:19 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:125
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().S(`,"values":`)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:126
|
2020-09-26 01:29:45 +00:00
|
|
|
streamvaluesWithTimestamps(qw422016, xb.values, xb.timestamps)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:126
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`}`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2020-09-26 01:29:45 +00:00
|
|
|
func WriteExportPromAPILine(qq422016 qtio422016.Writer, xb *exportBlock) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2020-09-26 01:29:45 +00:00
|
|
|
StreamExportPromAPILine(qw422016, xb)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2020-09-26 01:29:45 +00:00
|
|
|
func ExportPromAPILine(xb *exportBlock) string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2020-09-26 01:29:45 +00:00
|
|
|
WriteExportPromAPILine(qb422016, xb)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:128
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:130
|
2022-10-01 19:05:43 +00:00
|
|
|
func StreamExportPromAPIHeader(qw422016 *qt422016.Writer) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:130
|
2022-10-01 19:05:43 +00:00
|
|
|
qw422016.N().S(`{"status":"success","data":{"resultType":"matrix","result":[`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2022-10-01 19:05:43 +00:00
|
|
|
func WriteExportPromAPIHeader(qq422016 qtio422016.Writer) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2022-10-01 19:05:43 +00:00
|
|
|
StreamExportPromAPIHeader(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2022-10-01 19:05:43 +00:00
|
|
|
func ExportPromAPIHeader() string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2022-10-01 19:05:43 +00:00
|
|
|
WriteExportPromAPIHeader(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:136
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:138
|
2022-10-01 19:05:43 +00:00
|
|
|
func StreamExportPromAPIFooter(qw422016 *qt422016.Writer, qt *querytracer.Tracer) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:138
|
2022-10-01 19:05:43 +00:00
|
|
|
qw422016.N().S(`]}`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:142
|
2022-10-01 19:05:43 +00:00
|
|
|
qt.Donef("export format=promapi")
|
2019-05-22 21:16:55 +00:00
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:144
|
2022-10-01 19:05:43 +00:00
|
|
|
streamdumpQueryTrace(qw422016, qt)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:144
|
2022-10-01 19:05:43 +00:00
|
|
|
qw422016.N().S(`}`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2022-10-01 19:05:43 +00:00
|
|
|
func WriteExportPromAPIFooter(qq422016 qtio422016.Writer, qt *querytracer.Tracer) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2022-10-01 19:05:43 +00:00
|
|
|
StreamExportPromAPIFooter(qw422016, qt)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2022-10-01 19:05:43 +00:00
|
|
|
func ExportPromAPIFooter(qt *querytracer.Tracer) string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2022-10-01 19:05:43 +00:00
|
|
|
WriteExportPromAPIFooter(qb422016, qt)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:146
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2022-10-01 19:05:43 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:148
|
2024-02-22 19:31:22 +00:00
|
|
|
func streamprometheusMetricName(qw422016 *qt422016.Writer, mn *storage.MetricName) {
|
2022-10-01 19:05:43 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:149
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().Z(mn.MetricGroup)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:150
|
2019-05-22 21:16:55 +00:00
|
|
|
if len(mn.Tags) > 0 {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:150
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`{`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:152
|
2019-05-22 21:16:55 +00:00
|
|
|
tags := mn.Tags
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:153
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().Z(tags[0].Key)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:153
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`=`)
|
2022-10-01 19:05:43 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:153
|
2024-02-22 19:31:22 +00:00
|
|
|
streamescapePrometheusLabel(qw422016, tags[0].Value)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:154
|
2019-05-22 21:16:55 +00:00
|
|
|
tags = tags[1:]
|
|
|
|
|
2022-10-01 19:05:43 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:155
|
2024-02-22 19:31:22 +00:00
|
|
|
for i := range tags {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:156
|
2019-05-22 21:16:55 +00:00
|
|
|
tag := &tags[i]
|
|
|
|
|
2022-10-01 19:05:43 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:156
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().S(`,`)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:157
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().Z(tag.Key)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:157
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`=`)
|
2022-10-01 19:05:43 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:157
|
2024-02-22 19:31:22 +00:00
|
|
|
streamescapePrometheusLabel(qw422016, tag.Value)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:158
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:158
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016.N().S(`}`)
|
2022-10-01 19:05:43 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:160
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
func writeprometheusMetricName(qq422016 qtio422016.Writer, mn *storage.MetricName) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
streamprometheusMetricName(qw422016, mn)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
func prometheusMetricName(mn *storage.MetricName) string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
writeprometheusMetricName(qb422016, mn)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:161
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
2022-10-06 10:54:20 +00:00
|
|
|
|
2022-10-06 11:50:07 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:163
|
2024-02-22 19:31:22 +00:00
|
|
|
func streamconvertValueToSpecialJSON(qw422016 *qt422016.Writer, v float64) {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:164
|
2022-10-06 10:54:20 +00:00
|
|
|
if math.IsNaN(v) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:164
|
2022-10-06 11:50:07 +00:00
|
|
|
qw422016.N().S(`null`)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:166
|
2024-02-22 19:31:22 +00:00
|
|
|
} else if math.IsInf(v, 0) {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:167
|
2022-10-06 11:50:07 +00:00
|
|
|
if v > 0 {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:167
|
2022-10-06 11:50:07 +00:00
|
|
|
qw422016.N().S(`"Infinity"`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:169
|
2022-10-06 11:50:07 +00:00
|
|
|
} else {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:169
|
2022-10-06 11:50:07 +00:00
|
|
|
qw422016.N().S(`"-Infinity"`)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:171
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
2022-10-06 11:50:07 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:172
|
2024-02-22 19:31:22 +00:00
|
|
|
} else {
|
2022-10-06 11:50:07 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:173
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().F(v)
|
2022-10-06 11:50:07 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:174
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
func writeconvertValueToSpecialJSON(qq422016 qtio422016.Writer, v float64) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
streamconvertValueToSpecialJSON(qw422016, v)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
func convertValueToSpecialJSON(v float64) string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
writeconvertValueToSpecialJSON(qb422016, v)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:175
|
2022-10-06 10:54:20 +00:00
|
|
|
}
|
2023-12-07 13:26:57 +00:00
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:177
|
2023-12-07 13:26:57 +00:00
|
|
|
func streamescapePrometheusLabel(qw422016 *qt422016.Writer, b []byte) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:177
|
2023-12-07 13:26:57 +00:00
|
|
|
qw422016.N().S(`"`)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:179
|
2024-02-22 19:31:22 +00:00
|
|
|
for len(b) > 0 {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:180
|
2023-12-07 13:26:57 +00:00
|
|
|
n := bytes.IndexAny(b, "\\\n\"")
|
|
|
|
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:181
|
2024-02-22 19:31:22 +00:00
|
|
|
if n < 0 {
|
2023-12-07 13:26:57 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:182
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().Z(b)
|
2023-12-07 13:26:57 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:183
|
2024-02-22 19:31:22 +00:00
|
|
|
break
|
2023-12-07 13:26:57 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:184
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
2023-12-07 13:26:57 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:185
|
2024-02-22 19:31:22 +00:00
|
|
|
qw422016.N().Z(b[:n])
|
2023-12-07 13:26:57 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:186
|
2024-02-22 19:31:22 +00:00
|
|
|
switch b[n] {
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:187
|
2023-12-07 13:26:57 +00:00
|
|
|
case '\\':
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:187
|
2023-12-07 13:26:57 +00:00
|
|
|
qw422016.N().S(`\\`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:189
|
2023-12-07 13:26:57 +00:00
|
|
|
case '\n':
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:189
|
2023-12-07 13:26:57 +00:00
|
|
|
qw422016.N().S(`\n`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:191
|
2023-12-07 13:26:57 +00:00
|
|
|
case '"':
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:191
|
2023-12-07 13:26:57 +00:00
|
|
|
qw422016.N().S(`\"`)
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:193
|
2024-02-22 19:31:22 +00:00
|
|
|
}
|
|
|
|
//line app/vmselect/prometheus/export.qtpl:194
|
2023-12-07 13:26:57 +00:00
|
|
|
b = b[n+1:]
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:195
|
2023-12-07 13:26:57 +00:00
|
|
|
}
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:195
|
2023-12-07 13:26:57 +00:00
|
|
|
qw422016.N().S(`"`)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
func writeescapePrometheusLabel(qq422016 qtio422016.Writer, b []byte) {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
streamescapePrometheusLabel(qw422016, b)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
qt422016.ReleaseWriter(qw422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
func escapePrometheusLabel(b []byte) string {
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
writeescapePrometheusLabel(qb422016, b)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
qs422016 := string(qb422016.B)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
return qs422016
|
2024-02-22 19:31:22 +00:00
|
|
|
//line app/vmselect/prometheus/export.qtpl:197
|
2023-12-07 13:26:57 +00:00
|
|
|
}
|