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]:
352352        if  self .database_system  ==  "postgresql" :
353353            libpq_version  =  None 
354354            # 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 
360359
361360            # psycopg2 
362361            if  libpq_version  is  None :
@@ -365,7 +364,7 @@ def calculate_commenter_data(self) -> dict[str, Any]:
365364                    self .connect_module , "__libpq_version__" , None 
366365                )
367366
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 
369368            # won't get the libpq_version 
370369            if  libpq_version  is  not None :
371370                commenter_data .update ({"libpq_version" : libpq_version })
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments