Updated LDAP module
authorThierry Florac <tflorac@ulthar.net>
Wed, 19 Sep 2018 12:40:10 +0200
changeset 5 6fb8165a78b9
parent 4 1718075e542c
child 6 66256b7cfc02
Updated LDAP module
src/pyams_apm/packages/ldap3.py
--- 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)