Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
a466bb6f
Commit
a466bb6f
authored
Apr 21, 2018
by
Miek Gieben
Committed by
GitHub
Apr 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export metrics in setup; so it also works after reload (#1715)
* brr; a sleep * Shouldnt need a query
parent
acbcad7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
12 deletions
+7
-12
plugin/metrics/metrics.go
plugin/metrics/metrics.go
+0
-5
plugin/metrics/setup.go
plugin/metrics/setup.go
+5
-0
test/reload_test.go
test/reload_test.go
+2
-7
No files found.
plugin/metrics/metrics.go
View file @
a466bb6f
...
...
@@ -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
}
...
...
plugin/metrics/setup.go
View file @
a466bb6f
...
...
@@ -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
}
...
...
test/reload_test.go
View file @
a466bb6f
...
...
@@ -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"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment