mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 12:07:17 +00:00
Added write of vm default set to metrics (#8151)
Metrics handler was missing erigon-lib metrics - which where added to the VM default set This fixes that whilst avoiding duplicates from erigon registrations
This commit is contained in:
parent
5d3e294f3c
commit
35c98cdce9
@ -39,6 +39,9 @@ func Handler(reg Registry) http.Handler {
|
||||
sort.Strings(names)
|
||||
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
|
||||
metrics2.WritePrometheus(w, false)
|
||||
|
||||
contentType := expfmt.Negotiate(r.Header)
|
||||
enc := expfmt.NewEncoder(w, contentType)
|
||||
mf, err := prometheus.DefaultGatherer.Gather()
|
||||
|
@ -7,29 +7,34 @@ import (
|
||||
func GetOrCreateCounter(s string, isGauge ...bool) *metrics2.Counter {
|
||||
counter := metrics2.GetOrCreateCounter(s, isGauge...)
|
||||
DefaultRegistry.Register(s, counter)
|
||||
metrics2.GetDefaultSet().UnregisterMetric(s)
|
||||
return counter
|
||||
}
|
||||
|
||||
func GetOrCreateGauge(s string, f func() float64) *metrics2.Gauge {
|
||||
gauge := metrics2.GetOrCreateGauge(s, f)
|
||||
DefaultRegistry.Register(s, gauge)
|
||||
metrics2.GetDefaultSet().UnregisterMetric(s)
|
||||
return gauge
|
||||
}
|
||||
|
||||
func GetOrCreateFloatCounter(s string) *metrics2.FloatCounter {
|
||||
floatCounter := metrics2.GetOrCreateFloatCounter(s)
|
||||
DefaultRegistry.Register(s, floatCounter)
|
||||
metrics2.GetDefaultSet().UnregisterMetric(s)
|
||||
return floatCounter
|
||||
}
|
||||
|
||||
func GetOrCreateSummary(s string) *metrics2.Summary {
|
||||
summary := metrics2.GetOrCreateSummary(s)
|
||||
DefaultRegistry.Register(s, summary)
|
||||
metrics2.GetDefaultSet().UnregisterMetric(s)
|
||||
return summary
|
||||
}
|
||||
|
||||
func GetOrCreateHistogram(s string) *metrics2.Histogram {
|
||||
histogram := metrics2.GetOrCreateHistogram(s)
|
||||
DefaultRegistry.Register(s, histogram)
|
||||
metrics2.GetDefaultSet().UnregisterMetric(s)
|
||||
return histogram
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user