I was trying to get current HTTP connections in HTTP.Server. Internally transport tracks it under connPerHostCount. However, I don't see a way of getting this value.
I tried this: type HTTPRequestMetrics struct { activeConnections int64 next http.Handler } func HTTPRequestMetricsHandler(h http.Handler) *HTTPRequestMetrics { return &HTTPRequestMetrics{next: h} } func (h *HTTPRequestMetrics) ServeHTTP(w http.ResponseWriter, r *http. Request) { atomic.AddInt64(&h.activeConnections, 1) defer atomic.AddInt64(&h.activeConnections, -1) h.next.ServeHTTP(w, r) } But looks like defer never gets called when under heavy load (and clients see connection reset by peer) Does anyone know a way of getting current open connections? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.