2023-03-24 12:55:51 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								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 (
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-04 15:35:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									requestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 12:55:51 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Namespace: plugin.Namespace,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Subsystem: "proxy",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Name:      "request_duration_seconds",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Buckets:   plugin.TimeBuckets,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Help:      "Histogram of the time each request took.",
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-04 15:35:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}, []string{"proxy_name", "to", "rcode"})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									healthcheckFailureCount = promauto.NewCounterVec(prometheus.CounterOpts{
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 12:55:51 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Namespace: plugin.Namespace,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Subsystem: "proxy",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Name:      "healthcheck_failures_total",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Help:      "Counter of the number of failed healthchecks.",
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-04 15:35:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}, []string{"proxy_name", "to"})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									connCacheHitsCount = promauto.NewCounterVec(prometheus.CounterOpts{
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 12:55:51 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Namespace: plugin.Namespace,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Subsystem: "proxy",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Name:      "conn_cache_hits_total",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Help:      "Counter of connection cache hits per upstream and protocol.",
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-04 15:35:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}, []string{"proxy_name", "to", "proto"})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									connCacheMissesCount = promauto.NewCounterVec(prometheus.CounterOpts{
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 12:55:51 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Namespace: plugin.Namespace,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Subsystem: "proxy",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Name:      "conn_cache_misses_total",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										Help:      "Counter of connection cache misses per upstream and protocol.",
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-04 15:35:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}, []string{"proxy_name", "to", "proto"})
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-24 12:55:51 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 |