mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 23:39:48 +01:00
97b41e727c
Target-level debugging is performed by clicking the 'debug' link at the corresponding target on either http://vmagent:8429/targets page or on http://vmagent:8428/service-discovery page. Metric-level debugging is perfromed at http://vmagent:8429/metric-relabel-debug page. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3407 See https://docs.victoriametrics.com/vmagent.html#relabel-debug
361 lines
14 KiB
Go
361 lines
14 KiB
Go
// Code generated by qtc from "relabel_debug.qtpl". DO NOT EDIT.
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:1
|
|
package promscrape
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:1
|
|
import (
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promrelabel"
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promutils"
|
|
)
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:8
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:8
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:8
|
|
func StreamMetricRelabelDebugSteps(qw422016 *qt422016.Writer, dss []promrelabel.DebugStep, metric, relabelConfigs string, err error) {
|
|
//line lib/promscrape/relabel_debug.qtpl:8
|
|
qw422016.N().S(`<!DOCTYPE html><html lang="en"><head>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:12
|
|
streamcommonHeader(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:12
|
|
qw422016.N().S(`<title>Metric relabel debug</title></head><body>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:16
|
|
streamnavbar(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:16
|
|
qw422016.N().S(`<div class="container-fluid"><a href="https://docs.victoriametrics.com/relabeling.html" target="_blank">Relabeling docs</a><br/>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:19
|
|
if err != nil {
|
|
//line lib/promscrape/relabel_debug.qtpl:20
|
|
streamerrorNotification(qw422016, err)
|
|
//line lib/promscrape/relabel_debug.qtpl:21
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:21
|
|
qw422016.N().S(`<div class="m-3"><form method="POST"><div>Relabel configs:<br/><textarea name="relabel_configs" style="width: 50%; height: 10em">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:27
|
|
qw422016.E().S(relabelConfigs)
|
|
//line lib/promscrape/relabel_debug.qtpl:27
|
|
qw422016.N().S(`</textarea></div><div>Metric with labels:<br/><textarea name="metric" style="width: 50%">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:32
|
|
qw422016.E().S(metric)
|
|
//line lib/promscrape/relabel_debug.qtpl:32
|
|
qw422016.N().S(`</textarea></div><input type="submit" value="Submit" /></form></div><div class="row"><main class="col-12">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:40
|
|
streamrelabelDebugSteps(qw422016, dss)
|
|
//line lib/promscrape/relabel_debug.qtpl:40
|
|
qw422016.N().S(`</main></div></div></body></html>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
func WriteMetricRelabelDebugSteps(qq422016 qtio422016.Writer, dss []promrelabel.DebugStep, metric, relabelConfigs string, err error) {
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
StreamMetricRelabelDebugSteps(qw422016, dss, metric, relabelConfigs, err)
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
func MetricRelabelDebugSteps(dss []promrelabel.DebugStep, metric, relabelConfigs string, err error) string {
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
WriteMetricRelabelDebugSteps(qb422016, dss, metric, relabelConfigs, err)
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
qs422016 := string(qb422016.B)
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
return qs422016
|
|
//line lib/promscrape/relabel_debug.qtpl:46
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:48
|
|
func StreamTargetRelabelDebugSteps(qw422016 *qt422016.Writer, dss []promrelabel.DebugStep) {
|
|
//line lib/promscrape/relabel_debug.qtpl:48
|
|
qw422016.N().S(`<!DOCTYPE html><html lang="en"><head>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:52
|
|
streamcommonHeader(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:52
|
|
qw422016.N().S(`<title>Target relabel debug</title></head><body>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:56
|
|
streamnavbar(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:56
|
|
qw422016.N().S(`<div class="container-fluid"><a href="https://docs.victoriametrics.com/relabeling.html" target="_blank">Relabeling docs</a><br/><div class="row"><main class="col-12">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:61
|
|
streamrelabelDebugSteps(qw422016, dss)
|
|
//line lib/promscrape/relabel_debug.qtpl:61
|
|
qw422016.N().S(`</main></div></div></body></html>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
func WriteTargetRelabelDebugSteps(qq422016 qtio422016.Writer, dss []promrelabel.DebugStep) {
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
StreamTargetRelabelDebugSteps(qw422016, dss)
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
func TargetRelabelDebugSteps(dss []promrelabel.DebugStep) string {
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
WriteTargetRelabelDebugSteps(qb422016, dss)
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
qs422016 := string(qb422016.B)
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
return qs422016
|
|
//line lib/promscrape/relabel_debug.qtpl:67
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:69
|
|
func streamrelabelDebugSteps(qw422016 *qt422016.Writer, dss []promrelabel.DebugStep) {
|
|
//line lib/promscrape/relabel_debug.qtpl:70
|
|
if len(dss) > 0 {
|
|
//line lib/promscrape/relabel_debug.qtpl:70
|
|
qw422016.N().S(`<div class="m-3"><b>Original labels:</b> <samp>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:72
|
|
streammustFormatLabels(qw422016, dss[0].In)
|
|
//line lib/promscrape/relabel_debug.qtpl:72
|
|
qw422016.N().S(`</samp></div>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:74
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:74
|
|
qw422016.N().S(`<table class="table table-striped table-hover table-bordered table-sm"><thead><tr><th scope="col" style="width: 5%">Step</th><th scope="col" style="width: 25%">Relabeling Rule</th><th scope="col" style="width: 35%">Input Labels</th><th scope="col" stile="width: 35%">Output labels</a></tr></thead><tbody>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:85
|
|
for i, ds := range dss {
|
|
//line lib/promscrape/relabel_debug.qtpl:87
|
|
inLabels := promutils.MustNewLabelsFromString(ds.In)
|
|
outLabels := promutils.MustNewLabelsFromString(ds.Out)
|
|
changedLabels := getChangedLabelNames(inLabels, outLabels)
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:90
|
|
qw422016.N().S(`<tr><td>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:92
|
|
qw422016.N().D(i)
|
|
//line lib/promscrape/relabel_debug.qtpl:92
|
|
qw422016.N().S(`</td><td><b><pre class="m-2">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:93
|
|
qw422016.E().S(ds.Rule)
|
|
//line lib/promscrape/relabel_debug.qtpl:93
|
|
qw422016.N().S(`</pre></b></td><td><div class="m-2" style="font-size: 0.9em" title="deleted and updated labels highlighted in red">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:96
|
|
streamlabelsWithHighlight(qw422016, inLabels, changedLabels, "red")
|
|
//line lib/promscrape/relabel_debug.qtpl:96
|
|
qw422016.N().S(`</div></td><td><div class="m-2" style="font-size: 0.9em" title="added and updated labels highlighted in blue">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:101
|
|
streamlabelsWithHighlight(qw422016, outLabels, changedLabels, "blue")
|
|
//line lib/promscrape/relabel_debug.qtpl:101
|
|
qw422016.N().S(`</div></td></tr>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:105
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:105
|
|
qw422016.N().S(`</tbody></table>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:108
|
|
if len(dss) > 0 {
|
|
//line lib/promscrape/relabel_debug.qtpl:108
|
|
qw422016.N().S(`<div class="m-3"><b>Resulting labels:</b> <samp>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:110
|
|
streammustFormatLabels(qw422016, dss[len(dss)-1].Out)
|
|
//line lib/promscrape/relabel_debug.qtpl:110
|
|
qw422016.N().S(`</samp></div>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:112
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
func writerelabelDebugSteps(qq422016 qtio422016.Writer, dss []promrelabel.DebugStep) {
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
streamrelabelDebugSteps(qw422016, dss)
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
func relabelDebugSteps(dss []promrelabel.DebugStep) string {
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
writerelabelDebugSteps(qb422016, dss)
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
qs422016 := string(qb422016.B)
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
return qs422016
|
|
//line lib/promscrape/relabel_debug.qtpl:113
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:115
|
|
func streamlabelsWithHighlight(qw422016 *qt422016.Writer, labels *promutils.Labels, highlight map[string]struct{}, color string) {
|
|
//line lib/promscrape/relabel_debug.qtpl:117
|
|
labelsList := labels.GetLabels()
|
|
metricName := ""
|
|
for i, label := range labelsList {
|
|
if label.Name == "__name__" {
|
|
metricName = label.Value
|
|
labelsList = append(labelsList[:i], labelsList[i+1:]...)
|
|
break
|
|
}
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:127
|
|
if metricName != "" {
|
|
//line lib/promscrape/relabel_debug.qtpl:128
|
|
if _, ok := highlight["__name__"]; ok {
|
|
//line lib/promscrape/relabel_debug.qtpl:128
|
|
qw422016.N().S(`<span style="font-weight:bold;color:`)
|
|
//line lib/promscrape/relabel_debug.qtpl:129
|
|
qw422016.E().S(color)
|
|
//line lib/promscrape/relabel_debug.qtpl:129
|
|
qw422016.N().S(`">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:129
|
|
qw422016.E().S(metricName)
|
|
//line lib/promscrape/relabel_debug.qtpl:129
|
|
qw422016.N().S(`</span>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:130
|
|
} else {
|
|
//line lib/promscrape/relabel_debug.qtpl:131
|
|
qw422016.E().S(metricName)
|
|
//line lib/promscrape/relabel_debug.qtpl:132
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:133
|
|
if len(labelsList) == 0 {
|
|
//line lib/promscrape/relabel_debug.qtpl:133
|
|
return
|
|
//line lib/promscrape/relabel_debug.qtpl:133
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:134
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:134
|
|
qw422016.N().S(`{`)
|
|
//line lib/promscrape/relabel_debug.qtpl:136
|
|
for i, label := range labelsList {
|
|
//line lib/promscrape/relabel_debug.qtpl:137
|
|
if _, ok := highlight[label.Name]; ok {
|
|
//line lib/promscrape/relabel_debug.qtpl:137
|
|
qw422016.N().S(`<span style="font-weight:bold;color:`)
|
|
//line lib/promscrape/relabel_debug.qtpl:138
|
|
qw422016.E().S(color)
|
|
//line lib/promscrape/relabel_debug.qtpl:138
|
|
qw422016.N().S(`">`)
|
|
//line lib/promscrape/relabel_debug.qtpl:138
|
|
qw422016.E().S(label.Name)
|
|
//line lib/promscrape/relabel_debug.qtpl:138
|
|
qw422016.N().S(`=`)
|
|
//line lib/promscrape/relabel_debug.qtpl:138
|
|
qw422016.E().Q(label.Value)
|
|
//line lib/promscrape/relabel_debug.qtpl:138
|
|
qw422016.N().S(`</span>`)
|
|
//line lib/promscrape/relabel_debug.qtpl:139
|
|
} else {
|
|
//line lib/promscrape/relabel_debug.qtpl:140
|
|
qw422016.E().S(label.Name)
|
|
//line lib/promscrape/relabel_debug.qtpl:140
|
|
qw422016.N().S(`=`)
|
|
//line lib/promscrape/relabel_debug.qtpl:140
|
|
qw422016.E().Q(label.Value)
|
|
//line lib/promscrape/relabel_debug.qtpl:141
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:142
|
|
if i < len(labelsList)-1 {
|
|
//line lib/promscrape/relabel_debug.qtpl:142
|
|
qw422016.N().S(`,`)
|
|
//line lib/promscrape/relabel_debug.qtpl:142
|
|
qw422016.N().S(` `)
|
|
//line lib/promscrape/relabel_debug.qtpl:142
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:143
|
|
}
|
|
//line lib/promscrape/relabel_debug.qtpl:143
|
|
qw422016.N().S(`}`)
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
func writelabelsWithHighlight(qq422016 qtio422016.Writer, labels *promutils.Labels, highlight map[string]struct{}, color string) {
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
streamlabelsWithHighlight(qw422016, labels, highlight, color)
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
func labelsWithHighlight(labels *promutils.Labels, highlight map[string]struct{}, color string) string {
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
writelabelsWithHighlight(qb422016, labels, highlight, color)
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
qs422016 := string(qb422016.B)
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
return qs422016
|
|
//line lib/promscrape/relabel_debug.qtpl:145
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:147
|
|
func streammustFormatLabels(qw422016 *qt422016.Writer, s string) {
|
|
//line lib/promscrape/relabel_debug.qtpl:148
|
|
labels := promutils.MustNewLabelsFromString(s)
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:149
|
|
streamlabelsWithHighlight(qw422016, labels, nil, "")
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
func writemustFormatLabels(qq422016 qtio422016.Writer, s string) {
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
streammustFormatLabels(qw422016, s)
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
}
|
|
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
func mustFormatLabels(s string) string {
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
writemustFormatLabels(qb422016, s)
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
qs422016 := string(qb422016.B)
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
return qs422016
|
|
//line lib/promscrape/relabel_debug.qtpl:150
|
|
}
|