mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
FIX: [grid2] avoid initializing metrics twice
This commit is contained in:
parent
1dd6f9ef3e
commit
d4912ed3cd
|
@ -1,6 +1,8 @@
|
|||
package grid2
|
||||
|
||||
import "github.com/prometheus/client_golang/prometheus"
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
var (
|
||||
metricsGridNum *prometheus.GaugeVec
|
||||
|
@ -32,6 +34,10 @@ func mergeLabels(a, b prometheus.Labels) prometheus.Labels {
|
|||
}
|
||||
|
||||
func initMetrics(extendedLabels []string) {
|
||||
if metricsGridNum != nil {
|
||||
return
|
||||
}
|
||||
|
||||
metricsGridNum = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "bbgo_grid2_num",
|
||||
|
@ -110,4 +116,4 @@ func registerMetrics() {
|
|||
metricsGridOrderPrices,
|
||||
)
|
||||
metricsRegistered = true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user