mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 01:34:21 -04:00 
			
		
		
		
	Fix panic caused by missing metric labels in proxy. (#492)
This commit is contained in:
		| @@ -80,7 +80,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( | |||||||
| 			host := upstream.Select() | 			host := upstream.Select() | ||||||
| 			if host == nil { | 			if host == nil { | ||||||
|  |  | ||||||
| 				RequestDuration.WithLabelValues(upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) | 				RequestDuration.WithLabelValues(state.Proto(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) | ||||||
|  |  | ||||||
| 				return dns.RcodeServerFailure, errUnreachable | 				return dns.RcodeServerFailure, errUnreachable | ||||||
| 			} | 			} | ||||||
| @@ -94,7 +94,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( | |||||||
| 			if backendErr == nil { | 			if backendErr == nil { | ||||||
| 				w.WriteMsg(reply) | 				w.WriteMsg(reply) | ||||||
|  |  | ||||||
| 				RequestDuration.WithLabelValues(upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) | 				RequestDuration.WithLabelValues(state.Proto(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) | ||||||
|  |  | ||||||
| 				return 0, nil | 				return 0, nil | ||||||
| 			} | 			} | ||||||
| @@ -109,7 +109,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( | |||||||
| 			}(host, timeout) | 			}(host, timeout) | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		RequestDuration.WithLabelValues(upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) | 		RequestDuration.WithLabelValues(state.Proto(), upstream.From()).Observe(float64(time.Since(start) / time.Millisecond)) | ||||||
|  |  | ||||||
| 		return dns.RcodeServerFailure, errUnreachable | 		return dns.RcodeServerFailure, errUnreachable | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user