Skip to content

Commit ca7480a

Browse files
committed
@pcrespov change requests
1 parent 1e27f5c commit ca7480a

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

packages/service-library/src/servicelib/aiohttp/tracing.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from opentelemetry.sdk.resources import Resource
2020
from opentelemetry.sdk.trace import TracerProvider
2121
from opentelemetry.sdk.trace.export import BatchSpanProcessor
22+
from servicelib.logging_utils import log_context
2223
from 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()

packages/service-library/src/servicelib/fastapi/tracing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,35 @@
1717
from settings_library.tracing import TracingSettings
1818

1919
_logger = logging.getLogger(__name__)
20-
#########
20+
2121
try:
2222
from opentelemetry.instrumentation.asyncpg import AsyncPGInstrumentor
2323

2424
HAS_ASYNCPG = True
2525
except ImportError:
2626
HAS_ASYNCPG = False
27-
#########
27+
2828
try:
2929
from opentelemetry.instrumentation.aio_pika import AioPikaInstrumentor
3030

3131
HAS_AIOPIKA = True
3232
except ImportError:
3333
HAS_AIOPIKA = False
34-
#########
34+
3535
try:
3636
from opentelemetry.instrumentation.aiopg import AiopgInstrumentor
3737

3838
HAS_AIOPG = True
3939
except ImportError:
4040
HAS_AIOPG = False
41-
#########
41+
4242
try:
4343
from opentelemetry.instrumentation.redis import RedisInstrumentor
4444

4545
HAS_REDIS = True
4646
except ImportError:
4747
HAS_REDIS = False
48+
4849
try:
4950
from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
5051

0 commit comments

Comments
 (0)