From 71bcb63b60f05cc1755b15f62fc2dc5d280e3c5e Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 23 Apr 2024 00:24:46 +0300 Subject: [PATCH] fixup trace stream Signed-off-by: Vasiliy Tolstov --- stream.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stream.go b/stream.go index 8108e17..00cf622 100644 --- a/stream.go +++ b/stream.go @@ -6,6 +6,7 @@ import ( "sync" "go.unistack.org/micro/v3/client" + "go.unistack.org/micro/v3/tracer" "google.golang.org/grpc" ) @@ -111,6 +112,12 @@ func (g *grpcStream) Close() error { return nil } + if sp, ok := tracer.SpanFromContext(g.context); ok && sp != nil { + if g.err != nil { + sp.SetStatus(tracer.SpanStatusError, g.err.Error()) + } + sp.Finish() + } // close the connection g.closed = true g.close(g.err)