Fix panic in atomic on ARM and x86-32 platforms
This commit is contained in:
parent
a2e03e3bd0
commit
5ab584bc6a
1 changed files with 3 additions and 1 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue