Skip to content

Commit

Permalink
Define Propagation-only Span to simplify active Span logic in Context. (
Browse files Browse the repository at this point in the history
#994)

* Define DefaultSpan to simplify active Span in Context.

* Update CHANGELOG.

* Update specification/trace/api.md

Co-authored-by: Christian Neumüller <christian+github@neumueller.me>

* Update specification/trace/api.md

Co-authored-by: Christian Neumüller <christian+github@neumueller.me>

* Apply feedback.

* Specify the SDK must not override it.

* Update CHANGELOG.

* Rename to PropagatedSpan.

* More feedback.

Co-authored-by: Christian Neumüller <christian+github@neumueller.me>
  • Loading branch information
carlosalberto and Oberon00 authored Sep 24, 2020
1 parent 30eb18a commit d14c9b7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ New:
[#946](https://github.com/open-telemetry/opentelemetry-specification/pull/946))
- Update the header name for otel baggage, and version date
([#981](https://github.com/open-telemetry/opentelemetry-specification/pull/981))
- Define PropagationOnly Span to simplify active Span logic in Context
([#994](https://github.com/open-telemetry/opentelemetry-specification/pull/994))

Updates:

Expand Down
36 changes: 25 additions & 11 deletions specification/trace/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Table of Contents
* [End](#end)
* [Record Exception](#record-exception)
* [Span lifetime](#span-lifetime)
* [Propagated Span creation](#propagated-span-creation)
* [Status](#status)
* [StatusCanonicalCode](#statuscanonicalcode)
* [Status creation](#status-creation)
Expand Down Expand Up @@ -363,18 +364,13 @@ parent is remote.

#### Determining the Parent Span from a Context

When a new `Span` is created from a `Context`, the `Context` may contain:
When a new `Span` is created from a `Context`, the `Context` may contain a `Span`
representing the currently active instance, and will be used as parent.
If there is no `Span` in the `Context`, the newly created `Span` will be a root span.

- A current `Span`
- An extracted `SpanContext`
- A current `Span` and an extracted `SpanContext`
- Neither a current `Span` nor an extracted `Span` context

The parent should be selected in the following order of precedence:

- Use the current `Span`, if available.
- Use the extracted `SpanContext`, if available.
- There is no parent. Create a root `Span`.
A `SpanContext` cannot be set as active in a `Context` directly, but through the use
of a [Propagated Span](#propagated-span-creation) wrapping it.
For example, a `Propagator` performing context extraction may need this.

#### Add Links

Expand Down Expand Up @@ -577,6 +573,24 @@ timestamps to the Span object:
Start and end time as well as Event's timestamps MUST be recorded at a time of a
calling of corresponding API.

### Propagated Span creation

The API MUST provide an operation for wrapping a `SpanContext` with an object
implementing the `Span` interface. This is done in order to expose a `SpanContext`
as a `Span` in operations such as in-process `Span` propagation.

If a new type is required for supporting this operation, it SHOULD be named `PropagatedSpan`.

The behavior is defined as follows:

- `GetContext()` MUST return the wrapped `SpanContext`.
- `IsRecording` MUST return `false` to signal that events, attributes and other elements
are not being recorded, i.e. they are being dropped.

The remaining functionality of `Span` MUST be defined as no-op operations.

This functionality MUST be fully implemented in the API, and SHOULD NOT be overridable.

## Status

`Status` interface represents the status of a finished `Span`. It's composed of
Expand Down

0 comments on commit d14c9b7

Please sign in to comment.