Skip to content

Commit

Permalink
fix(sd): default namespace is graphite
Browse files Browse the repository at this point in the history
  • Loading branch information
msaf1980 committed Nov 2, 2023
1 parent c47e8c8 commit 44c29e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions sd/nginx/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ type Nginx struct {
}

func New(url, namespace, hostname string, logger *zap.Logger) *Nginx {
if namespace == "" {
namespace = "graphite"
}
sd := &Nginx{
logger: logger,
body: make([]byte, 128),
Expand Down
4 changes: 2 additions & 2 deletions sd/nginx/nginx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestNginx(t *testing.T) {
logger := zapwriter.Default()

sd1 := New("http://127.0.0.1:8500/v1/kv/upstreams", "graphite", hostname1, logger)
sd2 := New("http://127.0.0.1:8500/v1/kv/upstreams", "graphite", hostname2, logger)
sd2 := New("http://127.0.0.1:8500/v1/kv/upstreams", "", hostname2, logger)

err := sd1.Clear("", "")
require.True(t, err == nil || err == utils.ErrNotFound, err)
Expand Down Expand Up @@ -170,7 +170,7 @@ func TestNginxDC(t *testing.T) {

logger := zapwriter.Default()

sd1 := New("http://127.0.0.1:8500/v1/kv/upstreams", "graphite", hostname1, logger)
sd1 := New("http://127.0.0.1:8500/v1/kv/upstreams", "", hostname1, logger)
sd2 := New("http://127.0.0.1:8500/v1/kv/upstreams", "graphite", hostname2, logger)

err := sd1.Clear("", "")
Expand Down

0 comments on commit 44c29e6

Please sign in to comment.