Fix panic in atomic on ARM and x86-32 platforms

This commit is contained in:
Michael 2018-04-17 10:32:03 +02:00 committed by Traefiker Bot
parent a2e03e3bd0
commit 5ab584bc6a

View file

@ -41,11 +41,13 @@ func NewBackendMetricsMiddleware(registry metrics.Registry, backendName string)
} }
type metricsMiddleware struct { type metricsMiddleware struct {
// Important: Since this int64 field is using sync/atomic, it has to be at the top of the struct due to a bug on 32-bit platform
// See: https://golang.org/pkg/sync/atomic/ for more information
openConns int64
reqsCounter gokitmetrics.Counter reqsCounter gokitmetrics.Counter
reqDurationHistogram gokitmetrics.Histogram reqDurationHistogram gokitmetrics.Histogram
openConnsGauge gokitmetrics.Gauge openConnsGauge gokitmetrics.Gauge
baseLabels []string baseLabels []string
openConns int64
} }
func (m *metricsMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { func (m *metricsMiddleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {