Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add details for determining the parent Span from a Context #423

Merged
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions specification/api-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Table of Contents
* [SpanContext](#spancontext)
* [Span](#span)
* [Span creation](#span-creation)
* [Parenting from a Context](#parenting-from-a-context)
mwear marked this conversation as resolved.
Show resolved Hide resolved
* [Add Links](#add-links)
* [Span operations](#span-operations)
* [Get Context](#get-context)
Expand Down Expand Up @@ -257,9 +258,11 @@ as a separate operation.
The API MUST accept the following parameters:

- The span name. This is a required parameter.
- The parent Span or parent Span context, and whether the new `Span` should be a
root `Span`. API MAY also have an option for implicit parent context
extraction from the current context as a default behavior.
- The parent `Span` or a `Context` containing a parent `Span` or `SpanContext`,
mwear marked this conversation as resolved.
Show resolved Hide resolved
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 [Parenting from a Context](#parenting-from-a-context) for guidance on
mwear marked this conversation as resolved.
Show resolved Hide resolved
`Span` parenting from explicit and implicit `Context`s.
- [`SpanKind`](#spankind), default to `SpanKind.Internal` if not specified.
- `Attribute`s - A collection of key-value pairs, with the same semantics as
the ones settable with [Span::SetAttributes](#set-attributes). Additionally,
Expand Down Expand Up @@ -290,6 +293,21 @@ created in another process. Each propagators' deserialization must set
`IsRemote` to true on a parent `SpanContext` so `Span` creation knows if the
parent is remote.

#### Parenting from a Context

When a new `Span` is created from a `Context` the `Context` may contain:
mwear marked this conversation as resolved.
Show resolved Hide resolved

- 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`.

#### Add Links

During the `Span` creation user MUST have the ability to record links to other `Span`s. Linked
Expand Down