mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
metrics: remove nil histograms
This commit is contained in:
parent
abd76eee1e
commit
01cfef29ef
1 changed files with 1 additions and 11 deletions
|
|
@ -40,10 +40,7 @@ func GetOrRegisterHistogramLazy(name string, r Registry, s func() Sample) Histog
|
|||
|
||||
// NewHistogram constructs a new StandardHistogram from a Sample.
|
||||
func NewHistogram(s Sample) Histogram {
|
||||
if !Enabled {
|
||||
return NilHistogram{}
|
||||
}
|
||||
return &StandardHistogram{sample: s}
|
||||
return &StandardHistogram{s}
|
||||
}
|
||||
|
||||
// NewRegisteredHistogram constructs and registers a new StandardHistogram from
|
||||
|
|
@ -57,13 +54,6 @@ func NewRegisteredHistogram(name string, r Registry, s Sample) Histogram {
|
|||
return c
|
||||
}
|
||||
|
||||
// NilHistogram is a no-op Histogram.
|
||||
type NilHistogram struct{}
|
||||
|
||||
func (NilHistogram) Clear() {}
|
||||
func (NilHistogram) Snapshot() HistogramSnapshot { return (*emptySnapshot)(nil) }
|
||||
func (NilHistogram) Update(v int64) {}
|
||||
|
||||
// StandardHistogram is the standard implementation of a Histogram and uses a
|
||||
// Sample to bound its memory use.
|
||||
type StandardHistogram struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue