mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge pull request #1084 from c9s/bhwu/avoid-init-metrics-twice
FIX: [grid2] avoid initializing metrics twice
This commit is contained in:
commit
bb80df096b
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue
Block a user