MCPcopy
hub / github.com/grpc/grpc-go / CallMetricsServerOption

Function CallMetricsServerOption

orca/call_metrics.go:134–136  ·  view source on GitHub ↗

CallMetricsServerOption returns a server option which enables the reporting of per-RPC custom backend metrics for unary and streaming RPCs. Server applications interested in injecting custom backend metrics should pass the server option returned from this function as the first argument to grpc.NewS

(smp ServerMetricsProvider)

Source from the content-addressed store, hash-verified

132//
133// [ORCA LoadReport]: https://github.com/cncf/xds/blob/main/xds/data/orca/v3/orca_load_report.proto#L15
134func CallMetricsServerOption(smp ServerMetricsProvider) grpc.ServerOption {
135 return joinServerOptions(grpc.ChainUnaryInterceptor(unaryInt(smp)), grpc.ChainStreamInterceptor(streamInt(smp)))
136}
137
138func unaryInt(smp ServerMetricsProvider) func(ctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
139 return func(ctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {

Callers 8

startORCAServerFunction · 0.92
mainFunction · 0.92
startServerFunction · 0.92
mainFunction · 0.92
TestWRRMetricsMethod · 0.92

Calls 4

ChainUnaryInterceptorFunction · 0.92
ChainStreamInterceptorFunction · 0.92
unaryIntFunction · 0.85
streamIntFunction · 0.85

Tested by 6

startORCAServerFunction · 0.74
startServerFunction · 0.74
TestWRRMetricsMethod · 0.74