mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	plugin/forward Add rcode and rtype to request_duration_seconds metric (#4391)
* plugin/forward Add rcode and rtype to request_duration_seconds metric Signed-off-by: Maxime Ginters <maxime.ginters@shopify.com> * Control the cardinality of query type Signed-off-by: Maxime Ginters <maxime.ginters@shopify.com>
This commit is contained in:
		
							
								
								
									
										37
									
								
								plugin/pkg/dnsutil/monitor.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								plugin/pkg/dnsutil/monitor.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| package dnsutil | ||||
|  | ||||
| import ( | ||||
| 	"github.com/miekg/dns" | ||||
| ) | ||||
|  | ||||
| var monitorType = map[uint16]struct{}{ | ||||
| 	dns.TypeAAAA:   {}, | ||||
| 	dns.TypeA:      {}, | ||||
| 	dns.TypeCNAME:  {}, | ||||
| 	dns.TypeDNSKEY: {}, | ||||
| 	dns.TypeDS:     {}, | ||||
| 	dns.TypeMX:     {}, | ||||
| 	dns.TypeNSEC3:  {}, | ||||
| 	dns.TypeNSEC:   {}, | ||||
| 	dns.TypeNS:     {}, | ||||
| 	dns.TypePTR:    {}, | ||||
| 	dns.TypeRRSIG:  {}, | ||||
| 	dns.TypeSOA:    {}, | ||||
| 	dns.TypeSRV:    {}, | ||||
| 	dns.TypeTXT:    {}, | ||||
| 	// Meta Qtypes | ||||
| 	dns.TypeIXFR: {}, | ||||
| 	dns.TypeAXFR: {}, | ||||
| 	dns.TypeANY:  {}, | ||||
| } | ||||
|  | ||||
| const other = "other" | ||||
|  | ||||
| // QTypeMonitorLabel returns dns type label based on a list of monitored types. | ||||
| // Will return "other" for unmonitored ones. | ||||
| func QTypeMonitorLabel(qtype uint16) string { | ||||
| 	if _, known := monitorType[qtype]; known { | ||||
| 		return dns.Type(qtype).String() | ||||
| 	} | ||||
| 	return other | ||||
| } | ||||
		Reference in New Issue
	
	Block a user