Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle StreamingHttpResponse correctly #202

Closed
wants to merge 4 commits into from

Conversation

beniwohli
Copy link
Contributor

@beniwohli beniwohli commented Apr 24, 2018

Tests and (hopefully) fix for #201

middleware_attr = 'MIDDLEWARE' if getattr(django_settings, 'MIDDLEWARE', None) is not None else 'MIDDLEWARE_CLASSES'
middleware = getattr(django_settings, middleware_attr)
return ((not django_settings.DEBUG or client.config.debug) and
middleware and 'elasticapm.contrib.django.middleware.TracingMiddleware' in middleware)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line over-indented for visual indent


request_started.disconnect(dispatch_uid=REQUEST_START_DISPATCH_UID)
request_started.connect(
lambda sender, environ, **kwargs: client.begin_transaction('request') if _should_start_transaction(client) else None,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (125 > 120 characters)

@beniwohli beniwohli changed the title handle StreamingHttpResponse correctly [WIP] handle StreamingHttpResponse correctly Apr 27, 2018
@beniwohli beniwohli force-pushed the transaction-start-signal branch 3 times, most recently from 5a436c7 to dd59261 Compare May 1, 2018 09:45
…dlers

This fixes issues with Django's StreamingHttpResponse, which is only
consumed after passing through our TracingMiddleware.

This also made some API changes necessary, to allow setting the
transaction result before the end of the transaction, and allow to end
the transaction without providing a result and name.
…dlers

This fixes issues with Django's StreamingHttpResponse, which is only
consumed after passing through our TracingMiddleware.

This also made some API changes necessary, to allow setting the
transaction result before the end of the transaction, and allow to end
the transaction without providing a result and name.
This fixes issues with flask's streaming response, which is only
consumed after the request_finished signal is called.
@beniwohli beniwohli closed this in f47d08d May 7, 2018
beniwohli added a commit that referenced this pull request May 7, 2018
This fixes issues with flask's streaming response, which is only
consumed after the request_finished signal is called.

Django: moved starting/stopping of transaction into Django signal handlers

This fixes issues with Django's StreamingHttpResponse, which is only
consumed after passing through our TracingMiddleware.

This also made some API changes necessary, to allow setting the
transaction result before the end of the transaction, and allow to end
the transaction without providing a result and name.

closes #202
@beniwohli beniwohli deleted the transaction-start-signal branch May 7, 2018 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants