diff --git a/src/pyramid_elasticapm/__init__.py b/src/pyramid_elasticapm/__init__.py index 1afe722..ccac4f3 100644 --- a/src/pyramid_elasticapm/__init__.py +++ b/src/pyramid_elasticapm/__init__.py @@ -5,6 +5,7 @@ import elasticapm import pkg_resources from elasticapm.utils import get_url_dict +from elasticapm.utils.disttracing import TraceParent from pyramid._compat import reraise from pyramid.events import ApplicationCreated, subscriber @@ -65,7 +66,9 @@ def __init__(self, handler, registry): ) def __call__(self, request): - self.client.begin_transaction('request') + self.client.begin_transaction( + 'request', TraceParent.from_headers(request.headers) + ) transaction_result = '' response = None try: diff --git a/src/pyramid_elasticapm/tests/test_plugin.py b/src/pyramid_elasticapm/tests/test_plugin.py index fb91fca..e7a3b44 100644 --- a/src/pyramid_elasticapm/tests/test_plugin.py +++ b/src/pyramid_elasticapm/tests/test_plugin.py @@ -31,7 +31,9 @@ def test_get(apmserver): app = TestApp(make_app(apmserver.url)) - resp = app.get('/') + resp = app.get( + url='/', + ) resp.mustcontain(b'{"status": "ok"}') # Give the apm integration some time to send requests to the apm server @@ -48,7 +50,10 @@ def test_post(apmserver): app = TestApp(make_app(apmserver.url)) - resp = app.post('/', dict(foo='bar')) + resp = app.post( + url='/', + params=dict(foo='bar'), + ) resp.mustcontain(b'{"status": "ok"}') # Give the apm integration some time to send requests to the apm server