mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 16:30:55 +01:00
Revert "lib/promrelabel: show error message if labels not in prometheus exposition format (#4304)"
This reverts commit 193a9c3328
.
Reason for revert: the commit doesn't fix the real issue with promutils.NewLabelsFromString()
function, which must return error when improperly formatted Prometheus metric with labels is passed to it.
See https://github.com/prometheus/docs/blob/main/content/docs/instrumenting/exposition_formats.md#text-format-example
E.g. the promutils.NewLabelsFromString() must return error when the following strings are passed to it:
- `{foo:"bar"}`, since `:` is disallowed in Prometheus text exposition format. The corect value is `{foo="bar"}`
- `{"foo":"bar"}`, since label name shouldn't be quoted. The correct value is `{foo="bar"}`.
The reverted commit introduces another set of bugs, which happily accept the following invalid input:
- `{foo=~"bar"}`
- `{foo!="bar"}`
- `{foo!~"bar"}`
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4284
See also https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4304
This commit is contained in:
parent
4df7573858
commit
b24da0f901
@ -75,7 +75,6 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
|||||||
* BUGFIX: [vmbackup](https://docs.victoriametrics.com/vmbackup.html): fix compatibility with Windows OS. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/70).
|
* BUGFIX: [vmbackup](https://docs.victoriametrics.com/vmbackup.html): fix compatibility with Windows OS. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/70).
|
||||||
* BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl.html): fix performance issue when migrating data from VictoriaMetrics according to [these docs](https://docs.victoriametrics.com/vmctl.html#migrating-data-from-victoriametrics). Add the ability to speed up the data migration via `--vm-native-disable-retries` command-line flag. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4092).
|
* BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl.html): fix performance issue when migrating data from VictoriaMetrics according to [these docs](https://docs.victoriametrics.com/vmctl.html#migrating-data-from-victoriametrics). Add the ability to speed up the data migration via `--vm-native-disable-retries` command-line flag. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4092).
|
||||||
* BUGFIX: [stream aggregation](https://docs.victoriametrics.com/stream-aggregation.html): fix bug with duplicated labels during stream aggregation via single-node VictoriaMetrics. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4277).
|
* BUGFIX: [stream aggregation](https://docs.victoriametrics.com/stream-aggregation.html): fix bug with duplicated labels during stream aggregation via single-node VictoriaMetrics. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4277).
|
||||||
* BUGFIX: [relabeling](https://docs.victoriametrics.com/relabeling.html): properly validate labels input on Metric Relabel Debug page in [VMUI](https://docs.victoriametrics.com/#vmui). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4284).
|
|
||||||
|
|
||||||
## [v1.90.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.90.0)
|
## [v1.90.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.90.0)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmselect/searchutils"
|
|
||||||
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promutils"
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,33 +18,20 @@ func WriteTargetRelabelDebug(w io.Writer, targetID, metric, relabelConfigs, form
|
|||||||
}
|
}
|
||||||
|
|
||||||
func writeRelabelDebug(w io.Writer, isTargetRelabel bool, targetID, metric, relabelConfigs, format string, err error) {
|
func writeRelabelDebug(w io.Writer, isTargetRelabel bool, targetID, metric, relabelConfigs, format string, err error) {
|
||||||
targetURL := ""
|
|
||||||
if metric == "" {
|
if metric == "" {
|
||||||
WriteRelabelDebugSteps(w, targetURL, targetID, format, nil, metric, relabelConfigs, err)
|
metric = "{}"
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
targetURL := ""
|
||||||
if err != nil {
|
if err != nil {
|
||||||
WriteRelabelDebugSteps(w, targetURL, targetID, format, nil, metric, relabelConfigs, err)
|
WriteRelabelDebugSteps(w, targetURL, targetID, format, nil, metric, relabelConfigs, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
selectors, err := searchutils.ParseMetricSelector(metric)
|
labels, err := promutils.NewLabelsFromString(metric)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("cannot parse metric: %s", err)
|
err = fmt.Errorf("cannot parse metric: %s", err)
|
||||||
WriteRelabelDebugSteps(w, targetURL, targetID, format, nil, metric, relabelConfigs, err)
|
WriteRelabelDebugSteps(w, targetURL, targetID, format, nil, metric, relabelConfigs, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var labels promutils.Labels
|
|
||||||
for _, selector := range selectors {
|
|
||||||
key := string(selector.Key)
|
|
||||||
value := string(selector.Value)
|
|
||||||
if key == "" {
|
|
||||||
labels.Add("__name__", value)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
labels.Add(key, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
pcs, err := ParseRelabelConfigsData([]byte(relabelConfigs))
|
pcs, err := ParseRelabelConfigsData([]byte(relabelConfigs))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("cannot parse relabel configs: %s", err)
|
err = fmt.Errorf("cannot parse relabel configs: %s", err)
|
||||||
@ -53,7 +39,7 @@ func writeRelabelDebug(w io.Writer, isTargetRelabel bool, targetID, metric, rela
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dss, targetURL := newDebugRelabelSteps(pcs, &labels, isTargetRelabel)
|
dss, targetURL := newDebugRelabelSteps(pcs, labels, isTargetRelabel)
|
||||||
WriteRelabelDebugSteps(w, targetURL, targetID, format, dss, metric, relabelConfigs, nil)
|
WriteRelabelDebugSteps(w, targetURL, targetID, format, dss, metric, relabelConfigs, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user