aboutsummaryrefslogtreecommitdiff
path: root/plugin/proxy/metrics.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-12-27 15:48:14 +0000
committerGravatar GitHub <noreply@github.com> 2017-12-27 15:48:14 +0000
commit90dd4bbd4570560a4b72ca8525c99dc8fc1db163 (patch)
treeab7029569d9e281a28c6ab203a556176f6586eea /plugin/proxy/metrics.go
parent5ac42ed5c29609ce710c2d9a8e145919f4124c00 (diff)
downloadcoredns-90dd4bbd4570560a4b72ca8525c99dc8fc1db163.tar.gz
coredns-90dd4bbd4570560a4b72ca8525c99dc8fc1db163.tar.zst
coredns-90dd4bbd4570560a4b72ca8525c99dc8fc1db163.zip
metrics: correctly register all metrics (#1335)
After initial startup, see if prometheus is loaded and if so, register our metrics with it. Stop doing the init() func and just use the sync.Once so we don't double registrer our metrics.
Diffstat (limited to 'plugin/proxy/metrics.go')
-rw-r--r--plugin/proxy/metrics.go11
1 files changed, 1 insertions, 10 deletions
diff --git a/plugin/proxy/metrics.go b/plugin/proxy/metrics.go
index 96be50893..e0dd3fe98 100644
--- a/plugin/proxy/metrics.go
+++ b/plugin/proxy/metrics.go
@@ -25,15 +25,6 @@ var (
}, []string{"proto", "proxy_proto", "family", "to"})
)
-// OnStartupMetrics sets up the metrics on startup. This is done for all proxy protocols.
-func OnStartupMetrics() error {
- metricsOnce.Do(func() {
- prometheus.MustRegister(RequestCount)
- prometheus.MustRegister(RequestDuration)
- })
- return nil
-}
-
// familyToString returns the string form of either 1, or 2. Returns
// empty string is not a known family
func familyToString(f int) string {
@@ -46,4 +37,4 @@ func familyToString(f int) string {
return ""
}
-var metricsOnce sync.Once
+var once sync.Once