(srv any, ss grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler)
| 152 | } |
| 153 | |
| 154 | func (h *serverMetricsHandler) streamInterceptor(srv any, ss grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error { |
| 155 | var metadataExchangeLabels metadata.MD |
| 156 | if h.options.MetricsOptions.pluginOption != nil { |
| 157 | metadataExchangeLabels = h.options.MetricsOptions.pluginOption.GetMetadata() |
| 158 | } |
| 159 | als := &attachLabelsStream{ |
| 160 | ServerStream: ss, |
| 161 | metadataExchangeLabels: metadataExchangeLabels, |
| 162 | } |
| 163 | err := handler(srv, als) |
| 164 | |
| 165 | // Add metadata exchange labels to trailers if never sent in headers, |
| 166 | // irrespective of whether or not RPC failed. |
| 167 | if !als.attachedLabels.Load() { |
| 168 | als.SetTrailer(als.metadataExchangeLabels) |
| 169 | } |
| 170 | return err |
| 171 | } |
| 172 | |
| 173 | // TagConn exists to satisfy stats.Handler. |
| 174 | func (h *serverMetricsHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context { |
nothing calls this directly
no test coverage detected