diff --git a/CHANGELOG.md b/CHANGELOG.md index a532bba5e0d..5309206b274 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ release. New: +- Add Suppress Instrumentation context key + ([#1653](https://github.com/open-telemetry/opentelemetry-specification/pull/1653)) - Add Metadata for Baggage entries, and clarify W3C Baggage Propagator implementation ([#1066](https://github.com/open-telemetry/opentelemetry-specification/pull/1066)) - Change Status to be consistent with Link and Event diff --git a/specification/context/context.md b/specification/context/context.md index 7824713ce7c..56a460d2200 100644 --- a/specification/context/context.md +++ b/specification/context/context.md @@ -13,6 +13,8 @@ Table of Contents - [Get current Context](#get-current-context) - [Attach Context](#attach-context) - [Detach Context](#detach-context) +- [Predefined Keys](#predefined-keys) + - [Suppress Instrumentation](#suppress-instrumentation) @@ -123,3 +125,26 @@ The API MUST accept the following parameters: The API MAY return a value used to check whether the operation was successful or not. + +## Predefined Keys + +The following are predefined keys that may modify the behavior of multiple signals. +For each key, there MUST be corresponding methods to set and get its value. +The key itself MUST NOT be exposed publicly. + +### Suppress Instrumentation + +In some cases it may be useful to temporarily disable instrumentation. +For example, this may be used to prevent span exports from being traced and exported, +or by an instrumentation which wraps a lower-level package which may also be +instrumented in order to prevent duplicate spans. + +If this key is set to `true`, the following behavior is changed: + +- Any `Span` created by `StartSpan` MUST be a non-recording `Span`. +- `Propagator#Inject` MUST NOT modify the carrier. +- `Propagator#Extract` MUST return the `Context` passed to it as an argument unchanged. +- `Metrics` MUST NOT be recorded. + +If this key is not set it is assumed to be `false`. +The `get` method for this key MAY return `false` if the key is unset.