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)
| 132 | // |
| 133 | // [ORCA LoadReport]: https://github.com/cncf/xds/blob/main/xds/data/orca/v3/orca_load_report.proto#L15 |
| 134 | func CallMetricsServerOption(smp ServerMetricsProvider) grpc.ServerOption { |
| 135 | return joinServerOptions(grpc.ChainUnaryInterceptor(unaryInt(smp)), grpc.ChainStreamInterceptor(streamInt(smp))) |
| 136 | } |
| 137 | |
| 138 | func 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) { |