aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/metrics/metrics.go5
-rw-r--r--plugin/metrics/setup.go5
-rw-r--r--test/reload_test.go9
3 files changed, 7 insertions, 12 deletions
diff --git a/plugin/metrics/metrics.go b/plugin/metrics/metrics.go
index 384aa8bb4..b989ccc2f 100644
--- a/plugin/metrics/metrics.go
+++ b/plugin/metrics/metrics.go
@@ -5,10 +5,8 @@ import (
"net"
"net/http"
"os"
- "runtime"
"sync"
- "github.com/coredns/coredns/coremain"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/metrics/vars"
"github.com/coredns/coredns/plugin/pkg/log"
@@ -52,9 +50,6 @@ func New(addr string) *Metrics {
met.MustRegister(vars.ResponseSize)
met.MustRegister(vars.ResponseRcode)
- // Initialize metrics.
- buildInfo.WithLabelValues(coremain.CoreVersion, coremain.GitCommit, runtime.Version()).Set(1)
-
return met
}
diff --git a/plugin/metrics/setup.go b/plugin/metrics/setup.go
index 5b605f554..2aff8ec5c 100644
--- a/plugin/metrics/setup.go
+++ b/plugin/metrics/setup.go
@@ -2,8 +2,10 @@ package metrics
import (
"net"
+ "runtime"
"github.com/coredns/coredns/core/dnsserver"
+ "github.com/coredns/coredns/coremain"
"github.com/coredns/coredns/plugin"
"github.com/mholt/caddy"
@@ -39,6 +41,9 @@ func setup(c *caddy.Controller) error {
c.OnRestart(m.OnRestart)
c.OnFinalShutdown(m.OnFinalShutdown)
+ // Initialize metrics.
+ buildInfo.WithLabelValues(coremain.CoreVersion, coremain.GitCommit, runtime.Version()).Set(1)
+
return nil
}
diff --git a/test/reload_test.go b/test/reload_test.go
index e49628614..44dcbe591 100644
--- a/test/reload_test.go
+++ b/test/reload_test.go
@@ -5,6 +5,7 @@ import (
"io/ioutil"
"net/http"
"testing"
+ "time"
"github.com/miekg/dns"
)
@@ -93,13 +94,7 @@ func TestReloadMetricsHealth(t *testing.T) {
}
defer c1.Stop()
- // Send query to trigger monitoring to export on the new process
- udp, _ := CoreDNSServerPorts(c1, 0)
- m := new(dns.Msg)
- m.SetQuestion("example.org.", dns.TypeA)
- if _, err := dns.Exchange(m, udp); err != nil {
- t.Fatal(err)
- }
+ time.Sleep(1 * time.Second)
// Health
resp, err := http.Get("http://localhost:53184/health")