forked from cerc-io/ipld-eth-server
Improved logging and metrics. (#227)
1. Improve logging to include API method, user ID, etc in the output. We do this by intercepting the request details in the "middleware" and adding them to the request context, as well as adding a wrapper to logrus that simplifies including the fields in the output. 2. Breakdown API metrics by method. This will allow us to differentiate call counts and durations by API method (eg, eth_call vs eth_getStorageAt).
This commit is contained in:
@@ -18,9 +18,8 @@ package test_config
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/cerc-io/ipld-eth-server/v4/pkg/log"
|
||||
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
@@ -35,7 +34,7 @@ func setTestConfig() {
|
||||
vip.SetConfigName("testing")
|
||||
vip.AddConfigPath("$GOPATH/src/github.com/cerc-io/ipld-eth-server/environments/")
|
||||
if err := vip.ReadInConfig(); err != nil {
|
||||
logrus.Fatal(err)
|
||||
log.Fatal(err)
|
||||
}
|
||||
ipc := vip.GetString("client.ipcPath")
|
||||
|
||||
@@ -45,7 +44,7 @@ func setTestConfig() {
|
||||
ipc = vip.GetString("url")
|
||||
}
|
||||
if ipc == "" {
|
||||
logrus.Fatal(errors.New("testing.toml IPC path or $INFURA_URL env variable need to be set"))
|
||||
log.Fatal(errors.New("testing.toml IPC path or $INFURA_URL env variable need to be set"))
|
||||
}
|
||||
|
||||
hn := vip.GetString("database.hostname")
|
||||
|
||||
Reference in New Issue
Block a user