Skip to content

Commit 4f3c671

Browse files
committed
Add Suppress Instrumentation context key
1 parent 5a19b53 commit 4f3c671

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ release.
1111

1212
- Added `OTEL_EXPORTER_JAEGER_TIMEOUT` environment variable. ([#1612](https://github.com/open-telemetry/opentelemetry-specification/pull/1612))
1313
- Added `OTEL_EXPORTER_ZIPKIN_TIMEOUT` environment variable. ([#1636](https://github.com/open-telemetry/opentelemetry-specification/pull/1636))
14+
- Added Suppress Instrumentation context key. ([#1653](https://github.com/open-telemetry/opentelemetry-specification/pull/1653))
1415

1516
### Traces
1617

specification/context/context.md

+25
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Table of Contents
1515
- [Get current Context](#get-current-context)
1616
- [Attach Context](#attach-context)
1717
- [Detach Context](#detach-context)
18+
- [Predefined Keys](#predefined-keys)
19+
- [Suppress Instrumentation](#suppress-instrumentation)
1820

1921
</details>
2022

@@ -125,3 +127,26 @@ The API MUST accept the following parameters:
125127

126128
The API MAY return a value used to check whether the operation
127129
was successful or not.
130+
131+
## Predefined Keys
132+
133+
The following are predefined keys that may modify the behavior of multiple signals.
134+
For each key, there MUST be corresponding methods to set and get its value.
135+
The key itself MUST NOT be exposed publicly.
136+
137+
### Suppress Instrumentation
138+
139+
In some cases it may be useful to temporarily disable instrumentation.
140+
For example, this may be used to prevent span exports from being traced and exported,
141+
or by an instrumentation which wraps a lower-level package which may also be
142+
instrumented in order to prevent duplicate spans.
143+
144+
If this key is set to `true`, the following behavior is changed:
145+
146+
- Any `Span` created by `StartSpan` MUST be a non-recording `Span`.
147+
- `Propagator#Inject` MUST NOT modify the carrier.
148+
- `Propagator#Extract` MUST return the `Context` passed to it as an argument unchanged.
149+
- `Metrics` MUST NOT be recorded.
150+
151+
If this key is not set it is assumed to be `false`.
152+
The `get` method for this key MAY return `false` if the key is unset.

0 commit comments

Comments
 (0)