jazzband / django-silk

Silky smooth profiling for Django
MIT License
4.37k stars 333 forks source link

Profile Graph Not Showing #211

Open FilmCoder opened 7 years ago

FilmCoder commented 7 years ago

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'

danielbradburn commented 7 years ago

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.

FilmCoder commented 7 years ago

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.

danielbradburn commented 7 years ago

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!

isosphere commented 6 years ago

@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.

danielbradburn commented 6 years ago

@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?

tony commented 6 years ago

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)

regmeg commented 5 years ago

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

loganknecht commented 4 years ago

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
nasirhjafri commented 4 years ago

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

loganknecht commented 4 years ago

@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

nasirhjafri commented 4 years ago

@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.

F1ashhimself commented 3 years ago

@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.

waqas-ali-pk commented 3 years ago

@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).

auvipy commented 2 years ago

i guess improving docs will be beneficial here

Macilias commented 1 year ago

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")),
`
``
h3nnn4n commented 1 year ago

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