forked from cerc-io/ipld-eth-server
28 lines
454 B
Go
28 lines
454 B
Go
package prom
|
|
|
|
import (
|
|
"github.com/jmoiron/sqlx"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
const (
|
|
namespace = "ipld_eth_server"
|
|
statsSubsystem = "stats"
|
|
)
|
|
|
|
var (
|
|
metrics bool
|
|
)
|
|
|
|
// Init module initialization
|
|
func Init() {
|
|
metrics = true
|
|
}
|
|
|
|
// RegisterDBCollector create metric colletor for given connection
|
|
func RegisterDBCollector(name string, db *sqlx.DB) {
|
|
if metrics {
|
|
prometheus.Register(NewDBStatsCollector(name, db))
|
|
}
|
|
}
|