From 300df835e9f33937b515edcaa69d6f95854cf4be Mon Sep 17 00:00:00 2001 From: Sreevani871 Date: Mon, 10 Aug 2020 22:42:28 +0530 Subject: [PATCH] bug fix: closing collector span processor first followed by writer close to avoid span loss Signed-off-by: Sreevani871 --- cmd/collector/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/collector/main.go b/cmd/collector/main.go index e67ad4447fc..2b38a732951 100644 --- a/cmd/collector/main.go +++ b/cmd/collector/main.go @@ -95,6 +95,9 @@ func main() { c.Start(collectorOpts) svc.RunAndThen(func() { + if err := c.Close(); err != nil { + logger.Error("failed to cleanly close the collector", zap.Error(err)) + } if closer, ok := spanWriter.(io.Closer); ok { err := closer.Close() if err != nil { @@ -102,9 +105,6 @@ func main() { } } - if err := c.Close(); err != nil { - logger.Error("failed to cleanly close the collector", zap.Error(err)) - } }) return nil },