Skip to content

Color-code SQL query "Timeline" stripes according to stacktrace #543

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

Merged
merged 3 commits into from
Feb 12, 2014

Conversation

wolfe
Copy link
Contributor

@wolfe wolfe commented Feb 9, 2014

The code is pretty simple except for the code to generate the colors, but that's isolated and thoroughly confirmed, though not unit tested. I'd be glad to adapt to your liking.

@@ -196,6 +198,10 @@ def process_response(self, request, response):
query['stacktrace'] = render_stacktrace(query['stacktrace'])
i += 1

if query['stacktrace'] not in trace_colors:
trace_colors[query['stacktrace']] = colors.next()
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't valid under Python 3, use next(colors). (Travis CI tells you about this problem.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Righto.

@aaugustin
Copy link
Contributor

Overall I like your approach. It's very simple yet effective.

However, the code could be a bit more elegant and robust.

Would you mind updating it according to my comments?

@wolfe
Copy link
Contributor Author

wolfe commented Feb 11, 2014

Thank you, Aymeric, for being so thorough with your code review!

aaugustin added a commit that referenced this pull request Feb 12, 2014
Color-code SQL query "Timeline" stripes according to stacktrace
@aaugustin aaugustin merged commit 8c690d7 into django-commons:master Feb 12, 2014
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this pull request Oct 2, 2016
Color-code SQL query "Timeline" stripes according to stacktrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants