grid2: add metrics registration guard

This commit is contained in:
c9s 2023-01-31 21:30:58 +08:00
parent 4a68f0e75c
commit d43acaa17c
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -66,10 +66,17 @@ func initMetrics(extendedLabels []string) {
)
}
var metricsRegistered = false
func registerMetrics() {
if metricsRegistered {
return
}
prometheus.MustRegister(
metricsGridNumOfOrders,
metricsGridProfit,
metricsGridOrderPrices,
)
metricsRegistered = true
}