feat(proxyd): impl proxyd_healthz method (#8658)
This commit is contained in:
parent
ca17102998
commit
b1522ace51
@ -17,6 +17,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
sw "github.com/ethereum-optimism/optimism/proxyd/pkg/avg-sliding-window"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
@ -24,8 +25,6 @@ import (
|
|||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/xaionaro-go/weightedshuffle"
|
"github.com/xaionaro-go/weightedshuffle"
|
||||||
"golang.org/x/sync/semaphore"
|
"golang.org/x/sync/semaphore"
|
||||||
|
|
||||||
sw "github.com/ethereum-optimism/optimism/proxyd/pkg/avg-sliding-window"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -285,6 +284,8 @@ type indexedReqRes struct {
|
|||||||
res *RPCRes
|
res *RPCRes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const proxydHealthzMethod = "proxyd_healthz"
|
||||||
|
|
||||||
const ConsensusGetReceiptsMethod = "consensus_getReceipts"
|
const ConsensusGetReceiptsMethod = "consensus_getReceipts"
|
||||||
|
|
||||||
const ReceiptsTargetDebugGetRawReceipts = "debug_getRawReceipts"
|
const ReceiptsTargetDebugGetRawReceipts = "debug_getRawReceipts"
|
||||||
|
@ -435,6 +435,16 @@ func (s *Server) handleBatchRPC(ctx context.Context, reqs []json.RawMessage, isL
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simple health check
|
||||||
|
if len(reqs) == 1 && parsedReq.Method == proxydHealthzMethod {
|
||||||
|
res := &RPCRes{
|
||||||
|
ID: parsedReq.ID,
|
||||||
|
JSONRPC: JSONRPCVersion,
|
||||||
|
Result: "OK",
|
||||||
|
}
|
||||||
|
return []*RPCRes{res}, false, "", nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := ValidateRPCReq(parsedReq); err != nil {
|
if err := ValidateRPCReq(parsedReq); err != nil {
|
||||||
RecordRPCError(ctx, BackendProxyd, MethodUnknown, err)
|
RecordRPCError(ctx, BackendProxyd, MethodUnknown, err)
|
||||||
responses[i] = NewRPCErrorRes(nil, err)
|
responses[i] = NewRPCErrorRes(nil, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user