Exemple #1
0
// VerifyToken finds a customer by authentication token.
func (s *profileServer) GetHotels(ctx context.Context, args *pb.Args) (*pb.Reply, error) {
	md, _ := metadata.FromContext(ctx)
	log.Printf("traceID=%s", md["traceID"])
	// trace.Req(md["traceID"], "service.profile", md["from"], "")
	// defer trace.Rep(md["traceID"], md["from"], "service.profile", time.Now())

	reply := new(pb.Reply)
	for _, i := range args.HotelIds {
		reply.Hotels = append(reply.Hotels, s.hotels[i])
	}

	return reply, nil
}
// VerifyToken finds a customer by authentication token.
func (s *profileServer) GetHotels(ctx context.Context, args *pb.Args) (*pb.Reply, error) {
	md, _ := metadata.FromContext(ctx)
	t := trace.Tracer{TraceID: md["traceID"]}
	t.In(serverName, md["from"])
	defer t.Out(md["from"], serverName, time.Now())

	reply := new(pb.Reply)
	for _, i := range args.HotelIds {
		reply.Hotels = append(reply.Hotels, s.hotels[i])
	}

	return reply, nil
}