Skip to content

Commit

Permalink
Move _SUPPRESS_INTRUMENTATION key from instrumentation to api
Browse files Browse the repository at this point in the history
This will continue to be part of the internal API but live in the API
context package.
  • Loading branch information
owais committed Oct 9, 2021
1 parent 65528f7 commit 54a3040
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions opentelemetry-api/src/opentelemetry/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,9 @@ def detach(token: object) -> None:
_RUNTIME_CONTEXT.detach(token) # type: ignore
except Exception: # pylint: disable=broad-except
logger.error("Failed to detach context")


# FIXME This is a temporary location for the suppress instrumentation key.
# Once the decision around how to suppress instrumentation is made in the
# spec, this key should be moved accordingly.
_SUPPRESS_INSTRUMENTATION_KEY = create_key("suppress_instrumentation")
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@

from wrapt import ObjectProxy

from opentelemetry.context import create_key
from opentelemetry.context import _SUPPRESS_INSTRUMENTATION_KEY
from opentelemetry.trace import StatusCode

# FIXME This is a temporary location for the suppress instrumentation key.
# Once the decision around how to suppress instrumentation is made in the
# spec, this key should be moved accordingly.
_SUPPRESS_INSTRUMENTATION_KEY = create_key("suppress_instrumentation")


def extract_attributes_from_object(
obj: any, attributes: Sequence[str], existing: Dict[str, str] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@
from os import environ, linesep
from typing import Optional

from opentelemetry.context import Context, attach, detach, set_value
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY
from opentelemetry.context import (
_SUPPRESS_INSTRUMENTATION_KEY,
Context,
attach,
detach,
set_value,
)
from opentelemetry.sdk.environment_variables import (
OTEL_BSP_EXPORT_TIMEOUT,
OTEL_BSP_MAX_EXPORT_BATCH_SIZE,
Expand Down

0 comments on commit 54a3040

Please sign in to comment.