From 67f4476d4a48b2b1508d6093aa29dfec7ba60821 Mon Sep 17 00:00:00 2001 From: Grunet Date: Wed, 6 Jul 2022 11:09:09 -0500 Subject: [PATCH] Make clear that context is not mutable when setting a span (#2637) * Make clear that context is not mutable when setting a span * Avoid making the copy seem mutable * Update the summary line to also not sound like Context is mutable --- CHANGELOG.md | 1 + specification/trace/api.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd8ab7f83bb..7752515b01b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ release. - Clarify the return of `Export(batch)` in the Batch Span Processor and exporter concurrency ([#2452](https://github.com/open-telemetry/opentelemetry-specification/pull/2452)) +- Clarify that Context should not be mutable when setting a span ([#2637](https://github.com/open-telemetry/opentelemetry-specification/pull/2637)) ### Metrics diff --git a/specification/trace/api.md b/specification/trace/api.md index 570d938cd48..8254796d0b8 100644 --- a/specification/trace/api.md +++ b/specification/trace/api.md @@ -163,7 +163,7 @@ The API MUST provide the following functionality to interact with a `Context` instance: - Extract the `Span` from a `Context` instance -- Insert the `Span` to a `Context` instance +- Combine the `Span` with a `Context` instance, creating a new `Context` instance The functionality listed above is necessary because API users SHOULD NOT have access to the [Context Key](../context/README.md#create-a-key) used by the Tracing API implementation. @@ -173,7 +173,7 @@ If the language has support for implicitly propagated `Context` (see the following functionality: - Get the currently active span from the implicit context. This is equivalent to getting the implicit context, then extracting the `Span` from the context. -- Set the currently active span to the implicit context. This is equivalent to getting the implicit context, then inserting the `Span` to the context. +- Set the currently active span into a new context, and make that the implicit context. This is equivalent to combining the current implicit context's values with the `Span` to create a new context, which is then made the current implicit context. All the above functionalities operate solely on the context API, and they MAY be exposed as either static methods on the trace module, or as static methods on a class