src/pyams_apm/packages/ldap3.py
changeset 5 6fb8165a78b9
parent 4 1718075e542c
child 8 1da0a6a483f9
--- a/src/pyams_apm/packages/ldap3.py	Wed Sep 19 11:03:57 2018 +0200
+++ b/src/pyams_apm/packages/ldap3.py	Wed Sep 19 12:40:10 2018 +0200
@@ -19,7 +19,7 @@
 class LDAP3BindInstrumentation(AbstractInstrumentedModule):
     name = "ldap.bind"
 
-    instrument_list = [("ldap3.connection", "Connection.bind")]
+    instrument_list = [("ldap3", "Connection.bind")]
 
     def call(self, module, method, wrapped, instance, args, kwargs):
         with capture_span('LDAP.BIND', "db.ldap", leaf=True):
@@ -29,8 +29,13 @@
 class LDAP3SearchInstrumentation(AbstractInstrumentedModule):
     name = "ldap.search"
 
-    instrument_list = [("ldap3.connection", "Connection.search")]
+    instrument_list = [("ldap3", "Connection.search")]
 
     def call(self, module, method, wrapped, instance, args, kwargs):
-        with capture_span('LDAP.SEARCH', "db.ldap", leaf=True):
+        with capture_span('LDAP.SEARCH', "db.ldap", {
+            'db': {
+                'type': 'ldap',
+                'statement': kwargs.get('search_filter') or args[1]
+            }
+        }, leaf=True):
             return wrapped(*args, **kwargs)