Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@

from wrapt import ObjectProxy

from opentelemetry.context import create_key
# pylint: disable=unused-import
from opentelemetry.context import _SUPPRESS_INSTRUMENTATION_KEY # noqa: F401
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
1 change: 0 additions & 1 deletion opentelemetry-sdk/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ include_package_data = True
install_requires =
opentelemetry-api == 1.6.0
opentelemetry-semantic-conventions == 0.25b0
opentelemetry-instrumentation == 0.25b0

[options.packages.find]
where = src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
OpenTelemetry SDK Configurator for Easy Instrumentation with Distros
"""

from abc import ABC, abstractmethod
from os import environ
from typing import Sequence, Tuple

Expand All @@ -27,7 +28,6 @@
OTEL_PYTHON_ID_GENERATOR,
OTEL_TRACES_EXPORTER,
)
from opentelemetry.instrumentation.configurator import BaseConfigurator
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor, SpanExporter
from opentelemetry.sdk.trace.id_generator import IdGenerator
Expand Down Expand Up @@ -140,7 +140,34 @@ def _initialize_components():
_init_tracing(trace_exporters, id_generator)


class _OTelSDKConfigurator(BaseConfigurator):
class _BaseConfigurator(ABC):
"""An ABC for configurators

Configurators are used to configure
SDKs (i.e. TracerProvider, MeterProvider, Processors...)
to reduce the amount of manual configuration required.
"""

_instance = None
_is_instrumented = False

def __new__(cls, *args, **kwargs):

if cls._instance is None:
cls._instance = object.__new__(cls, *args, **kwargs)

return cls._instance

@abstractmethod
def _configure(self, **kwargs):
"""Configure the SDK"""

def configure(self, **kwargs):
"""Configure the SDK"""
self._configure(**kwargs)


class _OTelSDKConfigurator(_BaseConfigurator):
"""A basic Configurator by OTel Python for initalizing OTel SDK components

Initializes several crucial OTel SDK components (i.e. TracerProvider,
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