jazzband / django-silk

Silky smooth profiling for Django
MIT License
4.48k stars 337 forks source link

Error when using profiler #475

Open armanjtehrani opened 3 years ago

armanjtehrani commented 3 years ago

I'm using silk with django 3.1 and python 3.9

The problem is when I use profiler on any of my views, my request page becomes like this: silk0 silk1

and I also get this error:

Traceback (most recent call last):
  File "/home/joofi/.virtualenvs/py38/lib/python3.8/site-packages/silk/collector.py", line 199, in finalise
    profile_query_models.append(query['model'])
KeyError: 'model'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/joofi/.virtualenvs/py38/lib/python3.8/site-packages/silk/middleware.py", line 121, in _process_response
    collector.finalise()
  File "/home/joofi/.virtualenvs/py38/lib/python3.8/site-packages/silk/collector.py", line 201, in finalise
    raise SilkInternalInconsistency(
silk.errors.SilkInternalInconsistency: Profile references a query dictionary that has not been converted into a Django model. This should never happen, please file a bug report

My settings environment is:

SILKY_MAX_REQUEST_BODY_SIZE = -1
SILKY_MAX_RESPONSE_BODY_SIZE = -1
SILKY_INTERCEPT_PERCENT = 100
SILKY_MAX_RECORDED_REQUESTS = 10 ** 4
SILKY_MAX_RECORDED_REQUESTS_CHECK_PERCENT = 10

SILKY_AUTHENTICATION = True
SILKY_AUTHORISATION = True

SILKY_META = True
SILKY_ANALYZE_QUERIES = True
SILKY_PYTHON_PROFILER = True
SILKY_PYTHON_PROFILER_BINARY = True
SILK_PROFILER_RESULT_PATH = "/silk/"
SILKY_STORAGE_CLASS = "silk.storage.ProfilerResultStorage"
SILKY_PYTHON_PROFILER_RESULT_PATH = "{}{}".format(BASE_DIR, SILK_PROFILER_RESULT_PATH)
Archmonger commented 3 years ago

Reverted the PR merge due to this issue with meta profiling

Exception when performing meta profiling, dumping trace below
Traceback (most recent call last):
  File "C:\Users\username\Documents\Repositories\Conreq\.venv\lib\site-packages\silk\middleware.py", line 132, in _process_response
    collector.finalise()
  File "C:\Users\username\Documents\Repositories\Conreq\.venv\lib\site-packages\silk\collector.py", line 189, in finalise
  File "C:\Users\username\Documents\Repositories\Conreq\.venv\lib\site-packages\django\db\models\fields\related_descriptors.py", line 1015, in set
    self.add(*new_objs, through_defaults=through_defaults)
  File "C:\Users\username\Documents\Repositories\Conreq\.venv\lib\site-packages\django\db\models\fields\related_descriptors.py", line 950, in add
    self._add_items(
  File "C:\Users\username\Documents\Repositories\Conreq\.venv\lib\site-packages\django\db\models\fields\related_descriptors.py", line 1126, in _add_items
    target_ids = self._get_target_ids(target_field_name, objs)
  File "C:\Users\username\Documents\Repositories\Conreq\.venv\lib\site-packages\django\db\models\fields\related_descriptors.py", line 1062, in _get_target_ids
    raise ValueError(
ValueError: Cannot add "<SQLQuery: SQLQuery object (None)>": the value for field "sqlquery" is None
Natgho commented 11 months ago

is there any update?