diff --git a/CHANGELOG.md b/CHANGELOG.md index b6733bd6243..7aab723ca50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,8 @@ Updates: and `RECORD_AND_SAMPLE` for consistency ([#938](https://github.com/open-telemetry/opentelemetry-specification/pull/938), [#956](https://github.com/open-telemetry/opentelemetry-specification/pull/956)) +- Move active span interaction in the Trace API to a separate class + ([#923](https://github.com/open-telemetry/opentelemetry-specification/pull/923)) - Metrics SDK: Specify LastValue default aggregation for ValueObserver ([#984](https://github.com/open-telemetry/opentelemetry-specification/pull/984) - Metrics SDK: Specify TBD default aggregation for ValueRecorder diff --git a/spec-compliance-matrix.md b/spec-compliance-matrix.md index 74b052eb6e9..7ecc5a8ddf7 100644 --- a/spec-compliance-matrix.md +++ b/spec-compliance-matrix.md @@ -15,6 +15,9 @@ status of the feature is not known. |Create TracerProvider | + | + | + | + | + | + | + | + | + | + | |Get a Tracer | + | + | + | + | + | + | + | + | + | + | |Safe for concurrent calls | + | + | + | | + | + | + | + | + | + | +|[Tracing Context Utilities](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#tracing-context-utilities)| +|Get active Span | | | | + | | | | | | | +|Set active Span | | | | + | | | | | | | |[Tracer](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#tracer-operations)| |Create a new Span | + | + | + | + | + | + | + | + | + | + | |Get active Span | + | + | + | + | + | + | + | + | + | + | diff --git a/specification/trace/api.md b/specification/trace/api.md index f149215c25b..35b4f3706e7 100644 --- a/specification/trace/api.md +++ b/specification/trace/api.md @@ -11,6 +11,7 @@ Table of Contents * [Duration](#duration) * [TracerProvider](#tracerprovider) * [TracerProvider operations](#tracerprovider-operations) +* [Tracing Context Utilities](#tracing-context-utilities) * [Tracer](#tracer) * [Tracer operations](#tracer-operations) * [SpanContext](#spancontext) @@ -129,6 +130,22 @@ the tracer could, for example, do a look-up with its name+version in a map in the `TracerProvider`, or the `TracerProvider` could maintain a registry of all returned `Tracer`s and actively update their configuration if it changes. +## Tracing Context Utilities + +`Tracing Context Utilities` contains all operations within tracing that +modify the [`Context`](../context/context.md). + +As these utilities operate solely on the context API, they MAY be exposed +as static methods on the trace module instead of a class. + +The `Tracing Context Utilities` MUST provide the following functions: + +- Get the currently active span +- Set the currently active span + +The above methods MUST be equivalent to a single parameterized method call of +the [`Context`](../context/context.md) management system. + ## Tracer The tracer is responsible for creating `Span`s. @@ -142,17 +159,12 @@ The `Tracer` MUST provide functions to: - [Create a new `Span`](#span-creation) (see the section on `Span`) -The `Tracer` SHOULD provide methods to: +The `Tracer` MAY provide functions to: -- Get the currently active `Span` -- Mark a given `Span` as active +- Get the currently active span +- Set the currently active span -The `Tracer` MUST delegate to the [`Context`](../context/context.md) to perform -these tasks, i.e. the above methods MUST do the same as a single equivalent -method of the Context management system. -In particular, this implies that the active span MUST not depend on the `Tracer` -that it is queried from/was set to, as long as the tracers were obtained from -the same `TracerProvider`. +These functions MUST delegate to the `Tracing Context Utilities`. ## SpanContext