mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
b2294d1cf1
add progress bars to the VM importer The new progress bars supposed to display the processing speed per each VM importer worker. This info should help to identify if there is a bottleneck on the VM side during the import process, without waiting for its finish. The new progress bars can be disabled by passing `vm-disable-progress-bar` flag. Plotting multiple progress bars requires using experimental progress bar pool from github.com/cheggaaa/pb/v3. Switch to progress bar pool required changes in all import modes. The openTSDB mode wasn't changed due to its implementation, which implies individual progress bars per each series. Because of this, using the pool wasn't possible. Signed-off-by: dmitryk-dk <kozlovdmitriyy@gmail.com> Co-authored-by: hagen1778 <roman@victoriametrics.com>
135 lines
4.5 KiB
Go
135 lines
4.5 KiB
Go
// Code generated by qtc from "alertmanager_request.qtpl". DO NOT EDIT.
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
//line notifier/alertmanager_request.qtpl:1
|
|
package notifier
|
|
|
|
//line notifier/alertmanager_request.qtpl:1
|
|
import (
|
|
"time"
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promrelabel"
|
|
)
|
|
|
|
//line notifier/alertmanager_request.qtpl:8
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line notifier/alertmanager_request.qtpl:8
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line notifier/alertmanager_request.qtpl:8
|
|
func streamamRequest(qw422016 *qt422016.Writer, alerts []Alert, generatorURL func(Alert) string, relabelCfg *promrelabel.ParsedConfigs) {
|
|
//line notifier/alertmanager_request.qtpl:8
|
|
qw422016.N().S(`[`)
|
|
//line notifier/alertmanager_request.qtpl:10
|
|
for i, alert := range alerts {
|
|
//line notifier/alertmanager_request.qtpl:10
|
|
qw422016.N().S(`{"startsAt":`)
|
|
//line notifier/alertmanager_request.qtpl:12
|
|
qw422016.N().Q(alert.Start.Format(time.RFC3339Nano))
|
|
//line notifier/alertmanager_request.qtpl:12
|
|
qw422016.N().S(`,"generatorURL":`)
|
|
//line notifier/alertmanager_request.qtpl:13
|
|
qw422016.N().Q(generatorURL(alert))
|
|
//line notifier/alertmanager_request.qtpl:13
|
|
qw422016.N().S(`,`)
|
|
//line notifier/alertmanager_request.qtpl:14
|
|
if !alert.End.IsZero() {
|
|
//line notifier/alertmanager_request.qtpl:14
|
|
qw422016.N().S(`"endsAt":`)
|
|
//line notifier/alertmanager_request.qtpl:15
|
|
qw422016.N().Q(alert.End.Format(time.RFC3339Nano))
|
|
//line notifier/alertmanager_request.qtpl:15
|
|
qw422016.N().S(`,`)
|
|
//line notifier/alertmanager_request.qtpl:16
|
|
}
|
|
//line notifier/alertmanager_request.qtpl:16
|
|
qw422016.N().S(`"labels": {"alertname":`)
|
|
//line notifier/alertmanager_request.qtpl:18
|
|
qw422016.N().Q(alert.Name)
|
|
//line notifier/alertmanager_request.qtpl:19
|
|
lbls := alert.toPromLabels(relabelCfg)
|
|
|
|
//line notifier/alertmanager_request.qtpl:20
|
|
for _, l := range lbls {
|
|
//line notifier/alertmanager_request.qtpl:20
|
|
qw422016.N().S(`,`)
|
|
//line notifier/alertmanager_request.qtpl:21
|
|
qw422016.N().Q(l.Name)
|
|
//line notifier/alertmanager_request.qtpl:21
|
|
qw422016.N().S(`:`)
|
|
//line notifier/alertmanager_request.qtpl:21
|
|
qw422016.N().Q(l.Value)
|
|
//line notifier/alertmanager_request.qtpl:22
|
|
}
|
|
//line notifier/alertmanager_request.qtpl:22
|
|
qw422016.N().S(`},"annotations": {`)
|
|
//line notifier/alertmanager_request.qtpl:25
|
|
c := len(alert.Annotations)
|
|
|
|
//line notifier/alertmanager_request.qtpl:26
|
|
for k, v := range alert.Annotations {
|
|
//line notifier/alertmanager_request.qtpl:27
|
|
c = c - 1
|
|
|
|
//line notifier/alertmanager_request.qtpl:28
|
|
qw422016.N().Q(k)
|
|
//line notifier/alertmanager_request.qtpl:28
|
|
qw422016.N().S(`:`)
|
|
//line notifier/alertmanager_request.qtpl:28
|
|
qw422016.N().Q(v)
|
|
//line notifier/alertmanager_request.qtpl:28
|
|
if c > 0 {
|
|
//line notifier/alertmanager_request.qtpl:28
|
|
qw422016.N().S(`,`)
|
|
//line notifier/alertmanager_request.qtpl:28
|
|
}
|
|
//line notifier/alertmanager_request.qtpl:29
|
|
}
|
|
//line notifier/alertmanager_request.qtpl:29
|
|
qw422016.N().S(`}}`)
|
|
//line notifier/alertmanager_request.qtpl:32
|
|
if i != len(alerts)-1 {
|
|
//line notifier/alertmanager_request.qtpl:32
|
|
qw422016.N().S(`,`)
|
|
//line notifier/alertmanager_request.qtpl:32
|
|
}
|
|
//line notifier/alertmanager_request.qtpl:33
|
|
}
|
|
//line notifier/alertmanager_request.qtpl:33
|
|
qw422016.N().S(`]`)
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
}
|
|
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
func writeamRequest(qq422016 qtio422016.Writer, alerts []Alert, generatorURL func(Alert) string, relabelCfg *promrelabel.ParsedConfigs) {
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
streamamRequest(qw422016, alerts, generatorURL, relabelCfg)
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
}
|
|
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
func amRequest(alerts []Alert, generatorURL func(Alert) string, relabelCfg *promrelabel.ParsedConfigs) string {
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
writeamRequest(qb422016, alerts, generatorURL, relabelCfg)
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
qs422016 := string(qb422016.B)
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
return qs422016
|
|
//line notifier/alertmanager_request.qtpl:35
|
|
}
|