From 10977c806e2eb1465ef8b58da53af444049b252d Mon Sep 17 00:00:00 2001 From: georgehao Date: Mon, 11 Sep 2023 17:25:12 +0800 Subject: [PATCH] feat: address comments --- common/observability/server.go | 3 +-- coordinator/cmd/app/app.go | 2 +- prover-stats-api/cmd/app/app.go | 2 +- prover-stats-api/test/prover_task_test.go | 1 - rollup/cmd/event_watcher/app/app.go | 2 +- rollup/cmd/gas_oracle/app/app.go | 2 +- rollup/cmd/rollup_relayer/app/app.go | 2 +- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/common/observability/server.go b/common/observability/server.go index 1997679fc7..735b04a206 100644 --- a/common/observability/server.go +++ b/common/observability/server.go @@ -11,7 +11,6 @@ import ( "github.com/gin-contrib/pprof" "github.com/gin-gonic/gin" - "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/scroll-tech/go-ethereum/log" "github.com/urfave/cli/v2" @@ -22,7 +21,7 @@ import ( // Server starts the metrics server on the given address, will be closed when the given // context is canceled. -func Server(c *cli.Context, reg *prometheus.Registry, db *gorm.DB) { +func Server(c *cli.Context, db *gorm.DB) { if !c.Bool(utils.MetricsEnabled.Name) { return } diff --git a/coordinator/cmd/app/app.go b/coordinator/cmd/app/app.go index 52ce67607e..16d7b385d2 100644 --- a/coordinator/cmd/app/app.go +++ b/coordinator/cmd/app/app.go @@ -58,7 +58,7 @@ func action(ctx *cli.Context) error { } registry := prometheus.DefaultRegisterer - observability.Server(ctx, registry.(*prometheus.Registry), db) + observability.Server(ctx, db) proofCollector := cron.NewCollector(subCtx, db, cfg, registry) defer func() { diff --git a/prover-stats-api/cmd/app/app.go b/prover-stats-api/cmd/app/app.go index 4670464c9f..beb82514ac 100644 --- a/prover-stats-api/cmd/app/app.go +++ b/prover-stats-api/cmd/app/app.go @@ -56,7 +56,7 @@ func action(ctx *cli.Context) error { }() registry := prometheus.DefaultRegisterer - observability.Server(ctx, registry.(*prometheus.Registry), db) + observability.Server(ctx, db) // init Prover Stats API port := ctx.String(httpPortFlag.Name) diff --git a/prover-stats-api/test/prover_task_test.go b/prover-stats-api/test/prover_task_test.go index 9232b3e6d0..efc6e3f7bc 100644 --- a/prover-stats-api/test/prover_task_test.go +++ b/prover-stats-api/test/prover_task_test.go @@ -118,7 +118,6 @@ func getResp(t *testing.T, url string) interface{} { res := new(types.Response) assert.NoError(t, json.Unmarshal(byt, res)) - t.Log("----byt is ", string(byt)) assert.Equal(t, types.Success, res.ErrCode) return res.Data } diff --git a/rollup/cmd/event_watcher/app/app.go b/rollup/cmd/event_watcher/app/app.go index 0aec060ef7..05728a35d5 100644 --- a/rollup/cmd/event_watcher/app/app.go +++ b/rollup/cmd/event_watcher/app/app.go @@ -61,7 +61,7 @@ func action(ctx *cli.Context) error { }() registry := prometheus.DefaultRegisterer - observability.Server(ctx, registry.(*prometheus.Registry), db) + observability.Server(ctx, db) l1client, err := ethclient.Dial(cfg.L1Config.Endpoint) if err != nil { log.Error("failed to connect l1 geth", "config file", cfgFile, "error", err) diff --git a/rollup/cmd/gas_oracle/app/app.go b/rollup/cmd/gas_oracle/app/app.go index 42f86dc1c8..230f18019c 100644 --- a/rollup/cmd/gas_oracle/app/app.go +++ b/rollup/cmd/gas_oracle/app/app.go @@ -64,7 +64,7 @@ func action(ctx *cli.Context) error { }() registry := prometheus.DefaultRegisterer - observability.Server(ctx, registry.(*prometheus.Registry), db) + observability.Server(ctx, db) l1client, err := ethclient.Dial(cfg.L1Config.Endpoint) if err != nil { diff --git a/rollup/cmd/rollup_relayer/app/app.go b/rollup/cmd/rollup_relayer/app/app.go index 2f10c4bd32..63213fd297 100644 --- a/rollup/cmd/rollup_relayer/app/app.go +++ b/rollup/cmd/rollup_relayer/app/app.go @@ -64,7 +64,7 @@ func action(ctx *cli.Context) error { }() registry := prometheus.DefaultRegisterer - observability.Server(ctx, registry.(*prometheus.Registry), db) + observability.Server(ctx, db) // Init l2geth connection l2client, err := ethclient.Dial(cfg.L2Config.Endpoint)