erigon-pulse/cmd/rpcdaemon/cli/httpcfg/http_cfg.go
Dmytro a63b89334b
added logging for slow RPC requests (#8818)
Changed distribution of httpcfg.HttpCfg to be pointer.
Added new flags:
rpc.slow.log - which is false by default, this flag need to enable
logging slow RPC requests
rpc.slow.log.threshold - which is 100 by default, this flag specify slow
threshold in milliseconds
Updated rpc handler to log slow requests:
- added map[request id] {method, timestamp}
- put every request details to map above
- delete request details from map above
- added time interval check for elements in map and if time difference
is more than given threshold print request id and the method
- app will print slow requests in next cases:
1. As soon as request take more than given threshold
2. Every 20 seconds if request still in process
3. After request finished and it took more than give threshold

---------

Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
2023-11-28 16:11:39 +07:00

85 lines
2.5 KiB
Go

package httpcfg
import (
"time"
"github.com/ledgerwatch/erigon-lib/common/datadir"
"github.com/ledgerwatch/erigon-lib/kv/kvcache"
"github.com/ledgerwatch/erigon/eth/ethconfig"
"github.com/ledgerwatch/erigon/rpc/rpccfg"
)
type HttpCfg struct {
Enabled bool
GraphQLEnabled bool
WithDatadir bool // Erigon's database can be read by separated processes on same machine - in read-only mode - with full support of transactions. It will share same "OS PageCache" with Erigon process.
DataDir string
Dirs datadir.Dirs
AuthRpcHTTPListenAddress string
TLSCertfile string
TLSCACert string
TLSKeyFile string
HttpServerEnabled bool
HttpURL string
HttpListenAddress string
HttpPort int
HttpCORSDomain []string
HttpVirtualHost []string
AuthRpcVirtualHost []string
HttpCompression bool
HttpsServerEnabled bool
HttpsURL string
HttpsListenAddress string
HttpsPort int
HttpsCertfile string
HttpsKeyFile string
AuthRpcPort int
PrivateApiAddr string
API []string
Gascap uint64
MaxTraces uint64
WebsocketEnabled bool
WebsocketCompression bool
RpcAllowListFilePath string
RpcBatchConcurrency uint
RpcStreamingDisable bool
DBReadConcurrency int
TraceCompatibility bool // Bug for bug compatibility for trace_ routines with OpenEthereum
TxPoolApiAddr string
StateCache kvcache.CoherentConfig
Snap ethconfig.BlocksFreezing
Sync ethconfig.Sync
// GRPC server
GRPCServerEnabled bool
GRPCListenAddress string
GRPCPort int
GRPCHealthCheckEnabled bool
// Socket Server
SocketServerEnabled bool
SocketListenUrl string
JWTSecretPath string // Engine API Authentication
TraceRequests bool // Always trace requests in INFO level
HTTPTimeouts rpccfg.HTTPTimeouts
AuthRpcTimeouts rpccfg.HTTPTimeouts
EvmCallTimeout time.Duration
LogDirVerbosity string
LogDirPath string
BatchLimit int // Maximum number of requests in a batch
ReturnDataLimit int // Maximum number of bytes returned from calls (like eth_call)
AllowUnprotectedTxs bool // Whether to allow non EIP-155 protected transactions txs over RPC
MaxGetProofRewindBlockCount int //Max GetProof rewind block count
// Ots API
OtsMaxPageSize uint64
RPCSlowLogThreshold time.Duration
}