File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -352,11 +352,10 @@ def calculate_commenter_data(self) -> dict[str, Any]:
352
352
if self .database_system == "postgresql" :
353
353
libpq_version = None
354
354
# psycopg
355
- if hasattr (self .connect_module , "pq" ):
356
- try :
357
- libpq_version = self .connect_module .pq .version ()
358
- except Exception : # pylint: disable=broad-exception-caught
359
- pass
355
+ try :
356
+ libpq_version = self .connect_module .pq .version ()
357
+ except AttributeError :
358
+ pass
360
359
361
360
# psycopg2
362
361
if libpq_version is None :
@@ -365,7 +364,7 @@ def calculate_commenter_data(self) -> dict[str, Any]:
365
364
self .connect_module , "__libpq_version__" , None
366
365
)
367
366
368
- # psycopg also instrument modules that are not the root one, in that case you
367
+ # we instrument psycopg modules that are not the root one, in that case you
369
368
# won't get the libpq_version
370
369
if libpq_version is not None :
371
370
commenter_data .update ({"libpq_version" : libpq_version })
You can’t perform that action at this time.
0 commit comments