fix access logging in gaiohttp worker #1193

Merged
merged 1 commit into from Feb 3, 2016

Projects

None yet

3 participants

@urbaniak
Contributor

Access logs were wrongly formatted when using gaiohttp worker

It also fixes the statsd instrumentation with this type of worker.

@benoitc benoitc commented on an outdated diff Jan 28, 2016
gunicorn/glogging.py
@@ -237,7 +237,10 @@ def log(self, lvl, msg, *args, **kwargs):
def atoms(self, resp, req, environ, request_time):
""" Gets atoms for log formating.
"""
- status = resp.status.split(None, 1)[0]
+ if type(resp.status) is int:
@benoitc
benoitc Jan 28, 2016 Owner

I would do :

status = resp.status
if isinstance(status, str): 
     status = status.split(None, 1)[0]

to be consistent with the style in gunicorn. Thoughts?

@benoitc
Owner
benoitc commented Jan 28, 2016

Good catch! Thanks.

Modulo the style bikesheeding, the patch looks fine for me. If you can do the change that would help :)

@urbaniak
Contributor

I've fixed the formatting.

Found also one more issue, which should be fixed in urbaniak@4f810ee

Let me know if that's appropriate for other workers.

@urbaniak
Contributor

Thought about that, done it that way because req_headers was written like that.

Should be good to go now ;)

@benoitc benoitc commented on an outdated diff Jan 28, 2016
gunicorn/instrument/statsd.py
@@ -93,9 +93,14 @@ def access(self, resp, req, environ, request_time):
"""
Logger.access(self, resp, req, environ, request_time)
duration_in_ms = request_time.seconds * 1000 + float(request_time.microseconds) / 10 ** 3
+ if type(resp.status) is int:
@benoitc
benoitc Jan 28, 2016 Owner

style should also be changed there :)

@benoitc
Owner
benoitc commented Jan 28, 2016

@urbaniak thanks! Once last change and we are good 👍

@tilgovi
Collaborator
tilgovi commented Feb 2, 2016

@urbaniak would you mind squashing the commits, please? You can just force push and keep the same PR.

@urbaniak
Contributor
urbaniak commented Feb 2, 2016

No prob, squashed.

Hope to get that released soon.

@tilgovi
Collaborator
tilgovi commented Feb 3, 2016

Thanks!

@tilgovi tilgovi merged commit d6a47e8 into benoitc:master Feb 3, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment