mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
metrics: use atomic.Pointer in runtimeHistogram (#32361)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
f86870f5da
commit
888b71b3cf
1 changed files with 2 additions and 2 deletions
|
|
@ -14,7 +14,7 @@ func getOrRegisterRuntimeHistogram(name string, scale float64, r Registry) *runt
|
|||
|
||||
// runtimeHistogram wraps a runtime/metrics histogram.
|
||||
type runtimeHistogram struct {
|
||||
v atomic.Value // v is a pointer to a metrics.Float64Histogram
|
||||
v atomic.Pointer[metrics.Float64Histogram]
|
||||
scaleFactor float64
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ func (h *runtimeHistogram) Update(int64) {
|
|||
|
||||
// Snapshot returns a non-changing copy of the histogram.
|
||||
func (h *runtimeHistogram) Snapshot() HistogramSnapshot {
|
||||
hist := h.v.Load().(*metrics.Float64Histogram)
|
||||
hist := h.v.Load()
|
||||
return newRuntimeHistogramSnapshot(hist)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue