diff --git a/stats/stats.go b/stats/stats.go index b6062917..5a175d26 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -144,6 +144,8 @@ func (s *OutgoingTrailerStats) isStats() {} // ErrorStats indicates an error happens. type ErrorStats struct { + // IsClient indicates if this stats is a client stats. + IsClient bool // Error is the error just happened. Its type is gRPC error. Error error } diff --git a/stats/stats_test.go b/stats/stats_test.go index 1eacf9af..6a8bb9fe 100644 --- a/stats/stats_test.go +++ b/stats/stats_test.go @@ -474,6 +474,9 @@ func checkErrorStats(t *testing.T, d *gotData, e *expectedData) { if d.ctx == nil { t.Fatalf("d.ctx = nil, want ") } + if st.IsClient { + t.Fatalf("st IsClient = true, want false") + } if grpc.Code(st.Error) != grpc.Code(e.err) || grpc.ErrorDesc(st.Error) != grpc.ErrorDesc(e.err) { t.Fatalf("st.Error = %v, want %v", st.Error, e.err) }