Skip to content

Commit

Permalink
metrics: add handler performance metrics (ethereum#22581)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan authored and JukLee0ira committed Dec 16, 2024
1 parent f6c569c commit 7682b5a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions metrics/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ func GetOrRegisterHistogram(name string, r Registry, s Sample) Histogram {
return r.GetOrRegister(name, func() Histogram { return NewHistogram(s) }).(Histogram)
}

// GetOrRegisterHistogramLazy returns an existing Histogram or constructs and
// registers a new StandardHistogram.
func GetOrRegisterHistogramLazy(name string, r Registry, s func() Sample) Histogram {
if nil == r {
r = DefaultRegistry
}
return r.GetOrRegister(name, func() Histogram { return NewHistogram(s()) }).(Histogram)
}

// NewHistogram constructs a new StandardHistogram from a Sample.
func NewHistogram(s Sample) Histogram {
if !Enabled {
Expand Down

0 comments on commit 7682b5a

Please sign in to comment.