-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
Added a distribution tab to visualize request time distributions over time #281
base: master
Are you sure you want to change the base?
Conversation
…tion of the request timings, grouped either by date or revision. The default revision is taken from source control, however can be customized using the silk config for example to use a version number, or any other identifier.
… show the requests on the clicked group
…lter unit was in milliseconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'm not sure if
dealer
is the best package to use here. It's not very popular and there are more tested and up-to-date python libraries to introspect version control information. A lot of django production deployments also won't contain git repository data. - Tests currently don't pass and should be fixed.
requirements.txt
Outdated
@@ -11,3 +11,4 @@ Django>=1.11 | |||
freezegun>=0.3 | |||
factory-boy>=2.8.1 | |||
gprof2dot>=2016.10.13,<2017.09.19 | |||
dealer>=2.0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking out dealer, it seems dealer may be out of date. Have you tried testing with django >= 1.10 (klen/dealer#24)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take a look for an alternative to dealer
. I think the revision fuctionality is not that useful in production, at least we don't use it, we set SILKY_REVISION
to a version number in settings.py
. But it is quite useful for benchmarking locally, for example for comparing a number of commits. If I can't find a better alternative I guess another option is to just remove this dependency and let users set to the revision number using whichever method they prefer (probably nice to have an example in the readme)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check out the failing tests.
@@ -0,0 +1,102 @@ | |||
try: | |||
# Django>=1.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of fa1f542, django-silk does not support django<1.11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good, improves this code!
@@ -0,0 +1,199 @@ | |||
(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an unminified copy of url.min.js
? Do we need both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no, I will remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@albertyw I removed this unnecessary file
@@ -94,13 +94,13 @@ <h4>Profile</h4> | |||
value="OverallTimeFilter" | |||
name="filter-overalltime-typ"/> | |||
<input type="text" | |||
placeholder="seconds" | |||
placeholder="milliseconds" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a bugfix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is a typo fix, since the placeholder says 'seconds' but the filter actually accepts 'milliseconds', do you think it makes sense to make a separate PR for this?
silk/config.py
Outdated
timestamp = auto._repo.git('show -s --format=%at ' + revision) | ||
revision = ' # '.join([timestamp.decode(), revision]) | ||
except: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this make more sense to be revision = ''
?
And does the rest of the app work correctly with an empty string or None
value? There seem to be several areas of the app that filter or group by revision value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@albertyw I removed the dealer dependency now - I think it's simpler just to let users to set the revision themselves using whichever method they prefer. This is what we have ended up doing when running this branch in production.
Codecov Report
@@ Coverage Diff @@
## master #281 +/- ##
===========================================
- Coverage 82.83% 30.80% -52.04%
===========================================
Files 50 52 +2
Lines 2051 2136 +85
===========================================
- Hits 1699 658 -1041
- Misses 352 1478 +1126
Continue to review full report at Codecov.
|
@@ -0,0 +1,21 @@ | |||
# -*- coding: utf-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this migrations and regen again with django 2.2+ only.
def filters_from_request(request): | ||
class RevisionFilter(BaseFilter): | ||
def __init__(self, value): | ||
super(RevisionFilter, self).__init__(value, revision=value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need of expliclit RevisionFilter, self) in super()
</div> | ||
|
||
|
||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline
@@ -89,4 +91,19 @@ | |||
view=CProfileView.as_view(), | |||
name='cprofile', | |||
), | |||
url( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using path() would be better choice as url() is deprected
@@ -0,0 +1,53 @@ | |||
import csv | |||
import contextlib | |||
from six import StringIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
six is not needed
I am no longer working at crunchr, so I don't think have permissions to push to this branch any longer (in fact I made this PR with my crunchr account). I would probably have to create a new PR from my own fork. I am not sure when I would have time to look at this though, since we don't use silk at my new job and personal time for programming is quite limited at the moment. |
thanks for your work, i might end up opening a cleaner version of your work |
Hey @auvipy did you have time to check it? If not, I would like to help! |
This PR adds a distribution tab (at the moment opt in using the SILK_DISTRIBUTION_TAB configuration setting) with a visualisation of the request time distributions grouped by date or revision. We are using this at crunchr for continous benchmarking to ensure we don't introduce changes to our codebase that degrade the performance of our backend. This might be particularly useful for benchmarking django apps over time or versions.