mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-04 03:03:14 -05:00 
			
		
		
		
	
		
			
	
	
		
			50 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			50 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package proxy
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
									"github.com/coredns/coredns/plugin"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									"github.com/prometheus/client_golang/prometheus"
							 | 
						||
| 
								 | 
							
									"github.com/prometheus/client_golang/prometheus/promauto"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Variables declared for monitoring.
							 | 
						||
| 
								 | 
							
								var (
							 | 
						||
| 
								 | 
							
									RequestCount = promauto.NewCounterVec(prometheus.CounterOpts{
							 | 
						||
| 
								 | 
							
										Namespace: plugin.Namespace,
							 | 
						||
| 
								 | 
							
										Subsystem: "proxy",
							 | 
						||
| 
								 | 
							
										Name:      "requests_total",
							 | 
						||
| 
								 | 
							
										Help:      "Counter of requests made per upstream.",
							 | 
						||
| 
								 | 
							
									}, []string{"to"})
							 | 
						||
| 
								 | 
							
									RcodeCount = promauto.NewCounterVec(prometheus.CounterOpts{
							 | 
						||
| 
								 | 
							
										Namespace: plugin.Namespace,
							 | 
						||
| 
								 | 
							
										Subsystem: "proxy",
							 | 
						||
| 
								 | 
							
										Name:      "responses_total",
							 | 
						||
| 
								 | 
							
										Help:      "Counter of responses received per upstream.",
							 | 
						||
| 
								 | 
							
									}, []string{"rcode", "to"})
							 | 
						||
| 
								 | 
							
									RequestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
							 | 
						||
| 
								 | 
							
										Namespace: plugin.Namespace,
							 | 
						||
| 
								 | 
							
										Subsystem: "proxy",
							 | 
						||
| 
								 | 
							
										Name:      "request_duration_seconds",
							 | 
						||
| 
								 | 
							
										Buckets:   plugin.TimeBuckets,
							 | 
						||
| 
								 | 
							
										Help:      "Histogram of the time each request took.",
							 | 
						||
| 
								 | 
							
									}, []string{"to", "rcode"})
							 | 
						||
| 
								 | 
							
									HealthcheckFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
							 | 
						||
| 
								 | 
							
										Namespace: plugin.Namespace,
							 | 
						||
| 
								 | 
							
										Subsystem: "proxy",
							 | 
						||
| 
								 | 
							
										Name:      "healthcheck_failures_total",
							 | 
						||
| 
								 | 
							
										Help:      "Counter of the number of failed healthchecks.",
							 | 
						||
| 
								 | 
							
									}, []string{"to"})
							 | 
						||
| 
								 | 
							
									ConnCacheHitsCount = promauto.NewCounterVec(prometheus.CounterOpts{
							 | 
						||
| 
								 | 
							
										Namespace: plugin.Namespace,
							 | 
						||
| 
								 | 
							
										Subsystem: "proxy",
							 | 
						||
| 
								 | 
							
										Name:      "conn_cache_hits_total",
							 | 
						||
| 
								 | 
							
										Help:      "Counter of connection cache hits per upstream and protocol.",
							 | 
						||
| 
								 | 
							
									}, []string{"to", "proto"})
							 | 
						||
| 
								 | 
							
									ConnCacheMissesCount = promauto.NewCounterVec(prometheus.CounterOpts{
							 | 
						||
| 
								 | 
							
										Namespace: plugin.Namespace,
							 | 
						||
| 
								 | 
							
										Subsystem: "proxy",
							 | 
						||
| 
								 | 
							
										Name:      "conn_cache_misses_total",
							 | 
						||
| 
								 | 
							
										Help:      "Counter of connection cache misses per upstream and protocol.",
							 | 
						||
| 
								 | 
							
									}, []string{"to", "proto"})
							 | 
						||
| 
								 | 
							
								)
							 |