equal
deleted
inserted
replaced
15 This module provides a custom tween which is used to integrate the Pyramid application |
15 This module provides a custom tween which is used to integrate the Pyramid application |
16 with APM, sending requests frames to the APM server. |
16 with APM, sending requests frames to the APM server. |
17 """ |
17 """ |
18 |
18 |
19 import sys |
19 import sys |
|
20 import pkg_resources |
20 |
21 |
21 import elasticapm |
22 import elasticapm |
22 import pkg_resources |
|
23 from elasticapm.utils import compat, get_url_dict |
23 from elasticapm.utils import compat, get_url_dict |
24 from pkg_resources import DistributionNotFound |
|
25 from pyramid.compat import reraise |
24 from pyramid.compat import reraise |
26 from pyramid.settings import asbool |
25 from pyramid.settings import asbool |
27 |
26 |
28 __docformat__ = 'restructuredtext' |
27 __docformat__ = 'restructuredtext' |
29 |
28 |
73 config = registry.settings |
72 config = registry.settings |
74 service_version = config.get("elasticapm.service_version") |
73 service_version = config.get("elasticapm.service_version") |
75 if service_version: |
74 if service_version: |
76 try: |
75 try: |
77 service_version = pkg_resources.get_distribution(service_version).version |
76 service_version = pkg_resources.get_distribution(service_version).version |
78 except DistributionNotFound: |
77 except pkg_resources.DistributionNotFound: |
79 pass |
78 pass |
80 self.client = elasticapm.Client( |
79 self.client = elasticapm.Client( |
81 server_url=config.get("elasticapm.server_url"), |
80 server_url=config.get("elasticapm.server_url"), |
82 server_timeout=config.get("elasticapm.server_timeout"), |
81 server_timeout=config.get("elasticapm.server_timeout"), |
83 name=config.get("elasticapm.name"), |
82 name=config.get("elasticapm.name"), |