graphite-remote-adapter icon indicating copy to clipboard operation
graphite-remote-adapter copied to clipboard

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

Open lexx-bright opened this issue 4 years ago • 1 comments

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.

lexx-bright avatar Aug 03 '20 09:08 lexx-bright

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
 }

msaf1980 avatar Sep 03 '20 06:09 msaf1980