streamInterceptor handles per RPC context management. It also handles per RPC tracing and stats by creating a top level call span and recording the latency for the full RPC call.
(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption)
| 128 | // tracing and stats by creating a top level call span and recording the latency |
| 129 | // for the full RPC call. |
| 130 | func (csh *clientStatsHandler) streamInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { |
| 131 | startTime := time.Now() |
| 132 | ctx, span := csh.createCallSpan(ctx, method) |
| 133 | callback := func(err error) { |
| 134 | perCallTracesAndMetrics(err, span, startTime, method) |
| 135 | } |
| 136 | opts = append([]grpc.CallOption{grpc.OnFinish(callback)}, opts...) |
| 137 | s, err := streamer(ctx, desc, cc, method, opts...) |
| 138 | if err != nil { |
| 139 | return nil, err |
| 140 | } |
| 141 | return s, nil |
| 142 | } |
| 143 | |
| 144 | type rpcInfo struct { |
| 145 | mi *metricsInfo |
nothing calls this directly
no test coverage detected