Skip to content

Commit cdb15a7

Browse files
authored
feat(monitoring): expose metrics (#885)
BEDS-90
1 parent 1686af5 commit cdb15a7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

backend/cmd/monitoring/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/gobitfly/beaconchain/pkg/commons/db"
88
"github.com/gobitfly/beaconchain/pkg/commons/log"
9+
"github.com/gobitfly/beaconchain/pkg/commons/metrics"
910
"github.com/gobitfly/beaconchain/pkg/commons/types"
1011
"github.com/gobitfly/beaconchain/pkg/commons/utils"
1112
"github.com/gobitfly/beaconchain/pkg/commons/version"
@@ -31,6 +32,15 @@ func Run() {
3132
}
3233
utils.Config = cfg
3334

35+
if utils.Config.Metrics.Enabled {
36+
go func() {
37+
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
38+
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
39+
log.Fatal(err, "error serving metrics", 0)
40+
}
41+
}()
42+
}
43+
3444
db.ClickHouseWriter, db.ClickHouseReader = db.MustInitDB(&types.DatabaseConfig{
3545
Username: cfg.ClickHouse.WriterDatabase.Username,
3646
Password: cfg.ClickHouse.WriterDatabase.Password,

0 commit comments

Comments
 (0)