django-silk icon indicating copy to clipboard operation
django-silk copied to clipboard

Profile Graph Not Showing

Open FilmCoder opened this issue 7 years ago • 16 comments

All I can see is the cProfile dump, and a link to download the .prof file. There's no visualization graph, only the cProfile dump. Otherwise, Silk is silky.

I have these lines in my settings.py: SILKY_PYTHON_PROFILER = True SILKY_PYTHON_PROFILER_BINARY = True SILKY_PYTHON_PROFILER_RESULT_PATH = 'C:\valid_path_to_profs'

FilmCoder avatar Aug 22 '17 21:08 FilmCoder

Hi @FilmCoder are you using the version from pypi or from github. A version with visualization graph has not been released yet.

Furthermore, I don't have access to a windows machine at the moment to test this, I have only tried it out under linux. It may be that your need to follow the instructions here. If you need to do anything special then please let me know here so I can update the readme for other windows users.

danielbradburn avatar Aug 23 '17 05:08 danielbradburn

Ah OK. I used "pip install django-silk", then "pip install gprof2dot", all on my windows machine. Are you saying it should work if I pull from github instead of using pip to install? And for sure, I'll let you know if I get it working what my steps were.

FilmCoder avatar Aug 23 '17 14:08 FilmCoder

If you pull from github then the graphviz code will be there. However I haven't tested on windows, so it would be great if you could report whether it works!

danielbradburn avatar Aug 23 '17 14:08 danielbradburn

@danielbradburn I'm in the same position as @FilmCoder on Windows; I upgraded from the git repo and the graph shows up and interacts with user input fine. Pruning works, zooming and panning works.

Anyone else going down this path, be sure to run migrate again, the profile file length was increased.

isosphere avatar Aug 25 '17 15:08 isosphere

@isosphere Thanks for the info, glad to hear it's working! I assume this issue can be closed now, @avelis could you close this please?

danielbradburn avatar Aug 28 '17 07:08 danielbradburn

On Ubuntu, I get no graph. Profile is generated (available to download) and I see plain text output.

No error is provided to help me, so it's hard to debug.

python 3.6.3, django 1.11.6, dango-silk 1.0.0

Note: on macOS, no profile is generated at all, and also no error (https://github.com/jazzband/silk/issues/215#issuecomment-345493279)

tony avatar Nov 19 '17 05:11 tony

I still get this, installed through pip (pypi), django-silk==3.0.2. Has anyone come up with a solution ? Thanks

regmeg avatar Jun 21 '19 08:06 regmeg

Hello I am experiencing this issue as well.

OSX

(venv) ╭─hugbot
╰─$ pip freeze
asgiref==3.2.3
autopep8==1.5
boto3==1.9.188
botocore==1.12.253
certifi==2019.11.28
chardet==3.0.4
coreapi==2.3.3
coreschema==0.0.4
dj-database-url==0.5.0
Django==3.0.3
django-cors-headers==3.2.1
django-extensions==2.2.7
django-polymorphic==2.1.2
django-rest-polymorphic==0.1.8
-e git+https://github.com/jazzband/django-silk.git@d0557944d45e4afa80718debb65f1b234d38c542#egg=django_silk
django-storages==1.7.1
djangorestframework==3.11.0
djangorestframework-jwt==1.11.0
docutils==0.15.2
fancycompleter==0.9.1
gprof2dot==2019.11.30
gunicorn==20.0.4
idna==2.8
itypes==1.1.0
Jinja2==2.11.1
jmespath==0.9.4
lxml==4.5.0
MarkupSafe==1.1.1
music21==5.7.2
pdbpp==0.10.2
psycopg2==2.8.2
psycopg2-binary==2.8.4
pycodestyle==2.5.0
Pygments==2.5.2
PyJWT==1.7.1
pyrepl==0.9.0
python-dateutil==2.8.1
pytz==2019.3
requests==2.22.0
s3transfer==0.2.1
six==1.14.0
sqlparse==0.3.0
uritemplate==3.0.1
urllib3==1.25.8
virtualenv==16.7.9
wmctrl==0.3
# ------------------------------------------------------------------------------
# Django Silk
# ------------------------------------------------------------------------------
# Turn on the SILKY_PYTHON_PROFILER setting to use Python's built-in cProfile
# profiler. Each request will be separately profiled and the profiler's output
# will be available on the request's Profiling page in the Silk UI.
SILKY_PYTHON_PROFILER = True

# If you would like to also generate a binary .prof file set the following:
SILKY_PYTHON_PROFILER_BINARY = True

# A custom storage class can be used for the saved generated binary .prof files:
# SILKY_STORAGE_CLASS = 'path.to.StorageClass'

# The default storage class is silk.storage.ProfilerResultStorage, and when
# using that you can specify a path of your choosing. You must ensure the
# specified directory exists.
# If this is not set, MEDIA_ROOT will be used.
# SILKY_PYTHON_PROFILER_RESULT_PATH = '/path/to/profiles/'

# Sometimes it is useful to be able to see what effect Silk is having on the
# request/response time. To do this add the following to your settings.py
SILKY_META = True

loganknecht avatar Feb 08 '20 08:02 loganknecht

@loganknecht do you see any error in browser console? Would be helpful if you also mention which browser/version you are using

nasirhjafri avatar Feb 08 '20 09:02 nasirhjafri

@nasirhjafri I do not see any errors in the browser console.

Firefox - 72.0.2

image

Chrome - Version 80.0.3987.87(Official Build)

image

loganknecht avatar Feb 08 '20 23:02 loganknecht

@loganknecht Can you please share the screenshots for the same URL you are not able to see the graph. It would be better if I can get one with console and one with network panel tab.

nasirhjafri avatar Feb 10 '20 11:02 nasirhjafri

@loganknecht I have faced the same problem and seems we are looking not in right place. @nasirhjafri correct me if I wrong, these steps worked for me.

The following steps ARE NEEDED to see graph:

  1. SILKY_PYTHON_PROFILER and SILKY_PYTHON_PROFILER_BINARY both set to True in your settings.
  2. Method wrapped with silk_profile decorator or method that have usage of silk_profile context manager.
  3. Then after some requests were executed you should navigate NOT on request details page but on request profiling and open corresponding profile that you created in step 2.

And now you will see profile graph.

F1ashhimself avatar Feb 09 '21 14:02 F1ashhimself

@loganknecht I have faced the same problem and seems we are looking not in right place. @nasirhjafri correct me if I wrong, these steps worked for me.

The following steps ARE NEEDED to see graph:

  1. SILKY_PYTHON_PROFILER and SILKY_PYTHON_PROFILER_BINARY both set to True in your settings.
  2. Method wrapped with silk_profile decorator or method that have usage of silk_profile context manager.
  3. Then after some requests were executed you should navigate NOT on request details page but on request profiling and open corresponding profile that you created in step 2.

And now you will see profile graph.

Facing same issue, but it works for me after following steps you have mentioned. Thanks!!

It seems graph will only be available if we use decorator or context manager, not if we use silk through middleware (documentation is silent on this).

waqas-ali-pk avatar May 05 '21 02:05 waqas-ali-pk

i guess improving docs will be beneficial here

auvipy avatar Oct 13 '21 04:10 auvipy

In my case it was the order of urlpatterns in url.py, I needed add path at the front instead of extending the list later on like:

urlpatterns = [
    path("silk/", include("silk.urls", namespace="silk")),
`
``

Macilias avatar Feb 07 '23 12:02 Macilias

Any reason why there isn't a middleware for this?

h3nnn4n avatar Mar 24 '23 16:03 h3nnn4n