middleware

package
v1.16.109 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const RPCTypeInternal = "internal"

RPCTypeInternal identifies the "RPC" request as coming from some internal operation that runs on the cluster leader. Technically this is not an RPC request, but these raft.Apply operations have the same impact on blocking queries, and streaming subscriptions, so need to be tracked by the same metric and logs. Really what we are measuring here is a "cluster operation". The term we have used for this historically is "RPC", so we continue to use that here.

View Source
const RPCTypeNetRPC = "net/rpc"

Variables

View Source
var OneTwelveRPCSummary = []prometheus.SummaryDefinition{
	{
		Name: metricRPCRequest,
		Help: "Measures the time an RPC service call takes to make in milliseconds. Labels mark which RPC method was called and metadata about the call.",
	},
}

Functions

func GetNetRPCInterceptor

func GetNetRPCInterceptor(recorder *RequestRecorder) rpc.ServerServiceCallInterceptor

func GetNetRPCRateLimitingInterceptor

func GetNetRPCRateLimitingInterceptor(requestLimitsHandler rpcRate.RequestLimitsHandler, panicHandler RecoveryHandlerFunc) rpc.PreBodyInterceptor

Types

type RecoveryHandlerFunc

type RecoveryHandlerFunc func(p interface{}) (err error)

func NewPanicHandler

func NewPanicHandler(logger hclog.Logger) RecoveryHandlerFunc

NewPanicHandler returns a RecoveryHandlerFunc type function to handle panic in RPC server's handlers.

type RequestRecorder

type RequestRecorder struct {
	Logger       hclog.Logger
	RecorderFunc func(key []string, val float32, labels []metrics.Label)
	// contains filtered or unexported fields
}

func NewRequestRecorder

func NewRequestRecorder(logger hclog.Logger, isLeader func() bool, localDC string) *RequestRecorder

func (*RequestRecorder) Record

func (r *RequestRecorder) Record(requestName string, rpcType string, start time.Time, request interface{}, respErrored bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL