jazzband / django-silk

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

Profiles don't seem to be created #215

Open bogdanpetrea opened 6 years ago

bogdanpetrea commented 6 years ago

Using the latest master version, there seems to me that the only way to get profiling is to decorate a method/function with the silk_profile decorator.

The only place where Profile objects are created is here, and it happens for every profile object given by the DataCollector.profiles method. Now those profile objects are only registered using the register_profile in the _finalise_queries method which is part of the silk_profile decorator. From what I found, the decorator is only used for dynamic profiling throughout the project.

Note that the .prof files are being generated correctly.

Am I doing something wrong here?

avelis commented 6 years ago

@bogdanpetrea I don't see anything you are doing wrong other than ensuring you have the library installed correctly. Can you provide some information as to what version of Django you are using this library with?

bogdanpetrea commented 6 years ago

Hey @avelis , I am using Django 1.8, but I can try this on 1.11 soon. Just to make sure I didn't get this wrong: every request (except for the ones that go to the silk views) should be automatically profiled if I use the SILKY_PYTHON_PROFILER and SILKY_PYTHON_PROFILER_BINARY settings right? I don't have to actually decorate my views right?

bogdanpetrea commented 6 years ago

I tested on the same project, but now with Django 1.11 and Python3.6 and it's still the same... Any ideas?

tony commented 6 years ago

Profiles generate works for me on Ubuntu (but graph output broke), but for some reason, macOS doesn't create profiles.

python -V
Python 3.6.3

pip show django-silk
Name: django-silk
Version: 1.0.0
Summary: Silky smooth profiling for the Django Framework
Home-page: http://www.mtford.co.uk/projects/silk/
Author: Michael Ford
Author-email: mtford@gmail.com
License: MIT License
Location: /Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages
Requires: Django, Jinja2, pytz, sqlparse, Pygments, requests, python-dateutil, autopep8

pip show django
Name: Django
Version: 1.11.6
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: https://www.djangoproject.com/
Author: Django Software Foundation
Author-email: foundation@djangoproject.com
License: BSD
Location: /Users/me/.local/share/virtualenvs/develtech-oQr_FNyw/lib/python3.6/site-packages
Requires: pytz
tony commented 6 years ago

The other problem is, I'm not getting any debug output or errors.

I'd expect if I have profiling toggled on and graphs aren't showing, there would be an error where I'd have a traceback. Instead, it falls back to just generated anything.

I'd rather it give me an error :P This makes it really hard for people coming to the issues to provide meaningful debug information.