diff --git a/CHANGELOG.md b/CHANGELOG.md index de9cfafe977..53a457352d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Added `Marshler` config option to `otlphttp` to enable otlp over json or protobufs. (#1586) - A `ForceFlush` method to the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` to flush all registered `SpanProcessor`s. (#1608) + ### Changed - Update the `ForceFlush` method signature to the `"go.opentelemetry.io/otel/sdk/trace".SpanProcessor` to accept a `context.Context` and return an error. (#1608) @@ -26,6 +27,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 status to `Error` while recording an error as a span event in `RecordError`. (#1663) + ### Fixed diff --git a/sdk/trace/span.go b/sdk/trace/span.go index e6a1927a7d2..a747c82be83 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -258,14 +258,15 @@ 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. 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 } - 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 a50cc927a90..0d7b7a3b095 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -1167,7 +1167,7 @@ func TestRecordError(t *testing.T) { }, ParentSpanID: sid, Name: "span0", - StatusCode: codes.Error, + StatusCode: codes.Unset, SpanKind: trace.SpanKindInternal, HasRemoteParent: true, MessageEvents: []trace.Event{