diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 47307af5e7..4da46a4f50 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -10,6 +10,7 @@ * FEATURE: vmauth: add ability to route requests from a single user to multiple destinations depending on the requested paths. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1064 * FEATURE: remove dependency on external programs such as `cat`, `grep` and `cut` when detecting cpu and memory limits inside Docker or LXC container. +* BUGFIX: properly convert regexp tag filters containing escaped dots to non-regexp tag filters. For example, `{foo=~"bar\.baz"}` should be converted to `{foo="bar.baz"}`. Previously it was incorrectly converted to `{foo="bar\.baz"}`, which could result in missing time series for this tag filter. * BUGFIX: do not spam error logs when discovering Docker Swarm targets without dedicated IP. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1028 . * BUGFIX: properly embed timezone data into VictoriaMetrics apps. This should fix `-loggerTimezone` usage inside Docker containers. * BUGFIX: properly build Docker images for non-amd64 architectures (arm, arm64, ppc64le, 386) on [Docker hub](https://hub.docker.com/u/victoriametrics/). Previously these images were incorrectly based on amd64 base image, so they didn't work. diff --git a/lib/storage/tag_filters.go b/lib/storage/tag_filters.go index 8118cdb99b..418000c73e 100644 --- a/lib/storage/tag_filters.go +++ b/lib/storage/tag_filters.go @@ -49,7 +49,7 @@ func convertToCompositeTagFilters(tfs *TagFilters) *TagFilters { } continue } - if string(tf.key) == "__graphite__" { + if string(tf.key) == "__graphite__" || bytes.Equal(tf.key, graphiteReverseTagKey) { tfsNew = append(tfsNew, tf) continue } @@ -385,6 +385,7 @@ func (tf *tagFilter) Init(commonPrefix, key, value []byte, isNegative, isRegexp if tf.isRegexp { prefix, expr = getRegexpPrefix(tf.value) if len(expr) == 0 { + tf.value = append(tf.value[:0], prefix...) tf.isRegexp = false } } diff --git a/lib/storage/tag_filters_test.go b/lib/storage/tag_filters_test.go index 59cc7776ee..80b3f4eeeb 100644 --- a/lib/storage/tag_filters_test.go +++ b/lib/storage/tag_filters_test.go @@ -985,8 +985,9 @@ func TestTagFiltersString(t *testing.T) { mustAdd("tag_re", "re.value", false, true) mustAdd("tag_nre", "nre.value", true, true) mustAdd("tag_n", "n_value", true, false) + mustAdd("tag_re_graphite", "foo\\.bar", false, true) s := tfs.String() - sExpected := `AccountID=12, ProjectID=34 {__name__="metric_name", tag_re=~"re.value", tag_nre!~"nre.value", tag_n!="n_value"}` + sExpected := `AccountID=12, ProjectID=34 {__name__="metric_name", tag_re=~"re.value", tag_nre!~"nre.value", tag_n!="n_value", tag_re_graphite="foo.bar"}` if s != sExpected { t.Fatalf("unexpected TagFilters.String(); got %q; want %q", s, sExpected) }