| 
									
										
										
										
											2019-03-14 08:12:28 +01:00
										 |  |  | package grpc
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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"
 | 
					
						
							| 
									
										
										
										
											2019-03-14 08:12:28 +01:00
										 |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Variables declared for monitoring.
 | 
					
						
							|  |  |  | var (
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	RequestCount = promauto.NewCounterVec(prometheus.CounterOpts{
 | 
					
						
							| 
									
										
										
										
											2019-03-14 08:12:28 +01:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "grpc",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 		Name:      "requests_total",
 | 
					
						
							| 
									
										
										
										
											2019-03-14 08:12:28 +01:00
										 |  |  | 		Help:      "Counter of requests made per upstream.",
 | 
					
						
							|  |  |  | 	}, []string{"to"})
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	RcodeCount = promauto.NewCounterVec(prometheus.CounterOpts{
 | 
					
						
							| 
									
										
										
										
											2019-03-14 08:12:28 +01:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "grpc",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 		Name:      "responses_total",
 | 
					
						
							| 
									
										
										
										
											2019-03-14 08:12:28 +01:00
										 |  |  | 		Help:      "Counter of requests made per upstream.",
 | 
					
						
							|  |  |  | 	}, []string{"rcode", "to"})
 | 
					
						
							| 
									
										
										
										
											2020-07-25 23:06:28 +08:00
										 |  |  | 	RequestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
 | 
					
						
							| 
									
										
										
										
											2019-03-14 08:12:28 +01:00
										 |  |  | 		Namespace: plugin.Namespace,
 | 
					
						
							|  |  |  | 		Subsystem: "grpc",
 | 
					
						
							|  |  |  | 		Name:      "request_duration_seconds",
 | 
					
						
							|  |  |  | 		Buckets:   plugin.TimeBuckets,
 | 
					
						
							|  |  |  | 		Help:      "Histogram of the time each request took.",
 | 
					
						
							|  |  |  | 	}, []string{"to"})
 | 
					
						
							|  |  |  | )
 |