--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_apm/include.py Tue Sep 18 17:38:43 2018 +0200
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# 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'
+
+
+# import standard library
+
+# import interfaces
+from pyramid.interfaces import IApplicationCreated
+
+# import packages
+import elasticapm
+from elasticapm.instrumentation import register
+from pyramid.events import subscriber
+
+
+@subscriber(IApplicationCreated)
+def handle_apm_application(event):
+ register.register('pyams_apm.packages.chameleon.ChameleonCookingInstrumentation')
+ register.register('pyams_apm.packages.chameleon.ChameleonRenderingInstrumentation')
+ elasticapm.instrument()
+
+
+def include_package(config):
+ """Pyramid package include"""
+
+ # add APM tween
+ config.add_tween('pyams_apm.tween.elastic_apm_tween_factory')
+
+ # scan package
+ config.scan()