Added a distribution tab to visualize request time distributions over time#281
Added a distribution tab to visualize request time distributions over time#281danielbradburn wants to merge 17 commits intojazzband:masterfrom
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
albertyw
left a comment
There was a problem hiding this comment.
- I'm not sure if
dealeris 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.
| 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.
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.
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.
I will check out the failing tests.
| @@ -0,0 +1,102 @@ | |||
| try: | |||
| # Django>=1.8 | |||
There was a problem hiding this comment.
As of fa1f542, django-silk does not support django<1.11
There was a problem hiding this comment.
Ah good, improves this code!
| @@ -0,0 +1,199 @@ | |||
| (function() { | |||
There was a problem hiding this comment.
Is this an unminified copy of url.min.js? Do we need both?
There was a problem hiding this comment.
Yes and no, I will remove it.
| name="filter-overalltime-typ"/> | ||
| <input type="text" | ||
| placeholder="seconds" | ||
| placeholder="milliseconds" |
There was a problem hiding this comment.
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?
| timestamp = auto._repo.git('show -s --format=%at ' + revision) | ||
| revision = ' # '.join([timestamp.decode(), revision]) | ||
| except: | ||
| pass |
There was a problem hiding this comment.
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.
@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.
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.
no need of expliclit RevisionFilter, self) in super()
| </div> | ||
|
|
||
|
|
||
| </div> No newline at end of file |
| view=CProfileView.as_view(), | ||
| name='cprofile', | ||
| ), | ||
| url( |
There was a problem hiding this comment.
using path() would be better choice as url() is deprected
| @@ -0,0 +1,53 @@ | |||
| import csv | |||
| import contextlib | |||
| from six import StringIO | |||
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.