Skip to content

Commit

Permalink
cleanup tracer import
Browse files Browse the repository at this point in the history
  • Loading branch information
aMahanna committed Dec 3, 2023
1 parent d549251 commit eeb9a7a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions adbpyg_adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
)

if TRACING_ENABLED:
from opentelemetry import trace
from opentelemetry.trace import Tracer


class ADBPyG_Adapter(Abstract_ADBPyG_Adapter):
Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(
db: StandardDatabase,
controller: ADBPyG_Controller = ADBPyG_Controller(),
logging_lvl: Union[str, int] = logging.INFO,
tracer: Optional["trace.Tracer"] = None,
tracer: Optional["Tracer"] = None,
):
self.set_logging(logging_lvl)
self.set_tracer(tracer)
Expand Down Expand Up @@ -104,11 +104,13 @@ def set_logging(self, level: Union[int, str]) -> None:
"""
logger.setLevel(level)

def set_tracer(self, tracer: Optional["trace.Tracer"]) -> None:
def set_tracer(self, tracer: Optional["Tracer"]) -> None:
"""Set the OpenTelemetry tracer for the adapter instance. Requires
the `tracing` extra to be installed (i.e `pip install adbpyg-adapter[tracing]`).
:param tracer: The OpenTelemetry tracer instance.
:param tracer: The OpenTelemetry tracer instance. See
`adbpyg_adapter.tracing.create_tracer` for details on how to
create a tracer instance.
:type tracer: opentelemetry.trace.Tracer
:raise ImportError: If OpenTelemetry is not installed.
"""
Expand Down

0 comments on commit eeb9a7a

Please sign in to comment.