criteo / graphite-remote-adapter

Fully featured graphite remote adapter for Prometheus
Apache License 2.0
38 stars 25 forks source link

Fix: EnableTags=true and FilteredTags="" produces dot separated result #79

Open lexx-bright opened 4 years ago

lexx-bright commented 4 years ago

Do not split empty string. Otherwise the result is a slice with one element - the empty string. The rest array length checks will consider we have tags to filter.

msaf1980 commented 4 years ago

May be also add (for replace spaces if tags passed like "tag1, tag2" instead of "tag1,tag2" ?

diff --git a/cmd/graphite-remote-adapter/main.go b/cmd/graphite-remote-adapter/main.go
index b614f50..f84d484 100644
--- a/cmd/graphite-remote-adapter/main.go
+++ b/cmd/graphite-remote-adapter/main.go
@@ -18,6 +18,7 @@ import (
        _ "net/http/pprof"
        "os"
        "os/signal"
+       "strings"
        "syscall"

        "github.com/go-kit/kit/log"
@@ -59,6 +60,7 @@ func reload(cliCfg *config.Config, logger log.Logger) (*config.Config, error) {
                cfg.Write.Timeout = cliCfg.Write.Timeout
        }

+       cfg.Graphite.FilteredTags = strings.ReplaceAll(cfg.Graphite.FilteredTags, " ", "")
        return cfg, nil
 }