mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	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.
		
			
				
	
	
		
			22 lines
		
	
	
		
			409 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			409 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package autopath
 | |
| 
 | |
| import (
 | |
| 	"sync"
 | |
| 
 | |
| 	"github.com/coredns/coredns/plugin"
 | |
| 
 | |
| 	"github.com/prometheus/client_golang/prometheus"
 | |
| )
 | |
| 
 | |
| // Metrics for autopath.
 | |
| var (
 | |
| 	AutoPathCount = prometheus.NewCounterVec(prometheus.CounterOpts{
 | |
| 		Namespace: plugin.Namespace,
 | |
| 		Subsystem: "autopath",
 | |
| 		Name:      "success_count_total",
 | |
| 		Help:      "Counter of requests that did autopath.",
 | |
| 	}, []string{})
 | |
| )
 | |
| 
 | |
| var once sync.Once
 |