From 3ec32086ab62fdf94bd41534ff1666e2101da2fe Mon Sep 17 00:00:00 2001 From: Veera Pirla <17177346+veera83372@users.noreply.github.com> Date: Sat, 6 Mar 2021 03:44:36 +0530 Subject: [PATCH 1/5] Fix #1661 Removed setting error status while recording err as span event --- CHANGELOG.md | 3 ++- sdk/trace/span.go | 6 +++--- sdk/trace/trace_test.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eb3c8d2bcf..92022e41c47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## Added - Added `Marshler` config option to `otlphttp` to enable otlp over json or protobufs. (#1586) + ### Removed - Removed the exported `SimpleSpanProcessor` and `BatchSpanProcessor` structs. These are now returned as a SpanProcessor interface from their respective constructors. (#1638) - +- Removed setting `ErrorStatus` while recording err as span event in `RecordError`. (#1663) ## [0.18.0] - 2020-03-03 ### Added diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 0bb4155b83f..d372baddbf6 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -255,14 +255,14 @@ func (s *span) End(options ...trace.SpanOption) { } } -// RecordError will record err as a span event for this span. If this span is -// not being recorded or err is nil than this method does nothing. +// RecordError will record err as a span event for this span. This will +// not set error status to span. If this span is not being recorded or +// err is nil than this method does nothing. func (s *span) RecordError(err error, opts ...trace.EventOption) { if s == nil || err == nil || !s.IsRecording() { return } - s.SetStatus(codes.Error, "") opts = append(opts, trace.WithAttributes( errorTypeKey.String(typeStr(err)), errorMessageKey.String(err.Error()), diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 93dde22147c..8f2ba946bb1 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -1093,7 +1093,7 @@ func TestRecordError(t *testing.T) { }, ParentSpanID: sid, Name: "span0", - StatusCode: codes.Error, + StatusCode: codes.Unset, SpanKind: trace.SpanKindInternal, HasRemoteParent: true, MessageEvents: []trace.Event{ From 50481fae566f63307204deaf37f29b5ecbaa25a7 Mon Sep 17 00:00:00 2001 From: Veera Pirla <17177346+veera83372@users.noreply.github.com> Date: Sat, 6 Mar 2021 03:54:43 +0530 Subject: [PATCH 2/5] Update CHANGELOG.md Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92022e41c47..2fbd959df63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Removed the exported `SimpleSpanProcessor` and `BatchSpanProcessor` structs. These are now returned as a SpanProcessor interface from their respective constructors. (#1638) - Removed setting `ErrorStatus` while recording err as span event in `RecordError`. (#1663) + ## [0.18.0] - 2020-03-03 ### Added From 2bb17290690c82e8b98b50a26853ecc31b65afbd Mon Sep 17 00:00:00 2001 From: Veera Pirla <17177346+veera83372@users.noreply.github.com> Date: Sat, 6 Mar 2021 03:59:08 +0530 Subject: [PATCH 3/5] Update RecordError method doc Co-authored-by: Tyler Yahn --- sdk/trace/span.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/trace/span.go b/sdk/trace/span.go index d372baddbf6..f8f7124f004 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -256,7 +256,7 @@ func (s *span) End(options ...trace.SpanOption) { } // RecordError will record err as a span event for this span. This will -// not set error status to span. If this span is not being recorded or +// not set an error status to span. If this span is not being recorded or // err is nil than this method does nothing. func (s *span) RecordError(err error, opts ...trace.EventOption) { if s == nil || err == nil || !s.IsRecording() { From 6da6ce96a73ff05c09cf3fc38c2be300bfd27585 Mon Sep 17 00:00:00 2001 From: Veera Pirla <17177346+veera83372@users.noreply.github.com> Date: Sat, 6 Mar 2021 04:00:15 +0530 Subject: [PATCH 4/5] Fix grammatical errors in Changelog Co-authored-by: Tyler Yahn --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fbd959df63..f63c1ba45ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Removed the exported `SimpleSpanProcessor` and `BatchSpanProcessor` structs. These are now returned as a SpanProcessor interface from their respective constructors. (#1638) -- Removed setting `ErrorStatus` while recording err as span event in `RecordError`. (#1663) +- Removed setting status to `Error` while recording an error as a span event in `RecordError`. (#1663) + ## [0.18.0] - 2020-03-03 From 37eabd70af0220ed4f8e268c1e426031861239cc Mon Sep 17 00:00:00 2001 From: Veera Pirla <17177346+veera83372@users.noreply.github.com> Date: Sun, 7 Mar 2021 11:13:16 +0530 Subject: [PATCH 5/5] Update RecordError method doc --- sdk/trace/span.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/trace/span.go b/sdk/trace/span.go index f8f7124f004..4a662ff34e5 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -255,9 +255,10 @@ func (s *span) End(options ...trace.SpanOption) { } } -// RecordError will record err as a span event for this span. This will -// not set an error status to span. If this span is not being recorded or -// err is nil than this method does nothing. +// RecordError will record err as a span event for this span. An additional call to +// SetStatus is required if the Status of the Span should be set to Error, this method +// does not change the Span status. If this span is not being recorded or err is nil +// than this method does nothing. func (s *span) RecordError(err error, opts ...trace.EventOption) { if s == nil || err == nil || !s.IsRecording() { return