Skip to content

Commit

Permalink
Spans's parent must be passed as Context instead of Span(Context)s. (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
Oberon00 authored Sep 23, 2020
1 parent a67bd5a commit 868570c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Updates:
([#911](https://github.com/open-telemetry/opentelemetry-specification/pull/911))
- Explicitly specify the SpanContext APIs IsValid and IsRemote as required
([#914](https://github.com/open-telemetry/opentelemetry-specification/pull/914))
- A full `Context` is the only way to specify a parent of a `Span`.
`SpanContext` or even `Span` are not allowed anymore.
([#875](https://github.com/open-telemetry/opentelemetry-specification/pull/875))
- Remove obsolete `http.status_text` from semantic conventions
([#972](https://github.com/open-telemetry/opentelemetry-specification/pull/972))
- SDK: Rename the `Decision` values for `SamplingResult`s to `DROP`, `RECORD_ONLY`
Expand Down
18 changes: 7 additions & 11 deletions specification/trace/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,24 +307,20 @@ directly. All `Span`s MUST be created via a `Tracer`.

There MUST NOT be any API for creating a `Span` other than with a [`Tracer`](#tracer).

When creating a new `Span`, the `Tracer` MUST allow the caller to specify the
new `Span`'s parent in the form of a `Span` or `SpanContext`. The `Tracer`
SHOULD create each new `Span` as a child of its active `Span`, unless an
explicit parent is provided or the option to create a span without a parent is
selected.

`Span` creation MUST NOT set the newly created `Span` as the currently
active `Span` by default, but this functionality MAY be offered additionally
as a separate operation.

The API MUST accept the following parameters:

- The span name. This is a required parameter.
- The parent `Span` or a `Context` containing a parent `Span` or `SpanContext`,
and whether the new `Span` should be a root `Span`. API MAY also have an
option for implicit parenting from the current context as a default behavior.
See [Determining the Parent Span from a Context](#determining-the-parent-span-from-a-context)
for guidance on `Span` parenting from explicit and implicit `Context`s.
- The parent `Context` or an indication that the new `Span` should be a root `Span`.
The API MAY also have an option for implicitly using
the current Context as parent as a default behavior.
This API MUST NOT accept a `Span` or `SpanContext` as parent, only a full `Context`.

The semantic parent of the Span MUST be determined according to the rules
described in [Determining the Parent Span from a Context](#determining-the-parent-span-from-a-context).
- [`SpanKind`](#spankind), default to `SpanKind.Internal` if not specified.
- [`Attributes`](../common/common.md#attributes). Additionally,
these attributes may be used to make a sampling decision as noted in [sampling
Expand Down
7 changes: 5 additions & 2 deletions specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,19 +276,22 @@ in the SDK:

### Interface definition

#### OnStart(Span)
#### OnStart

`OnStart` is called when a span is started. This method is called synchronously
on the thread that started the span, therefore it should not block or throw
exceptions.

**Parameters:**

* `Span` - a [read/write span object](#additional-span-interfaces) for the started span.
* `span` - a [read/write span object](#additional-span-interfaces) for the started span.
It SHOULD be possible to keep a reference to this span object and updates to the span
SHOULD be reflected in it.
For example, this is useful for creating a SpanProcessor that periodically
evaluates/prints information about all active span from a background thread.
* `parentContext` - the parent `Context` of the span that the SDK determined
(the explicitly passed `Context`, the current `Context` or an empty `Context`
if that was explicitly requested).

**Returns:** `Void`

Expand Down

0 comments on commit 868570c

Please sign in to comment.