diff --git a/app/vmagent/README.md b/app/vmagent/README.md index 627d9b789..b546353c2 100644 --- a/app/vmagent/README.md +++ b/app/vmagent/README.md @@ -604,8 +604,8 @@ provide the following tools for debugging target-level and metric-level relabeli - Target-level debugging (e.g. `relabel_configs` section at [scrape_configs](https://docs.victoriametrics.com/sd_configs.html#scrape_configs)) can be performed by navigating to `http://vmagent:8429/targets` page (`http://victoriametrics:8428/targets` page for single-node VictoriaMetrics) - and clicking the `debug` link at the target, which must be debugged. - The opened page will show step-by-step results for the actual relabeling rules applied to the target labels. + and clicking the `debug target relabeling` link at the target, which must be debugged. + The opened page will show step-by-step results for the actual target relabeling rules applied to the discovered target labels. The `http://vmagent:8429/targets` page shows only active targets. If you need to understand why some target is dropped during the relabeling, then navigate to `http://vmagent:8428/service-discovery` page @@ -614,11 +614,9 @@ provide the following tools for debugging target-level and metric-level relabeli which result to target drop. - Metric-level debugging (e.g. `metric_relabel_configs` section at [scrape_configs](https://docs.victoriametrics.com/sd_configs.html#scrape_configs) - and all the relabeling, which can be set up via `-relabelConfig`, `-remoteWrite.relabelConfig` and `-remoteWrite.urlRelabelConfig` - command-line flags) can be performed by navigating to `http://vmagent:8429/metric-relabel-debug` page - (`http://victoriametrics:8428/metric-relabel-debug` page for single-node VictoriaMetrics) - and submitting there relabeling rules together with the metric to be relabeled. - The page will show step-by-step results for the entered relabeling rules executed against the entered metric. + can be performed by navigating to `http://vmagent:8429/targets` page (`http://victoriametrics:8428/targets` page for single-node VictoriaMetrics) + and clicking the `debug metrics relabeling` link at the target, which must be debugged. + The opened page will show step-by-step results for the actual metric relabeling rules applied to the given target labels. ## Prometheus staleness markers diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a27d52716..2e0bbb241 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -16,6 +16,7 @@ The following tip changes can be tested by building VictoriaMetrics components f ## tip * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add support for aggregation of incoming [samples](https://docs.victoriametrics.com/keyConcepts.html#raw-samples) by time and by labels. See [these docs](https://docs.victoriametrics.com/stream-aggregation.html) and [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3460). +* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): automatically pre-fetch `metric_relabel_configs` and the target labels when clicking on the `debug metrics relabeling` link at the `http://vmagent:8429/targets` page at the particular target. See [these docs](https://docs.victoriametrics.com/vmagent.html#relabel-debug). * FEATURE: [vmui](https://docs.victoriametrics.com/#vmui): add ability to explore metrics exported by a particular `job` / `instance`. See [these docs](https://docs.victoriametrics.com/#metrics-explorer) and [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3386). * FEATURE: allow passing partial `RFC3339` date/time to `time`, `start` and `end` query args at [querying APIs](https://docs.victoriametrics.com/#prometheus-querying-api-usage) and [export APIs](https://docs.victoriametrics.com/#how-to-export-time-series). For example, `2022` is equivalent to `2022-01-01T00:00:00Z`, while `2022-01-30T14` is equivalent to `2022-01-30T14:00:00Z`. See [these docs](https://docs.victoriametrics.com/#timestamp-formats). * FEATURE: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): allow using unicode letters in identifiers. For example, `температура{город="Киев"}` is a valid MetricsQL expression now. Previously every non-ascii letters should be escaped with `\` char when used inside MetricsQL expression: `\т\е\м\п\е\р\а\т\у\р\а{\г\о\р\о\д="Киев"}`. Now both expressions are equivalent. Thanks to @hzwwww for the [pull request](https://github.com/VictoriaMetrics/metricsql/pull/7). diff --git a/docs/vmagent.md b/docs/vmagent.md index 3f2a18c5e..c25ba3125 100644 --- a/docs/vmagent.md +++ b/docs/vmagent.md @@ -608,8 +608,8 @@ provide the following tools for debugging target-level and metric-level relabeli - Target-level debugging (e.g. `relabel_configs` section at [scrape_configs](https://docs.victoriametrics.com/sd_configs.html#scrape_configs)) can be performed by navigating to `http://vmagent:8429/targets` page (`http://victoriametrics:8428/targets` page for single-node VictoriaMetrics) - and clicking the `debug` link at the target, which must be debugged. - The opened page will show step-by-step results for the actual relabeling rules applied to the target labels. + and clicking the `debug target relabeling` link at the target, which must be debugged. + The opened page will show step-by-step results for the actual target relabeling rules applied to the discovered target labels. The `http://vmagent:8429/targets` page shows only active targets. If you need to understand why some target is dropped during the relabeling, then navigate to `http://vmagent:8428/service-discovery` page @@ -618,11 +618,9 @@ provide the following tools for debugging target-level and metric-level relabeli which result to target drop. - Metric-level debugging (e.g. `metric_relabel_configs` section at [scrape_configs](https://docs.victoriametrics.com/sd_configs.html#scrape_configs) - and all the relabeling, which can be set up via `-relabelConfig`, `-remoteWrite.relabelConfig` and `-remoteWrite.urlRelabelConfig` - command-line flags) can be performed by navigating to `http://vmagent:8429/metric-relabel-debug` page - (`http://victoriametrics:8428/metric-relabel-debug` page for single-node VictoriaMetrics) - and submitting there relabeling rules together with the metric to be relabeled. - The page will show step-by-step results for the entered relabeling rules executed against the entered metric. + can be performed by navigating to `http://vmagent:8429/targets` page (`http://victoriametrics:8428/targets` page for single-node VictoriaMetrics) + and clicking the `debug metrics relabeling` link at the target, which must be debugged. + The opened page will show step-by-step results for the actual metric relabeling rules applied to the given target labels. ## Prometheus staleness markers diff --git a/lib/promrelabel/debug.go b/lib/promrelabel/debug.go index a12ee2f69..6fed35bcc 100644 --- a/lib/promrelabel/debug.go +++ b/lib/promrelabel/debug.go @@ -7,51 +7,39 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/lib/promutils" ) -// WriteMetricRelabelDebug writes /metric-relabel-debug page to w with the given metric and relabelConfigs fields. -func WriteMetricRelabelDebug(w io.Writer, metric, relabelConfigs string) { - if metric == "" { - metric = "{}" - } - labels, err := promutils.NewLabelsFromString(metric) - if err != nil { - err = fmt.Errorf("cannot parse metric: %s", err) - WriteMetricRelabelDebugSteps(w, nil, metric, relabelConfigs, err) - return - } - pcs, err := ParseRelabelConfigsData([]byte(relabelConfigs)) - if err != nil { - err = fmt.Errorf("cannot parse relabel configs: %s", err) - WriteMetricRelabelDebugSteps(w, nil, metric, relabelConfigs, err) - return - } - - dss := newDebugRelabelSteps(pcs, labels, false) - WriteMetricRelabelDebugSteps(w, dss, metric, relabelConfigs, nil) +// WriteMetricRelabelDebug writes /metric-relabel-debug page to w with the corresponding args. +func WriteMetricRelabelDebug(w io.Writer, targetID, metric, relabelConfigs string, err error) { + writeRelabelDebug(w, false, targetID, metric, relabelConfigs, err) } // WriteTargetRelabelDebug writes /target-relabel-debug page to w with the corresponding args. func WriteTargetRelabelDebug(w io.Writer, targetID, metric, relabelConfigs string, err error) { + writeRelabelDebug(w, true, targetID, metric, relabelConfigs, err) +} + +func writeRelabelDebug(w io.Writer, isTargetRelabel bool, targetID, metric, relabelConfigs string, err error) { if metric == "" { metric = "{}" } if targetID == "" { - WriteTargetRelabelDebugSteps(w, targetID, nil, metric, relabelConfigs, err) + WriteRelabelDebugSteps(w, isTargetRelabel, targetID, nil, metric, relabelConfigs, err) return } labels, err := promutils.NewLabelsFromString(metric) if err != nil { err = fmt.Errorf("cannot parse metric: %s", err) - WriteTargetRelabelDebugSteps(w, targetID, nil, metric, relabelConfigs, err) + WriteRelabelDebugSteps(w, isTargetRelabel, targetID, nil, metric, relabelConfigs, err) return } pcs, err := ParseRelabelConfigsData([]byte(relabelConfigs)) if err != nil { err = fmt.Errorf("cannot parse relabel configs: %s", err) - WriteTargetRelabelDebugSteps(w, targetID, nil, metric, relabelConfigs, err) + WriteRelabelDebugSteps(w, isTargetRelabel, targetID, nil, metric, relabelConfigs, err) return } - dss := newDebugRelabelSteps(pcs, labels, true) - WriteTargetRelabelDebugSteps(w, targetID, dss, metric, relabelConfigs, nil) + + dss := newDebugRelabelSteps(pcs, labels, isTargetRelabel) + WriteRelabelDebugSteps(w, isTargetRelabel, targetID, dss, metric, relabelConfigs, nil) } func newDebugRelabelSteps(pcs *ParsedConfigs, labels *promutils.Labels, isTargetRelabel bool) []DebugStep { diff --git a/lib/promrelabel/debug.qtpl b/lib/promrelabel/debug.qtpl index f6cf7c399..76dfd719a 100644 --- a/lib/promrelabel/debug.qtpl +++ b/lib/promrelabel/debug.qtpl @@ -5,7 +5,7 @@ {% stripspace %} -{% func MetricRelabelDebugSteps(dss []DebugStep, metric, relabelConfigs string, err error) %} +{% func RelabelDebugSteps(isTargetRelabel bool, targetID string, dss []DebugStep, metric, relabelConfigs string, err error) %} @@ -16,7 +16,13 @@ {%= htmlcomponents.Navbar() %}
Relabeling docs{% space %} - Target relabel debug + + {% if isTargetRelabel %} + Metric relabel debug + {% else %} + Target relabel debug + {% endif %} +
{% if err != nil %} {%= htmlcomponents.ErrorNotification(err) %} @@ -25,54 +31,17 @@
{%= relabelDebugFormInputs(metric, relabelConfigs) %} - - -
-
- -
-
- {%= relabelDebugSteps(dss) %} -
-
-
- - -{% endfunc %} - -{% func TargetRelabelDebugSteps(targetID string, dss []DebugStep, metric, relabelConfigs string, err error) %} - - - - {%= htmlcomponents.CommonHeader() %} - Target relabel debug - - - {%= htmlcomponents.Navbar() %} -
- Relabeling docs{% space %} - Metric relabel debug -
- {% if err != nil %} - {%= htmlcomponents.ErrorNotification(err) %} - {% endif %} - -
-
- {%= relabelDebugFormInputs(metric, relabelConfigs) %} - - {% if targetID != "" %} - + {% endif %}
- {%= relabelDebugSteps(dss) %} + {%= relabelDebugSteps(dss) %}
diff --git a/lib/promrelabel/debug.qtpl.go b/lib/promrelabel/debug.qtpl.go index 1cbdf2749..c4a29f8d2 100644 --- a/lib/promrelabel/debug.qtpl.go +++ b/lib/promrelabel/debug.qtpl.go @@ -24,7 +24,7 @@ var ( ) //line lib/promrelabel/debug.qtpl:8 -func StreamMetricRelabelDebugSteps(qw422016 *qt422016.Writer, dss []DebugStep, metric, relabelConfigs string, err error) { +func StreamRelabelDebugSteps(qw422016 *qt422016.Writer, isTargetRelabel bool, targetID string, dss []DebugStep, metric, relabelConfigs string, err error) { //line lib/promrelabel/debug.qtpl:8 qw422016.N().S(``) //line lib/promrelabel/debug.qtpl:12 @@ -37,256 +37,213 @@ func StreamMetricRelabelDebugSteps(qw422016 *qt422016.Writer, dss []DebugStep, m qw422016.N().S(`
Relabeling docs`) //line lib/promrelabel/debug.qtpl:18 qw422016.N().S(` `) -//line lib/promrelabel/debug.qtpl:18 - qw422016.N().S(`Target relabel debug
`) +//line lib/promrelabel/debug.qtpl:20 + if isTargetRelabel { +//line lib/promrelabel/debug.qtpl:20 + qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:27 - streamrelabelDebugFormInputs(qw422016, metric, relabelConfigs) -//line lib/promrelabel/debug.qtpl:27 - qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:35 - streamrelabelDebugSteps(qw422016, dss) -//line lib/promrelabel/debug.qtpl:35 - qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:41 -} - -//line lib/promrelabel/debug.qtpl:41 -func WriteMetricRelabelDebugSteps(qq422016 qtio422016.Writer, dss []DebugStep, metric, relabelConfigs string, err error) { -//line lib/promrelabel/debug.qtpl:41 - qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promrelabel/debug.qtpl:41 - StreamMetricRelabelDebugSteps(qw422016, dss, metric, relabelConfigs, err) -//line lib/promrelabel/debug.qtpl:41 - qt422016.ReleaseWriter(qw422016) -//line lib/promrelabel/debug.qtpl:41 -} - -//line lib/promrelabel/debug.qtpl:41 -func MetricRelabelDebugSteps(dss []DebugStep, metric, relabelConfigs string, err error) string { -//line lib/promrelabel/debug.qtpl:41 - qb422016 := qt422016.AcquireByteBuffer() -//line lib/promrelabel/debug.qtpl:41 - WriteMetricRelabelDebugSteps(qb422016, dss, metric, relabelConfigs, err) -//line lib/promrelabel/debug.qtpl:41 - qs422016 := string(qb422016.B) -//line lib/promrelabel/debug.qtpl:41 - qt422016.ReleaseByteBuffer(qb422016) -//line lib/promrelabel/debug.qtpl:41 - return qs422016 -//line lib/promrelabel/debug.qtpl:41 -} - -//line lib/promrelabel/debug.qtpl:43 -func StreamTargetRelabelDebugSteps(qw422016 *qt422016.Writer, targetID string, dss []DebugStep, metric, relabelConfigs string, err error) { -//line lib/promrelabel/debug.qtpl:43 - qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:47 - htmlcomponents.StreamCommonHeader(qw422016) -//line lib/promrelabel/debug.qtpl:47 - qw422016.N().S(`Target relabel debug`) -//line lib/promrelabel/debug.qtpl:51 - htmlcomponents.StreamNavbar(qw422016) -//line lib/promrelabel/debug.qtpl:51 - qw422016.N().S(`
Relabeling docs`) -//line lib/promrelabel/debug.qtpl:53 - qw422016.N().S(` `) -//line lib/promrelabel/debug.qtpl:53 - qw422016.N().S(`Metric relabel debug
`) -//line lib/promrelabel/debug.qtpl:56 - if err != nil { -//line lib/promrelabel/debug.qtpl:57 - htmlcomponents.StreamErrorNotification(qw422016, err) -//line lib/promrelabel/debug.qtpl:58 - } -//line lib/promrelabel/debug.qtpl:58 - qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:62 - streamrelabelDebugFormInputs(qw422016, metric, relabelConfigs) -//line lib/promrelabel/debug.qtpl:62 - qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:67 - if targetID != "" { -//line lib/promrelabel/debug.qtpl:67 - qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:69 +//line lib/promrelabel/debug.qtpl:21 + qw422016.N().S(`">Metric relabel debug`) +//line lib/promrelabel/debug.qtpl:22 + } else { +//line lib/promrelabel/debug.qtpl:22 + qw422016.N().S(`Target relabel debug`) +//line lib/promrelabel/debug.qtpl:24 } -//line lib/promrelabel/debug.qtpl:69 - qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:75 - streamrelabelDebugSteps(qw422016, dss) -//line lib/promrelabel/debug.qtpl:75 - qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:81 -} - -//line lib/promrelabel/debug.qtpl:81 -func WriteTargetRelabelDebugSteps(qq422016 qtio422016.Writer, targetID string, dss []DebugStep, metric, relabelConfigs string, err error) { -//line lib/promrelabel/debug.qtpl:81 - qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promrelabel/debug.qtpl:81 - StreamTargetRelabelDebugSteps(qw422016, targetID, dss, metric, relabelConfigs, err) -//line lib/promrelabel/debug.qtpl:81 - qt422016.ReleaseWriter(qw422016) -//line lib/promrelabel/debug.qtpl:81 -} - -//line lib/promrelabel/debug.qtpl:81 -func TargetRelabelDebugSteps(targetID string, dss []DebugStep, metric, relabelConfigs string, err error) string { -//line lib/promrelabel/debug.qtpl:81 - qb422016 := qt422016.AcquireByteBuffer() -//line lib/promrelabel/debug.qtpl:81 - WriteTargetRelabelDebugSteps(qb422016, targetID, dss, metric, relabelConfigs, err) -//line lib/promrelabel/debug.qtpl:81 - qs422016 := string(qb422016.B) -//line lib/promrelabel/debug.qtpl:81 - qt422016.ReleaseByteBuffer(qb422016) -//line lib/promrelabel/debug.qtpl:81 - return qs422016 -//line lib/promrelabel/debug.qtpl:81 -} - -//line lib/promrelabel/debug.qtpl:83 -func streamrelabelDebugFormInputs(qw422016 *qt422016.Writer, metric, relabelConfigs string) { -//line lib/promrelabel/debug.qtpl:83 - qw422016.N().S(`
Relabel configs:
Labels:
`) -//line lib/promrelabel/debug.qtpl:93 -} - -//line lib/promrelabel/debug.qtpl:93 -func writerelabelDebugFormInputs(qq422016 qtio422016.Writer, metric, relabelConfigs string) { -//line lib/promrelabel/debug.qtpl:93 - qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promrelabel/debug.qtpl:93 +//line lib/promrelabel/debug.qtpl:24 + qw422016.N().S(`
`) +//line lib/promrelabel/debug.qtpl:27 + if err != nil { +//line lib/promrelabel/debug.qtpl:28 + htmlcomponents.StreamErrorNotification(qw422016, err) +//line lib/promrelabel/debug.qtpl:29 + } +//line lib/promrelabel/debug.qtpl:29 + qw422016.N().S(`
`) +//line lib/promrelabel/debug.qtpl:33 streamrelabelDebugFormInputs(qw422016, metric, relabelConfigs) -//line lib/promrelabel/debug.qtpl:93 - qt422016.ReleaseWriter(qw422016) -//line lib/promrelabel/debug.qtpl:93 -} - -//line lib/promrelabel/debug.qtpl:93 -func relabelDebugFormInputs(metric, relabelConfigs string) string { -//line lib/promrelabel/debug.qtpl:93 - qb422016 := qt422016.AcquireByteBuffer() -//line lib/promrelabel/debug.qtpl:93 - writerelabelDebugFormInputs(qb422016, metric, relabelConfigs) -//line lib/promrelabel/debug.qtpl:93 - qs422016 := string(qb422016.B) -//line lib/promrelabel/debug.qtpl:93 - qt422016.ReleaseByteBuffer(qb422016) -//line lib/promrelabel/debug.qtpl:93 - return qs422016 -//line lib/promrelabel/debug.qtpl:93 -} - -//line lib/promrelabel/debug.qtpl:95 -func streamrelabelDebugSteps(qw422016 *qt422016.Writer, dss []DebugStep) { -//line lib/promrelabel/debug.qtpl:96 - if len(dss) > 0 { -//line lib/promrelabel/debug.qtpl:96 - qw422016.N().S(`
Original labels: `) -//line lib/promrelabel/debug.qtpl:98 - streammustFormatLabels(qw422016, dss[0].In) -//line lib/promrelabel/debug.qtpl:98 - qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:100 +//line lib/promrelabel/debug.qtpl:33 + qw422016.N().S(``) +//line lib/promrelabel/debug.qtpl:36 + if targetID != "" { +//line lib/promrelabel/debug.qtpl:36 + qw422016.N().S(``) +//line lib/promrelabel/debug.qtpl:38 } -//line lib/promrelabel/debug.qtpl:100 +//line lib/promrelabel/debug.qtpl:38 + qw422016.N().S(`
`) +//line lib/promrelabel/debug.qtpl:44 + streamrelabelDebugSteps(qw422016, dss) +//line lib/promrelabel/debug.qtpl:44 + qw422016.N().S(`
`) +//line lib/promrelabel/debug.qtpl:50 +} + +//line lib/promrelabel/debug.qtpl:50 +func WriteRelabelDebugSteps(qq422016 qtio422016.Writer, isTargetRelabel bool, targetID string, dss []DebugStep, metric, relabelConfigs string, err error) { +//line lib/promrelabel/debug.qtpl:50 + qw422016 := qt422016.AcquireWriter(qq422016) +//line lib/promrelabel/debug.qtpl:50 + StreamRelabelDebugSteps(qw422016, isTargetRelabel, targetID, dss, metric, relabelConfigs, err) +//line lib/promrelabel/debug.qtpl:50 + qt422016.ReleaseWriter(qw422016) +//line lib/promrelabel/debug.qtpl:50 +} + +//line lib/promrelabel/debug.qtpl:50 +func RelabelDebugSteps(isTargetRelabel bool, targetID string, dss []DebugStep, metric, relabelConfigs string, err error) string { +//line lib/promrelabel/debug.qtpl:50 + qb422016 := qt422016.AcquireByteBuffer() +//line lib/promrelabel/debug.qtpl:50 + WriteRelabelDebugSteps(qb422016, isTargetRelabel, targetID, dss, metric, relabelConfigs, err) +//line lib/promrelabel/debug.qtpl:50 + qs422016 := string(qb422016.B) +//line lib/promrelabel/debug.qtpl:50 + qt422016.ReleaseByteBuffer(qb422016) +//line lib/promrelabel/debug.qtpl:50 + return qs422016 +//line lib/promrelabel/debug.qtpl:50 +} + +//line lib/promrelabel/debug.qtpl:52 +func streamrelabelDebugFormInputs(qw422016 *qt422016.Writer, metric, relabelConfigs string) { +//line lib/promrelabel/debug.qtpl:52 + qw422016.N().S(`
Relabel configs:
Labels:
`) +//line lib/promrelabel/debug.qtpl:62 +} + +//line lib/promrelabel/debug.qtpl:62 +func writerelabelDebugFormInputs(qq422016 qtio422016.Writer, metric, relabelConfigs string) { +//line lib/promrelabel/debug.qtpl:62 + qw422016 := qt422016.AcquireWriter(qq422016) +//line lib/promrelabel/debug.qtpl:62 + streamrelabelDebugFormInputs(qw422016, metric, relabelConfigs) +//line lib/promrelabel/debug.qtpl:62 + qt422016.ReleaseWriter(qw422016) +//line lib/promrelabel/debug.qtpl:62 +} + +//line lib/promrelabel/debug.qtpl:62 +func relabelDebugFormInputs(metric, relabelConfigs string) string { +//line lib/promrelabel/debug.qtpl:62 + qb422016 := qt422016.AcquireByteBuffer() +//line lib/promrelabel/debug.qtpl:62 + writerelabelDebugFormInputs(qb422016, metric, relabelConfigs) +//line lib/promrelabel/debug.qtpl:62 + qs422016 := string(qb422016.B) +//line lib/promrelabel/debug.qtpl:62 + qt422016.ReleaseByteBuffer(qb422016) +//line lib/promrelabel/debug.qtpl:62 + return qs422016 +//line lib/promrelabel/debug.qtpl:62 +} + +//line lib/promrelabel/debug.qtpl:64 +func streamrelabelDebugSteps(qw422016 *qt422016.Writer, dss []DebugStep) { +//line lib/promrelabel/debug.qtpl:65 + if len(dss) > 0 { +//line lib/promrelabel/debug.qtpl:65 + qw422016.N().S(`
Original labels: `) +//line lib/promrelabel/debug.qtpl:67 + streammustFormatLabels(qw422016, dss[0].In) +//line lib/promrelabel/debug.qtpl:67 + qw422016.N().S(`
`) +//line lib/promrelabel/debug.qtpl:69 + } +//line lib/promrelabel/debug.qtpl:69 qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:111 +//line lib/promrelabel/debug.qtpl:80 for i, ds := range dss { -//line lib/promrelabel/debug.qtpl:113 +//line lib/promrelabel/debug.qtpl:82 inLabels := promutils.MustNewLabelsFromString(ds.In) outLabels := promutils.MustNewLabelsFromString(ds.Out) changedLabels := getChangedLabelNames(inLabels, outLabels) -//line lib/promrelabel/debug.qtpl:116 +//line lib/promrelabel/debug.qtpl:85 qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:131 +//line lib/promrelabel/debug.qtpl:100 } -//line lib/promrelabel/debug.qtpl:131 +//line lib/promrelabel/debug.qtpl:100 qw422016.N().S(`
StepRelabeling RuleInput LabelsOutput labels
`) -//line lib/promrelabel/debug.qtpl:118 +//line lib/promrelabel/debug.qtpl:87 qw422016.N().D(i) -//line lib/promrelabel/debug.qtpl:118 +//line lib/promrelabel/debug.qtpl:87 qw422016.N().S(`
`)
-//line lib/promrelabel/debug.qtpl:119
+//line lib/promrelabel/debug.qtpl:88
 		qw422016.E().S(ds.Rule)
-//line lib/promrelabel/debug.qtpl:119
+//line lib/promrelabel/debug.qtpl:88
 		qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:122 +//line lib/promrelabel/debug.qtpl:91 streamlabelsWithHighlight(qw422016, inLabels, changedLabels, "red") -//line lib/promrelabel/debug.qtpl:122 +//line lib/promrelabel/debug.qtpl:91 qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:127 +//line lib/promrelabel/debug.qtpl:96 streamlabelsWithHighlight(qw422016, outLabels, changedLabels, "blue") -//line lib/promrelabel/debug.qtpl:127 +//line lib/promrelabel/debug.qtpl:96 qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:134 +//line lib/promrelabel/debug.qtpl:103 if len(dss) > 0 { -//line lib/promrelabel/debug.qtpl:134 +//line lib/promrelabel/debug.qtpl:103 qw422016.N().S(`
Resulting labels: `) -//line lib/promrelabel/debug.qtpl:136 +//line lib/promrelabel/debug.qtpl:105 streammustFormatLabels(qw422016, dss[len(dss)-1].Out) -//line lib/promrelabel/debug.qtpl:136 +//line lib/promrelabel/debug.qtpl:105 qw422016.N().S(`
`) -//line lib/promrelabel/debug.qtpl:138 +//line lib/promrelabel/debug.qtpl:107 } -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 } -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 func writerelabelDebugSteps(qq422016 qtio422016.Writer, dss []DebugStep) { -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 streamrelabelDebugSteps(qw422016, dss) -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 qt422016.ReleaseWriter(qw422016) -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 } -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 func relabelDebugSteps(dss []DebugStep) string { -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 writerelabelDebugSteps(qb422016, dss) -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 qs422016 := string(qb422016.B) -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 return qs422016 -//line lib/promrelabel/debug.qtpl:139 +//line lib/promrelabel/debug.qtpl:108 } -//line lib/promrelabel/debug.qtpl:141 +//line lib/promrelabel/debug.qtpl:110 func streamlabelsWithHighlight(qw422016 *qt422016.Writer, labels *promutils.Labels, highlight map[string]struct{}, color string) { -//line lib/promrelabel/debug.qtpl:143 +//line lib/promrelabel/debug.qtpl:112 labelsList := labels.GetLabels() metricName := "" for i, label := range labelsList { @@ -297,137 +254,137 @@ func streamlabelsWithHighlight(qw422016 *qt422016.Writer, labels *promutils.Labe } } -//line lib/promrelabel/debug.qtpl:153 +//line lib/promrelabel/debug.qtpl:122 if metricName != "" { -//line lib/promrelabel/debug.qtpl:154 +//line lib/promrelabel/debug.qtpl:123 if _, ok := highlight["__name__"]; ok { -//line lib/promrelabel/debug.qtpl:154 +//line lib/promrelabel/debug.qtpl:123 qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:155 +//line lib/promrelabel/debug.qtpl:124 qw422016.E().S(metricName) -//line lib/promrelabel/debug.qtpl:155 +//line lib/promrelabel/debug.qtpl:124 qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:156 +//line lib/promrelabel/debug.qtpl:125 } else { -//line lib/promrelabel/debug.qtpl:157 +//line lib/promrelabel/debug.qtpl:126 qw422016.E().S(metricName) -//line lib/promrelabel/debug.qtpl:158 +//line lib/promrelabel/debug.qtpl:127 } -//line lib/promrelabel/debug.qtpl:159 +//line lib/promrelabel/debug.qtpl:128 if len(labelsList) == 0 { -//line lib/promrelabel/debug.qtpl:159 +//line lib/promrelabel/debug.qtpl:128 return -//line lib/promrelabel/debug.qtpl:159 +//line lib/promrelabel/debug.qtpl:128 } -//line lib/promrelabel/debug.qtpl:160 +//line lib/promrelabel/debug.qtpl:129 } -//line lib/promrelabel/debug.qtpl:160 +//line lib/promrelabel/debug.qtpl:129 qw422016.N().S(`{`) -//line lib/promrelabel/debug.qtpl:162 +//line lib/promrelabel/debug.qtpl:131 for i, label := range labelsList { -//line lib/promrelabel/debug.qtpl:163 +//line lib/promrelabel/debug.qtpl:132 if _, ok := highlight[label.Name]; ok { -//line lib/promrelabel/debug.qtpl:163 +//line lib/promrelabel/debug.qtpl:132 qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:164 +//line lib/promrelabel/debug.qtpl:133 qw422016.E().S(label.Name) -//line lib/promrelabel/debug.qtpl:164 +//line lib/promrelabel/debug.qtpl:133 qw422016.N().S(`=`) -//line lib/promrelabel/debug.qtpl:164 +//line lib/promrelabel/debug.qtpl:133 qw422016.E().Q(label.Value) -//line lib/promrelabel/debug.qtpl:164 +//line lib/promrelabel/debug.qtpl:133 qw422016.N().S(``) -//line lib/promrelabel/debug.qtpl:165 +//line lib/promrelabel/debug.qtpl:134 } else { -//line lib/promrelabel/debug.qtpl:166 +//line lib/promrelabel/debug.qtpl:135 qw422016.E().S(label.Name) -//line lib/promrelabel/debug.qtpl:166 +//line lib/promrelabel/debug.qtpl:135 qw422016.N().S(`=`) -//line lib/promrelabel/debug.qtpl:166 +//line lib/promrelabel/debug.qtpl:135 qw422016.E().Q(label.Value) -//line lib/promrelabel/debug.qtpl:167 +//line lib/promrelabel/debug.qtpl:136 } -//line lib/promrelabel/debug.qtpl:168 +//line lib/promrelabel/debug.qtpl:137 if i < len(labelsList)-1 { -//line lib/promrelabel/debug.qtpl:168 +//line lib/promrelabel/debug.qtpl:137 qw422016.N().S(`,`) -//line lib/promrelabel/debug.qtpl:168 +//line lib/promrelabel/debug.qtpl:137 qw422016.N().S(` `) -//line lib/promrelabel/debug.qtpl:168 +//line lib/promrelabel/debug.qtpl:137 } -//line lib/promrelabel/debug.qtpl:169 +//line lib/promrelabel/debug.qtpl:138 } -//line lib/promrelabel/debug.qtpl:169 +//line lib/promrelabel/debug.qtpl:138 qw422016.N().S(`}`) -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 } -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 func writelabelsWithHighlight(qq422016 qtio422016.Writer, labels *promutils.Labels, highlight map[string]struct{}, color string) { -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 streamlabelsWithHighlight(qw422016, labels, highlight, color) -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 qt422016.ReleaseWriter(qw422016) -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 } -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 func labelsWithHighlight(labels *promutils.Labels, highlight map[string]struct{}, color string) string { -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 writelabelsWithHighlight(qb422016, labels, highlight, color) -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 qs422016 := string(qb422016.B) -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 return qs422016 -//line lib/promrelabel/debug.qtpl:171 +//line lib/promrelabel/debug.qtpl:140 } -//line lib/promrelabel/debug.qtpl:173 +//line lib/promrelabel/debug.qtpl:142 func streammustFormatLabels(qw422016 *qt422016.Writer, s string) { -//line lib/promrelabel/debug.qtpl:174 +//line lib/promrelabel/debug.qtpl:143 labels := promutils.MustNewLabelsFromString(s) -//line lib/promrelabel/debug.qtpl:175 +//line lib/promrelabel/debug.qtpl:144 streamlabelsWithHighlight(qw422016, labels, nil, "") -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 } -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 func writemustFormatLabels(qq422016 qtio422016.Writer, s string) { -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 streammustFormatLabels(qw422016, s) -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 qt422016.ReleaseWriter(qw422016) -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 } -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 func mustFormatLabels(s string) string { -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 writemustFormatLabels(qb422016, s) -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 qs422016 := string(qb422016.B) -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 return qs422016 -//line lib/promrelabel/debug.qtpl:176 +//line lib/promrelabel/debug.qtpl:145 } diff --git a/lib/promscrape/relabel_debug.go b/lib/promscrape/relabel_debug.go index 2ef6b0bd1..47066fea2 100644 --- a/lib/promscrape/relabel_debug.go +++ b/lib/promscrape/relabel_debug.go @@ -9,9 +9,22 @@ import ( // WriteMetricRelabelDebug serves requests to /metric-relabel-debug page func WriteMetricRelabelDebug(w http.ResponseWriter, r *http.Request) { + targetID := r.FormValue("id") metric := r.FormValue("metric") relabelConfigs := r.FormValue("relabel_configs") - promrelabel.WriteMetricRelabelDebug(w, metric, relabelConfigs) + var err error + + if metric == "" && relabelConfigs == "" { + pcs, labels, ok := getMetricRelabelContextByTargetID(targetID) + if !ok { + err = fmt.Errorf("cannot find target for id=%s", targetID) + targetID = "" + } else { + metric = labels.String() + relabelConfigs = pcs.String() + } + } + promrelabel.WriteMetricRelabelDebug(w, targetID, metric, relabelConfigs, err) } // WriteTargetRelabelDebug generates response for /target-relabel-debug page @@ -22,7 +35,7 @@ func WriteTargetRelabelDebug(w http.ResponseWriter, r *http.Request) { var err error if metric == "" && relabelConfigs == "" { - pcs, labels, ok := getRelabelContextByTargetID(targetID) + pcs, labels, ok := getTargetRelabelContextByTargetID(targetID) if !ok { err = fmt.Errorf("cannot find target for id=%s", targetID) targetID = "" diff --git a/lib/promscrape/targetstatus.go b/lib/promscrape/targetstatus.go index c9f6e32d1..fe7eccb17 100644 --- a/lib/promscrape/targetstatus.go +++ b/lib/promscrape/targetstatus.go @@ -520,7 +520,20 @@ type targetLabelsByJob struct { droppedTargets int } -func getRelabelContextByTargetID(targetID string) (*promrelabel.ParsedConfigs, *promutils.Labels, bool) { +func getMetricRelabelContextByTargetID(targetID string) (*promrelabel.ParsedConfigs, *promutils.Labels, bool) { + tsmGlobal.mu.Lock() + defer tsmGlobal.mu.Unlock() + + for sw := range tsmGlobal.m { + // The target is uniquely identified by a pointer to its original labels. + if getLabelsID(sw.Config.OriginalLabels) == targetID { + return sw.Config.MetricRelabelConfigs, sw.Config.Labels, true + } + } + return nil, nil, false +} + +func getTargetRelabelContextByTargetID(targetID string) (*promrelabel.ParsedConfigs, *promutils.Labels, bool) { var relabelConfigs *promrelabel.ParsedConfigs var labels *promutils.Labels found := false diff --git a/lib/promscrape/targetstatus.qtpl b/lib/promscrape/targetstatus.qtpl index 79fe081e3..226245513 100644 --- a/lib/promscrape/targetstatus.qtpl +++ b/lib/promscrape/targetstatus.qtpl @@ -250,7 +250,8 @@ - debug + target{% space %} + metrics {%d ts.scrapesTotal %} {%d ts.scrapesFailed %} diff --git a/lib/promscrape/targetstatus.qtpl.go b/lib/promscrape/targetstatus.qtpl.go index 909b52093..977d79271 100644 --- a/lib/promscrape/targetstatus.qtpl.go +++ b/lib/promscrape/targetstatus.qtpl.go @@ -632,286 +632,294 @@ func streamscrapeJobTargets(qw422016 *qt422016.Writer, num int, jts *jobTargetsS //line lib/promscrape/targetstatus.qtpl:253 qw422016.E().S(targetID) //line lib/promscrape/targetstatus.qtpl:253 - qw422016.N().S(`" target="_blank">debug`) -//line lib/promscrape/targetstatus.qtpl:255 + qw422016.N().S(`" target="_blank">target`) +//line lib/promscrape/targetstatus.qtpl:253 + qw422016.N().S(` `) +//line lib/promscrape/targetstatus.qtpl:253 + qw422016.N().S(`metrics`) +//line lib/promscrape/targetstatus.qtpl:256 qw422016.N().D(ts.scrapesTotal) -//line lib/promscrape/targetstatus.qtpl:255 - qw422016.N().S(``) //line lib/promscrape/targetstatus.qtpl:256 + qw422016.N().S(``) +//line lib/promscrape/targetstatus.qtpl:257 qw422016.N().D(ts.scrapesFailed) -//line lib/promscrape/targetstatus.qtpl:256 +//line lib/promscrape/targetstatus.qtpl:257 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:258 +//line lib/promscrape/targetstatus.qtpl:259 if lastScrapeDuration < 365*24*time.Hour { -//line lib/promscrape/targetstatus.qtpl:259 +//line lib/promscrape/targetstatus.qtpl:260 qw422016.N().D(int(lastScrapeDuration.Milliseconds())) -//line lib/promscrape/targetstatus.qtpl:259 +//line lib/promscrape/targetstatus.qtpl:260 qw422016.N().S(`ms ago`) -//line lib/promscrape/targetstatus.qtpl:260 +//line lib/promscrape/targetstatus.qtpl:261 } else { -//line lib/promscrape/targetstatus.qtpl:260 +//line lib/promscrape/targetstatus.qtpl:261 qw422016.N().S(`none`) -//line lib/promscrape/targetstatus.qtpl:262 +//line lib/promscrape/targetstatus.qtpl:263 } -//line lib/promscrape/targetstatus.qtpl:262 +//line lib/promscrape/targetstatus.qtpl:263 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:263 +//line lib/promscrape/targetstatus.qtpl:264 qw422016.N().D(int(ts.scrapeDuration)) -//line lib/promscrape/targetstatus.qtpl:263 +//line lib/promscrape/targetstatus.qtpl:264 qw422016.N().S(`ms`) -//line lib/promscrape/targetstatus.qtpl:264 +//line lib/promscrape/targetstatus.qtpl:265 qw422016.N().D(ts.samplesScraped) -//line lib/promscrape/targetstatus.qtpl:264 +//line lib/promscrape/targetstatus.qtpl:265 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:265 +//line lib/promscrape/targetstatus.qtpl:266 if ts.err != nil { -//line lib/promscrape/targetstatus.qtpl:265 +//line lib/promscrape/targetstatus.qtpl:266 qw422016.E().S(ts.err.Error()) -//line lib/promscrape/targetstatus.qtpl:265 +//line lib/promscrape/targetstatus.qtpl:266 } -//line lib/promscrape/targetstatus.qtpl:265 +//line lib/promscrape/targetstatus.qtpl:266 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:267 +//line lib/promscrape/targetstatus.qtpl:268 } -//line lib/promscrape/targetstatus.qtpl:267 +//line lib/promscrape/targetstatus.qtpl:268 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 } -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 func writescrapeJobTargets(qq422016 qtio422016.Writer, num int, jts *jobTargetsStatuses) { -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 streamscrapeJobTargets(qw422016, num, jts) -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 qt422016.ReleaseWriter(qw422016) -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 } -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 func scrapeJobTargets(num int, jts *jobTargetsStatuses) string { -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 writescrapeJobTargets(qb422016, num, jts) -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 qs422016 := string(qb422016.B) -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 return qs422016 -//line lib/promscrape/targetstatus.qtpl:273 +//line lib/promscrape/targetstatus.qtpl:274 } -//line lib/promscrape/targetstatus.qtpl:275 -func streamdiscoveredTargets(qw422016 *qt422016.Writer, tsr *targetsStatusResult) { //line lib/promscrape/targetstatus.qtpl:276 +func streamdiscoveredTargets(qw422016 *qt422016.Writer, tsr *targetsStatusResult) { +//line lib/promscrape/targetstatus.qtpl:277 tljs := tsr.getTargetLabelsByJob() -//line lib/promscrape/targetstatus.qtpl:276 +//line lib/promscrape/targetstatus.qtpl:277 qw422016.N().S(`
`) -//line lib/promscrape/targetstatus.qtpl:279 - for i, tlj := range tljs { //line lib/promscrape/targetstatus.qtpl:280 + for i, tlj := range tljs { +//line lib/promscrape/targetstatus.qtpl:281 streamdiscoveredJobTargets(qw422016, i, tlj) -//line lib/promscrape/targetstatus.qtpl:281 +//line lib/promscrape/targetstatus.qtpl:282 } -//line lib/promscrape/targetstatus.qtpl:281 +//line lib/promscrape/targetstatus.qtpl:282 qw422016.N().S(`
`) -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 } -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 func writediscoveredTargets(qq422016 qtio422016.Writer, tsr *targetsStatusResult) { -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 streamdiscoveredTargets(qw422016, tsr) -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 qt422016.ReleaseWriter(qw422016) -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 } -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 func discoveredTargets(tsr *targetsStatusResult) string { -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 writediscoveredTargets(qb422016, tsr) -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 qs422016 := string(qb422016.B) -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 return qs422016 -//line lib/promscrape/targetstatus.qtpl:284 +//line lib/promscrape/targetstatus.qtpl:285 } -//line lib/promscrape/targetstatus.qtpl:286 +//line lib/promscrape/targetstatus.qtpl:287 func streamdiscoveredJobTargets(qw422016 *qt422016.Writer, num int, tlj *targetLabelsByJob) { -//line lib/promscrape/targetstatus.qtpl:286 +//line lib/promscrape/targetstatus.qtpl:287 qw422016.N().S(`

`) -//line lib/promscrape/targetstatus.qtpl:288 +//line lib/promscrape/targetstatus.qtpl:289 qw422016.E().S(tlj.jobName) -//line lib/promscrape/targetstatus.qtpl:288 +//line lib/promscrape/targetstatus.qtpl:289 qw422016.N().S(` `) -//line lib/promscrape/targetstatus.qtpl:288 +//line lib/promscrape/targetstatus.qtpl:289 qw422016.N().S(`(`) -//line lib/promscrape/targetstatus.qtpl:288 +//line lib/promscrape/targetstatus.qtpl:289 qw422016.N().D(tlj.activeTargets) -//line lib/promscrape/targetstatus.qtpl:288 +//line lib/promscrape/targetstatus.qtpl:289 qw422016.N().S(`/`) -//line lib/promscrape/targetstatus.qtpl:288 +//line lib/promscrape/targetstatus.qtpl:289 qw422016.N().D(tlj.activeTargets + tlj.droppedTargets) -//line lib/promscrape/targetstatus.qtpl:288 +//line lib/promscrape/targetstatus.qtpl:289 qw422016.N().S(` `) -//line lib/promscrape/targetstatus.qtpl:288 +//line lib/promscrape/targetstatus.qtpl:289 qw422016.N().S(`active)`) -//line lib/promscrape/targetstatus.qtpl:289 +//line lib/promscrape/targetstatus.qtpl:290 streamshowHideScrapeJobButtons(qw422016, num) -//line lib/promscrape/targetstatus.qtpl:289 +//line lib/promscrape/targetstatus.qtpl:290 qw422016.N().S(`

`) -//line lib/promscrape/targetstatus.qtpl:302 +//line lib/promscrape/targetstatus.qtpl:303 for _, t := range tlj.targets { -//line lib/promscrape/targetstatus.qtpl:302 +//line lib/promscrape/targetstatus.qtpl:303 qw422016.N().S(` 0 { -//line lib/promscrape/targetstatus.qtpl:306 +//line lib/promscrape/targetstatus.qtpl:307 qw422016.N().S(`class="alert alert-danger"`) -//line lib/promscrape/targetstatus.qtpl:308 +//line lib/promscrape/targetstatus.qtpl:309 } else { -//line lib/promscrape/targetstatus.qtpl:308 +//line lib/promscrape/targetstatus.qtpl:309 qw422016.N().S(`class="alert alert-warning"`) -//line lib/promscrape/targetstatus.qtpl:310 +//line lib/promscrape/targetstatus.qtpl:311 } -//line lib/promscrape/targetstatus.qtpl:311 +//line lib/promscrape/targetstatus.qtpl:312 } -//line lib/promscrape/targetstatus.qtpl:311 +//line lib/promscrape/targetstatus.qtpl:312 qw422016.N().S(`>`) -//line lib/promscrape/targetstatus.qtpl:333 +//line lib/promscrape/targetstatus.qtpl:334 } -//line lib/promscrape/targetstatus.qtpl:333 +//line lib/promscrape/targetstatus.qtpl:334 qw422016.N().S(`
StatusDiscovered LabelsTarget LabelsDebug relabeling
`) -//line lib/promscrape/targetstatus.qtpl:314 +//line lib/promscrape/targetstatus.qtpl:315 if t.up { -//line lib/promscrape/targetstatus.qtpl:314 +//line lib/promscrape/targetstatus.qtpl:315 qw422016.N().S(`UP`) -//line lib/promscrape/targetstatus.qtpl:316 +//line lib/promscrape/targetstatus.qtpl:317 } else if t.labels.Len() > 0 { -//line lib/promscrape/targetstatus.qtpl:316 +//line lib/promscrape/targetstatus.qtpl:317 qw422016.N().S(`DOWN`) -//line lib/promscrape/targetstatus.qtpl:318 +//line lib/promscrape/targetstatus.qtpl:319 } else { -//line lib/promscrape/targetstatus.qtpl:318 +//line lib/promscrape/targetstatus.qtpl:319 qw422016.N().S(`DROPPED`) -//line lib/promscrape/targetstatus.qtpl:320 +//line lib/promscrape/targetstatus.qtpl:321 } -//line lib/promscrape/targetstatus.qtpl:320 +//line lib/promscrape/targetstatus.qtpl:321 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:323 +//line lib/promscrape/targetstatus.qtpl:324 streamformatLabels(qw422016, t.originalLabels) -//line lib/promscrape/targetstatus.qtpl:323 +//line lib/promscrape/targetstatus.qtpl:324 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:326 +//line lib/promscrape/targetstatus.qtpl:327 streamformatLabels(qw422016, t.labels) -//line lib/promscrape/targetstatus.qtpl:326 +//line lib/promscrape/targetstatus.qtpl:327 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:329 +//line lib/promscrape/targetstatus.qtpl:330 targetID := getLabelsID(t.originalLabels) -//line lib/promscrape/targetstatus.qtpl:329 +//line lib/promscrape/targetstatus.qtpl:330 qw422016.N().S(`debug
`) -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 } -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 func writediscoveredJobTargets(qq422016 qtio422016.Writer, num int, tlj *targetLabelsByJob) { -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 streamdiscoveredJobTargets(qw422016, num, tlj) -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 qt422016.ReleaseWriter(qw422016) -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 } -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 func discoveredJobTargets(num int, tlj *targetLabelsByJob) string { -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 writediscoveredJobTargets(qb422016, num, tlj) -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 qs422016 := string(qb422016.B) -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 return qs422016 -//line lib/promscrape/targetstatus.qtpl:337 +//line lib/promscrape/targetstatus.qtpl:338 } -//line lib/promscrape/targetstatus.qtpl:339 +//line lib/promscrape/targetstatus.qtpl:340 func streamshowHideScrapeJobButtons(qw422016 *qt422016.Writer, num int) { -//line lib/promscrape/targetstatus.qtpl:339 +//line lib/promscrape/targetstatus.qtpl:340 qw422016.N().S(``) -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 } -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 func writeshowHideScrapeJobButtons(qq422016 qtio422016.Writer, num int) { -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 streamshowHideScrapeJobButtons(qw422016, num) -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 qt422016.ReleaseWriter(qw422016) -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 } -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 func showHideScrapeJobButtons(num int) string { -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 writeshowHideScrapeJobButtons(qb422016, num) -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 qs422016 := string(qb422016.B) -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 return qs422016 -//line lib/promscrape/targetstatus.qtpl:348 +//line lib/promscrape/targetstatus.qtpl:349 } -//line lib/promscrape/targetstatus.qtpl:350 +//line lib/promscrape/targetstatus.qtpl:351 func streamqueryArgs(qw422016 *qt422016.Writer, filter *requestFilter, override map[string]string) { -//line lib/promscrape/targetstatus.qtpl:352 +//line lib/promscrape/targetstatus.qtpl:353 showOnlyUnhealthy := "false" if filter.showOnlyUnhealthy { showOnlyUnhealthy = "true" @@ -929,89 +937,89 @@ func streamqueryArgs(qw422016 *qt422016.Writer, filter *requestFilter, override qa[k] = []string{v} } -//line lib/promscrape/targetstatus.qtpl:369 +//line lib/promscrape/targetstatus.qtpl:370 qw422016.E().S(qa.Encode()) -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 } -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 func writequeryArgs(qq422016 qtio422016.Writer, filter *requestFilter, override map[string]string) { -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 streamqueryArgs(qw422016, filter, override) -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 qt422016.ReleaseWriter(qw422016) -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 } -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 func queryArgs(filter *requestFilter, override map[string]string) string { -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 writequeryArgs(qb422016, filter, override) -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 qs422016 := string(qb422016.B) -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 return qs422016 -//line lib/promscrape/targetstatus.qtpl:370 +//line lib/promscrape/targetstatus.qtpl:371 } -//line lib/promscrape/targetstatus.qtpl:372 -func streamformatLabels(qw422016 *qt422016.Writer, labels *promutils.Labels) { //line lib/promscrape/targetstatus.qtpl:373 +func streamformatLabels(qw422016 *qt422016.Writer, labels *promutils.Labels) { +//line lib/promscrape/targetstatus.qtpl:374 labelsList := labels.GetLabels() -//line lib/promscrape/targetstatus.qtpl:373 +//line lib/promscrape/targetstatus.qtpl:374 qw422016.N().S(`{`) -//line lib/promscrape/targetstatus.qtpl:375 +//line lib/promscrape/targetstatus.qtpl:376 for i, label := range labelsList { -//line lib/promscrape/targetstatus.qtpl:376 +//line lib/promscrape/targetstatus.qtpl:377 qw422016.E().S(label.Name) -//line lib/promscrape/targetstatus.qtpl:376 +//line lib/promscrape/targetstatus.qtpl:377 qw422016.N().S(`=`) -//line lib/promscrape/targetstatus.qtpl:376 +//line lib/promscrape/targetstatus.qtpl:377 qw422016.E().Q(label.Value) -//line lib/promscrape/targetstatus.qtpl:377 +//line lib/promscrape/targetstatus.qtpl:378 if i+1 < len(labelsList) { -//line lib/promscrape/targetstatus.qtpl:377 +//line lib/promscrape/targetstatus.qtpl:378 qw422016.N().S(`,`) -//line lib/promscrape/targetstatus.qtpl:377 +//line lib/promscrape/targetstatus.qtpl:378 qw422016.N().S(` `) -//line lib/promscrape/targetstatus.qtpl:377 +//line lib/promscrape/targetstatus.qtpl:378 } -//line lib/promscrape/targetstatus.qtpl:378 +//line lib/promscrape/targetstatus.qtpl:379 } -//line lib/promscrape/targetstatus.qtpl:378 +//line lib/promscrape/targetstatus.qtpl:379 qw422016.N().S(`}`) -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 } -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 func writeformatLabels(qq422016 qtio422016.Writer, labels *promutils.Labels) { -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 qw422016 := qt422016.AcquireWriter(qq422016) -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 streamformatLabels(qw422016, labels) -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 qt422016.ReleaseWriter(qw422016) -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 } -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 func formatLabels(labels *promutils.Labels) string { -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 qb422016 := qt422016.AcquireByteBuffer() -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 writeformatLabels(qb422016, labels) -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 qs422016 := string(qb422016.B) -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 qt422016.ReleaseByteBuffer(qb422016) -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 return qs422016 -//line lib/promscrape/targetstatus.qtpl:380 +//line lib/promscrape/targetstatus.qtpl:381 }