File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
packages/service-library/src/servicelib Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 1919from opentelemetry .sdk .resources import Resource
2020from opentelemetry .sdk .trace import TracerProvider
2121from opentelemetry .sdk .trace .export import BatchSpanProcessor
22+ from servicelib .logging_utils import log_context
2223from settings_library .tracing import TracingSettings
2324
2425_logger = logging .getLogger (__name__ )
@@ -100,9 +101,17 @@ def setup_tracing(
100101 # Instrument aiohttp client
101102 AioHttpClientInstrumentor ().instrument ()
102103 if HAS_AIOPG :
103- AiopgInstrumentor ().instrument ()
104- _logger .info ("Added aiopg opentelemetry instrumentation." )
104+ with log_context (
105+ _logger ,
106+ logging .INFO ,
107+ msg = "Attempting to add aio-pika opentelemetry autoinstrumentation..." ,
108+ ):
109+ AiopgInstrumentor ().instrument ()
105110 if HAS_BOTOCORE :
106- BotocoreInstrumentor ().instrument ()
107- _logger .info ("Attempting to add botocore opentelemetry autoinstrumentation..." )
111+ with log_context (
112+ _logger ,
113+ logging .INFO ,
114+ msg = "Attempting to add botocore opentelemetry autoinstrumentation..." ,
115+ ):
116+ BotocoreInstrumentor ().instrument ()
108117 RequestsInstrumentor ().instrument ()
Original file line number Diff line number Diff line change 1717from settings_library .tracing import TracingSettings
1818
1919_logger = logging .getLogger (__name__ )
20- #########
20+
2121try :
2222 from opentelemetry .instrumentation .asyncpg import AsyncPGInstrumentor
2323
2424 HAS_ASYNCPG = True
2525except ImportError :
2626 HAS_ASYNCPG = False
27- #########
27+
2828try :
2929 from opentelemetry .instrumentation .aio_pika import AioPikaInstrumentor
3030
3131 HAS_AIOPIKA = True
3232except ImportError :
3333 HAS_AIOPIKA = False
34- #########
34+
3535try :
3636 from opentelemetry .instrumentation .aiopg import AiopgInstrumentor
3737
3838 HAS_AIOPG = True
3939except ImportError :
4040 HAS_AIOPG = False
41- #########
41+
4242try :
4343 from opentelemetry .instrumentation .redis import RedisInstrumentor
4444
4545 HAS_REDIS = True
4646except ImportError :
4747 HAS_REDIS = False
48+
4849try :
4950 from opentelemetry .instrumentation .botocore import BotocoreInstrumentor
5051
You can’t perform that action at this time.
0 commit comments