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

Method UnaryEcho

examples/features/orca/server/main.go:46–55  ·  view source on GitHub ↗
(ctx context.Context, in *pb.EchoRequest)

Source from the content-addressed store, hash-verified

44}
45
46func (s *server) UnaryEcho(ctx context.Context, in *pb.EchoRequest) (*pb.EchoResponse, error) {
47 // Report a sample cost for this query.
48 cmr := orca.CallMetricsRecorderFromContext(ctx)
49 if cmr == nil {
50 return nil, status.Errorf(codes.Internal, "unable to retrieve call metrics recorder (missing ORCA ServerOption?)")
51 }
52 cmr.SetRequestCost("db_queries", 10)
53
54 return &pb.EchoResponse{Message: in.Message}, nil
55}
56
57func main() {
58 flag.Parse()

Callers

nothing calls this directly

Calls 3

ErrorfFunction · 0.92
SetRequestCostMethod · 0.65

Tested by

no test coverage detected