# HG changeset patch # User Thierry Florac # Date 1537347837 -7200 # Node ID 1718075e542c242c9d850698ce0c9293d74a8d57 # Parent 92747d62447f1745a2b4d9e7c717a0d7ac47b844 Added missing module diff -r 92747d62447f -r 1718075e542c src/pyams_apm/packages/ldap3.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_apm/packages/ldap3.py Wed Sep 19 11:03:57 2018 +0200 @@ -0,0 +1,36 @@ +# +# Copyright (c) 2008-2017 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + +from elasticapm.instrumentation.packages.base import AbstractInstrumentedModule +from elasticapm.traces import capture_span + + +class LDAP3BindInstrumentation(AbstractInstrumentedModule): + name = "ldap.bind" + + instrument_list = [("ldap3.connection", "Connection.bind")] + + def call(self, module, method, wrapped, instance, args, kwargs): + with capture_span('LDAP.BIND', "db.ldap", leaf=True): + return wrapped(*args, **kwargs) + + +class LDAP3SearchInstrumentation(AbstractInstrumentedModule): + name = "ldap.search" + + instrument_list = [("ldap3.connection", "Connection.search")] + + def call(self, module, method, wrapped, instance, args, kwargs): + with capture_span('LDAP.SEARCH', "db.ldap", leaf=True): + return wrapped(*args, **kwargs)