Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Update as per PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
v-homsi committed Oct 13, 2022
1 parent 1f2cb83 commit 66c5829
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion server/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ const (
JSONRPCAllowUnprotectedTxs = "json-rpc.allow-unprotected-txs"
JSONRPCMaxOpenConnections = "json-rpc.max-open-connections"
JSONRPCEnableIndexer = "json-rpc.enable-indexer"
JSONRPCEnableMetrics = "metrics"
// JSONRPCEnableMetrics enables EVM RPC metrics server.
// Set to `metrics` which is hardcoded flag from go-ethereum.
// https://github.com/ethereum/go-ethereum/blob/master/metrics/metrics.go#L35-L55
JSONRPCEnableMetrics = "metrics"
)

// EVM flags
Expand Down
6 changes: 3 additions & 3 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"github.com/cosmos/cosmos-sdk/server/rosetta"
crgserver "github.com/cosmos/cosmos-sdk/server/rosetta/lib/server"

ethmetrics "github.com/ethereum/go-ethereum/metrics"
ethmetricsexp "github.com/ethereum/go-ethereum/metrics/exp"

"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -344,8 +343,9 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, appCreator ty
app.RegisterTendermintService(clientCtx)
}

if ctx.Viper.GetBool(srvflags.JSONRPCEnableMetrics) {
ethmetrics.Enabled = true
// Enable metrics if JSONRPC is enabled and --metrics is passed
// Flag not added in config to avoid user enabling in config without passing in CLI
if config.JSONRPC.Enable && ctx.Viper.GetBool(srvflags.JSONRPCEnableMetrics) {
ethmetricsexp.Setup(config.JSONRPC.MetricsAddress)
}

Expand Down

0 comments on commit 66c5829

Please sign in to comment.