| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | package forward
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import (
 | 
					
						
							|  |  |  | 	"github.com/coredns/coredns/plugin"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/prometheus/client_golang/prometheus"
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	"github.com/prometheus/client_golang/prometheus/promauto"
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Variables declared for monitoring.
 | 
					
						
							|  |  |  | var (
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	RequestCount = promauto.NewCounterVec(prometheus.CounterOpts{
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "forward",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 		Name:      "requests_total",
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 		Help:      "Counter of requests made per upstream.",
 | 
					
						
							|  |  |  | 	}, []string{"to"})
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	RcodeCount = promauto.NewCounterVec(prometheus.CounterOpts{
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "forward",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 		Name:      "responses_total",
 | 
					
						
							| 
									
										
										
										
											2020-06-24 10:49:42 -04:00
										 |  |  | 		Help:      "Counter of responses received per upstream.",
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 	}, []string{"rcode", "to"})
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	RequestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "forward",
 | 
					
						
							|  |  |  | 		Name:      "request_duration_seconds",
 | 
					
						
							|  |  |  | 		Buckets:   plugin.TimeBuckets,
 | 
					
						
							|  |  |  | 		Help:      "Histogram of the time each request took.",
 | 
					
						
							| 
									
										
										
										
											2021-03-19 12:59:26 +01:00
										 |  |  | 	}, []string{"to", "rcode"})
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	HealthcheckFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "forward",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 		Name:      "healthcheck_failures_total",
 | 
					
						
							| 
									
										
										
										
											2019-08-09 00:27:53 +08:00
										 |  |  | 		Help:      "Counter of the number of failed healthchecks.",
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 	}, []string{"to"})
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	HealthcheckBrokenCount = promauto.NewCounter(prometheus.CounterOpts{
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "forward",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 		Name:      "healthcheck_broken_total",
 | 
					
						
							| 
									
										
										
										
											2019-08-09 00:27:53 +08:00
										 |  |  | 		Help:      "Counter of the number of complete failures of the healthchecks.",
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 	})
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	SocketGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "forward",
 | 
					
						
							| 
									
										
										
										
											2018-06-20 12:35:57 +02:00
										 |  |  | 		Name:      "sockets_open",
 | 
					
						
							| 
									
										
										
										
											2018-02-23 15:02:05 +00:00
										 |  |  | 		Help:      "Gauge of open sockets per upstream.",
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | 	}, []string{"to"})
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	MaxConcurrentRejectCount = promauto.NewCounter(prometheus.CounterOpts{
 | 
					
						
							| 
									
										
										
										
											2020-02-04 07:59:08 -05:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "forward",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 		Name:      "max_concurrent_rejects_total",
 | 
					
						
							| 
									
										
										
										
											2020-02-04 07:59:08 -05:00
										 |  |  | 		Help:      "Counter of the number of queries rejected because the concurrent queries were at maximum.",
 | 
					
						
							|  |  |  | 	})
 | 
					
						
							| 
									
										
										
										
											2020-09-14 12:42:55 +03:00
										 |  |  | 	ConnCacheHitsCount = promauto.NewCounterVec(prometheus.CounterOpts{
 | 
					
						
							|  |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "forward",
 | 
					
						
							|  |  |  | 		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: "forward",
 | 
					
						
							|  |  |  | 		Name:      "conn_cache_misses_total",
 | 
					
						
							|  |  |  | 		Help:      "Counter of connection cache misses per upstream and protocol.",
 | 
					
						
							|  |  |  | 	}, []string{"to", "proto"})
 | 
					
						
							| 
									
										
										
										
											2018-02-05 22:00:47 +00:00
										 |  |  | )
 |