From aa914665f071155ea18cd1223eebc8bf852d16e7 Mon Sep 17 00:00:00 2001
From: Menghan Li <menghanl@google.com>
Date: Tue, 1 Nov 2016 14:13:31 -0700
Subject: [PATCH] add isclient to errorstats

---
 stats/stats.go      | 2 ++
 stats/stats_test.go | 3 +++
 2 files changed, 5 insertions(+)

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 <non-nil>")
 	}
+	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)
 	}