You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// HandleRPC implements per-RPC tracing and stats instrumentation.
func (c *statsHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
switch rs := rs.(type) {
case *stats.InHeader:
if rs.Client {
fmt.Printf(rs.Header)
}
case *stats.End:
ign := false
c.lock.RLock()
ign = c.ignore
c.lock.RUnlock()
if !ign {
duration := rs.EndTime.Sub(rs.BeginTime)
var st string
s, ok := status.FromError(rs.Error)
if ok {
st = s.Code().String()
}
c.results <- &callResult{rs.Error, st, duration, rs.EndTime}
if c.hasLog {
c.log.Debugw("Received RPC Stats",
"statsID", c.id, "code", st, "error", rs.Error,
"duration", duration, "stats", rs)
}
}
}
}
I have the response metadata coming on event *stats.InHeader and the rest of grpc stats on event *stats.End, I want to combine metadata and grpc stats into one struct object callResult at the end of the grpc call. I am quite not sure how to realize this.
The text was updated successfully, but these errors were encountered:
I have the response metadata coming on event *stats.InHeader and the rest of grpc stats on event *stats.End, I want to combine metadata and grpc stats into one struct object callResult at the end of the grpc call. I am quite not sure how to realize this.
The text was updated successfully, but these errors were encountered: