(ctx context.Context, in *testpb.SimpleRequest)
| 725 | } |
| 726 | |
| 727 | func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { |
| 728 | st := in.GetResponseStatus() |
| 729 | if md, ok := metadata.FromIncomingContext(ctx); ok { |
| 730 | if initialMetadata, ok := md[initialMetadataKey]; ok { |
| 731 | header := metadata.Pairs(initialMetadataKey, initialMetadata[0]) |
| 732 | grpc.SendHeader(ctx, header) |
| 733 | } |
| 734 | if trailingMetadata, ok := md[trailingMetadataKey]; ok { |
| 735 | trailer := metadata.Pairs(trailingMetadataKey, trailingMetadata[0]) |
| 736 | grpc.SetTrailer(ctx, trailer) |
| 737 | } |
| 738 | } |
| 739 | if st != nil && st.Code != 0 { |
| 740 | return nil, status.Error(codes.Code(st.Code), st.Message) |
| 741 | } |
| 742 | pl, err := serverNewPayload(in.GetResponseType(), in.GetResponseSize()) |
| 743 | if err != nil { |
| 744 | return nil, err |
| 745 | } |
| 746 | if r, orcaData := orca.CallMetricsRecorderFromContext(ctx), in.GetOrcaPerQueryReport(); r != nil && orcaData != nil { |
| 747 | // Transfer the request's per-Call ORCA data to the call metrics |
| 748 | // recorder in the context, if present. |
| 749 | setORCAMetrics(r, orcaData) |
| 750 | } |
| 751 | return &testpb.SimpleResponse{ |
| 752 | Payload: pl, |
| 753 | }, nil |
| 754 | } |
| 755 | |
| 756 | func setORCAMetrics(r orca.ServerMetricsRecorder, orcaData *testpb.TestOrcaReport) { |
| 757 | r.SetCPUUtilization(orcaData.CpuUtilization) |
nothing calls this directly
no test coverage detected