From 651214156d1f45114933c6c48be87892443783d4 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Fri, 12 Nov 2021 16:55:38 -0700 Subject: [PATCH 1/2] no-op StartSpan: always return the parent --- specification/trace/api.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/specification/trace/api.md b/specification/trace/api.md index 603ffba9142..8205af87b9a 100644 --- a/specification/trace/api.md +++ b/specification/trace/api.md @@ -790,14 +790,13 @@ for how propagators are to be distributed. ## Behavior of the API in the absence of an installed SDK In general, in the absence of an installed SDK, the Trace API is a "no-op" API. -This means that operations on a Tracer, or on Spans, should have no side effects and do nothing. However, there -is one important exception to this general rule, and that is related to propagation of a `SpanContext`: -The API MUST create a [non-recording Span](#wrapping-a-spancontext-in-a-span) with the `SpanContext` -that is in the `Span` in the parent `Context` (whether explicitly given or implicit current) or, -if the parent is a non-recording Span (which it usually always is if no SDK is present), -it MAY return the parent Span back from the creation method. -If the parent `Context` contains no `Span`, an empty non-recording Span MUST be returned instead -(i.e., having a `SpanContext` with all-zero Span and Trace IDs, empty Tracestate, and unsampled TraceFlags). -This means that a `SpanContext` that has been provided by a configured `Propagator` -will be propagated through to any child span and ultimately also `Inject`, -but that no new `SpanContext`s will be created. +This means that operations on a Tracer, or on Spans, should have no side effects +and do nothing. However, there is one important exception to this general rule, +and that is related to propagation of a `SpanContext`: The API MUST return the +`Span` in the parent `Context` (whether explicitly given or implicit current). +If the parent `Context` contains no `Span`, an empty non-recording Span MUST be +returned instead (i.e., having a `SpanContext` with all-zero Span and Trace IDs, +empty Tracestate, and unsampled TraceFlags). This means that a `SpanContext` +that has been provided by a configured `Propagator` will be propagated through +to any child span and ultimately also `Inject`, but that no new `SpanContext`s +will be created. From b7a2ab9f966e7d79bc36c89056e37d6be2465a9a Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 1 Dec 2021 12:11:14 -0700 Subject: [PATCH 2/2] Update specification/trace/api.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christian Neumüller --- specification/trace/api.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/specification/trace/api.md b/specification/trace/api.md index 72e973431f4..fb54ee5654c 100644 --- a/specification/trace/api.md +++ b/specification/trace/api.md @@ -797,8 +797,10 @@ for how propagators are to be distributed. In general, in the absence of an installed SDK, the Trace API is a "no-op" API. This means that operations on a Tracer, or on Spans, should have no side effects and do nothing. However, there is one important exception to this general rule, -and that is related to propagation of a `SpanContext`: The API MUST return the -`Span` in the parent `Context` (whether explicitly given or implicit current). +and that is related to propagation of a `SpanContext`: The API MUST return a +non-recording `Span` with the `SpanContext` in the parent `Context` (whether explicitly given or implicit current). +If the `Span` in the parent `Context` is already non-recording, it SHOULD be returned directly +without instantiating a new `Span`. If the parent `Context` contains no `Span`, an empty non-recording Span MUST be returned instead (i.e., having a `SpanContext` with all-zero Span and Trace IDs, empty Tracestate, and unsampled TraceFlags). This means that a `SpanContext`