Commit df0b6749 authored by felipe's avatar felipe Committed by GitHub

feat(proxyd): impl proxyd_healthz method (#8658)

parent 82d9f11e
...@@ -17,6 +17,7 @@ import ( ...@@ -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 ( ...@@ -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 { ...@@ -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 ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment