mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +01:00
lib/promscrape: stop dropping metric name if relabeling rules do not instruct to do this on the /metric-relabel-debug page
This commit is contained in:
parent
9b82eebc3e
commit
2e597555ec
@ -16,6 +16,7 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
||||
## tip
|
||||
|
||||
* BUGFIX: allow specifying values bigger than 2GiB to the following command-line flag values on 32-bit architectures (`386` and `arm`): `-storage.minFreeDiskSpaceBytes` and `-remoteWrite.maxDiskUsagePerURL`. Previously values bigger than 2GiB were incorrectly truncated on these architectures.
|
||||
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): stop dropping metric name by a mistake on the [/metric-relabel-debug](https://docs.victoriametrics.com/vmagent.html#relabel-debug) page.
|
||||
|
||||
|
||||
## [v1.85.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.85.1)
|
||||
|
@ -90,8 +90,9 @@ func newDebugRelabelSteps(pcs *promrelabel.ParsedConfigs, labels *promutils.Labe
|
||||
labels.Labels = labelsResult
|
||||
outStr := promrelabel.LabelsToString(labels.GetLabels())
|
||||
|
||||
if isTargetRelabel {
|
||||
// Add missing instance label
|
||||
if isTargetRelabel && labels.Get("instance") == "" {
|
||||
if labels.Get("instance") == "" {
|
||||
address := labels.Get("__address__")
|
||||
if address != "" {
|
||||
inStr := outStr
|
||||
@ -116,6 +117,19 @@ func newDebugRelabelSteps(pcs *promrelabel.ParsedConfigs, labels *promutils.Labe
|
||||
Out: outStr,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// Remove labels with __ prefix except of __name__
|
||||
inStr := outStr
|
||||
labels.Labels = promrelabel.FinalizeLabels(labels.Labels[:0], labels.Labels)
|
||||
outStr = promrelabel.LabelsToString(labels.GetLabels())
|
||||
if inStr != outStr {
|
||||
dss = append(dss, promrelabel.DebugStep{
|
||||
Rule: "remove labels with __ prefix except of __name__",
|
||||
In: inStr,
|
||||
Out: outStr,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// There is no need in labels' sorting, since promrelabel.LabelsToString() automatically sorts labels.
|
||||
return dss
|
||||
|
Loading…
Reference in New Issue
Block a user