本文整理汇总了Golang中github.com/harlow/go-micro-services/trace.Tracer.Out方法的典型用法代码示例。如果您正苦于以下问题:Golang Tracer.Out方法的具体用法?Golang Tracer.Out怎么用?Golang Tracer.Out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/harlow/go-micro-services/trace.Tracer
的用法示例。
在下文中一共展示了Tracer.Out方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetHotels
// VerifyToken finds a customer by authentication token.
func (s *profileServer) GetHotels(ctx context.Context, args *profile.Args) (*profile.Reply, error) {
md, _ := metadata.FromContext(ctx)
t := trace.Tracer{TraceID: strings.Join(md["traceID"], ",")}
t.In(serverName, strings.Join(md["from"], ","))
defer t.Out(strings.Join(md["from"], ","), serverName, time.Now())
reply := new(profile.Reply)
for _, i := range args.HotelIds {
reply.Hotels = append(reply.Hotels, s.hotels[i])
}
return reply, nil
}
示例2: VerifyToken
// VerifyToken finds a customer by authentication token.
func (s *authServer) VerifyToken(ctx context.Context, args *pb.Args) (*pb.Customer, error) {
md, _ := metadata.FromContext(ctx)
t := trace.Tracer{TraceID: md["traceID"]}
t.In(serverName, args.From)
defer t.Out(args.From, serverName, time.Now())
customer := s.customers[args.AuthToken]
if customer == nil {
return &pb.Customer{}, errors.New("Invalid Token")
}
return customer, nil
}
示例3: BoundedBox
// BoundedBox returns all hotels contained within a given rectangle.
func (s *geoServer) BoundedBox(ctx context.Context, rect *pb.Rectangle) (*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 _, loc := range s.locations {
if inRange(loc.Point, rect) {
reply.HotelIds = append(reply.HotelIds, loc.HotelID)
}
}
return reply, nil
}
示例4: GetProfiles
// VerifyToken finds a customer by authentication token.
func (s *profileServer) GetProfiles(ctx context.Context, args *profile.ProfileRequest) (*profile.ProfileReply, error) {
md, _ := metadata.FromContext(ctx)
traceID := strings.Join(md["traceID"], ",")
fromName := strings.Join(md["fromName"], ",")
t := trace.Tracer{TraceID: traceID}
t.In(s.serverName, fromName)
defer t.Out(fromName, s.serverName, time.Now())
reply := new(profile.ProfileReply)
for _, i := range args.HotelIds {
reply.Hotels = append(reply.Hotels, s.hotels[i])
}
return reply, nil
}
示例5: GetRates
// GetRates gets rates for hotels for specific date range.
func (s *rateServer) GetRates(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 _, hotelID := range args.HotelIds {
k := stay{hotelID, args.InDate, args.OutDate}
if s.rates[k] == nil {
continue
}
reply.RatePlans = append(reply.RatePlans, s.rates[k])
}
return reply, nil
}
示例6: BoundedBox
// BoundedBox returns all hotels contained within a given rectangle.
func (s *geoServer) BoundedBox(ctx context.Context, rect *geo.GeoRequest) (*geo.GeoReply, error) {
md, _ := metadata.FromContext(ctx)
traceID := strings.Join(md["traceID"], ",")
fromName := strings.Join(md["fromName"], ",")
t := trace.Tracer{TraceID: traceID}
t.In(s.serverName, fromName)
defer t.Out(fromName, s.serverName, time.Now())
reply := new(geo.GeoReply)
for _, loc := range s.locations {
if inRange(loc.Point, rect) {
reply.HotelIds = append(reply.HotelIds, loc.HotelID)
}
}
return reply, nil
}
示例7: VerifyToken
// VerifyToken finds a customer by authentication token.
func (s *authServer) VerifyToken(ctx context.Context, args *auth.AuthRequest) (*auth.AuthReply, error) {
md, _ := metadata.FromContext(ctx)
traceID := strings.Join(md["traceID"], ",")
fromName := strings.Join(md["fromName"], ",")
t := trace.Tracer{TraceID: traceID}
t.In(s.serverName, fromName)
defer t.Out(fromName, s.serverName, time.Now())
customer := s.customers[args.AuthToken]
if customer == nil {
return &auth.AuthReply{}, errors.New("Invalid Token")
}
reply := new(auth.AuthReply)
reply.Customer = customer
return reply, nil
}
示例8: GetRates
// GetRates gets rates for hotels for specific date range.
func (s *rateServer) GetRates(ctx context.Context, args *rate.RateRequest) (*rate.RateReply, error) {
md, _ := metadata.FromContext(ctx)
traceID := strings.Join(md["traceID"], ",")
fromName := strings.Join(md["fromName"], ",")
t := trace.Tracer{TraceID: traceID}
t.In(s.serverName, fromName)
defer t.Out(fromName, s.serverName, time.Now())
reply := new(rate.RateReply)
for _, hotelID := range args.HotelIds {
k := stay{hotelID, args.InDate, args.OutDate}
if s.rates[k] == nil {
continue
}
reply.RatePlans = append(reply.RatePlans, s.rates[k])
}
return reply, nil
}