middleware

package
v1.16.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MPL-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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