Skip to content

Commit

Permalink
fix conditional tikv dependency usage on telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem committed Nov 27, 2023
1 parent bacd9c0 commit 9666e77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.33.0
2.34.0
11 changes: 8 additions & 3 deletions nucliadb_telemetry/nucliadb_telemetry/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from nucliadb_telemetry.batch_span import BatchSpanProcessor
from nucliadb_telemetry.jaeger import JaegerExporterAsync
from nucliadb_telemetry.settings import telemetry_settings
from nucliadb_telemetry.tikv import TiKVInstrumentor
from nucliadb_telemetry.tracerprovider import (
AsyncMultiSpanProcessor,
AsyncTracerProvider,
Expand Down Expand Up @@ -121,13 +120,19 @@ async def setup_telemetry(service_name: str) -> Optional[AsyncTracerProvider]:
if tracer_provider is not None: # pragma: no cover
await init_telemetry(tracer_provider)
set_global_textmap(B3MultiFormat())
TiKVInstrumentor().instrument(tracer_provider=tracer_provider)

try:
from nucliadb_telemetry.tikv import TiKVInstrumentor

TiKVInstrumentor().instrument(tracer_provider=tracer_provider)
except ImportError: # pragma: no cover
pass
try:
from opentelemetry.instrumentation.aiohttp_client import ( # type: ignore
AioHttpClientInstrumentor,
)

AioHttpClientInstrumentor().instrument(tracer_provider=tracer_provider)
except ImportError:
except ImportError: # pragma: no cover
pass
return tracer_provider

0 comments on commit 9666e77

Please sign in to comment.