Giter Site home page Giter Site logo

catcombo / django-speedinfo Goto Github PK

View Code? Open in Web Editor NEW
57.0 3.0 10.0 483 KB

Django views profiler for small projects

License: MIT License

Python 94.81% CSS 1.02% HTML 1.60% JavaScript 2.58%
django profiler views performance monitoring metrics

django-speedinfo's People

Contributors

catcombo avatar igorcode avatar victorfabref avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-speedinfo's Issues

Admin view: sorting on all columns

While not (easily) directly supported in the DB, ordering of calculated fields could be also provided.

This would allow to sort on e.g. "SQL time" also.

Do you think this is useful?

Setup issues

I have installed speedinfo on a test project. Initially it was throwing an error

Traceback (most recent call last):
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 112, in inner_run
    autoreload.raise_last_exception()
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
    raise _exception[1]
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/core/management/__init__.py", line 327, in execute
    autoreload.check_errors(django.setup)()
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/apps/registry.py", line 120, in populate
    app_config.ready()
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/contrib/admin/apps.py", line 23, in ready
    self.module.autodiscover()
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/speedinfo/admin.py", line 132, in <module>
    admin.site.register(ViewProfiler, ViewProfilerAdmin)
  File "/Users/curatech/.virtualenvs/library/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 109, in register
    raise AlreadyRegistered('The model %s is already registered' % model.__name__)
django.contrib.admin.sites.AlreadyRegistered: The model ViewProfiler is already registered

To prevent this, I have unregistered model.

from speedinfo.models import ViewProfiler

admin.site.unregister(ViewProfiler)

After this, setup was completed. I have browsed several pages on the app with toggle on and off but nothing is showing up in admin panel of speedinfo. Should I add any additional code to track the views?

Screen Shot 2019-06-12 at 10 13 47 PM

Store Content-Type?

Especially with DRF it is relevant if a request's response is of Content-Type text/html, text/json etc.

I think it would be nice to store this information (without the charset, i.e. everything up until ";").

What do you think?

'bool' object is not callable in Django 2.0.2

Internal Server Error: /admin/
Traceback (most recent call last):
File "/Users/juli/dev/leansew/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/Users/juli/dev/leansew/env/lib/python3.6/site-packages/speedinfo/middleware.py", line 112, in call
return self.process_response(request, response)
File "/Users/juli/dev/leansew/env/lib/python3.6/site-packages/speedinfo/middleware.py", line 90, in process_response
is_anon_call = request.user.is_anonymous()
TypeError: 'bool' object is not callable

Adding custom fields in admin panel?

What options are available for users if they have to add custom fields in the admin? For example, the percentile of total time.

One option is users can register the model by themselves. speedinfo has to ignore the registration if the model is already registered.

Use url path instead of view name?

@catcombo I have been testing out speedinfo with several projects and it is working well. Thank you for your efforts.

Any reasons to use view_name instead of URL paths to collect statistics?

One issue with view names is, resolve can't give full function name.
For example if there is a function at core.viewsets.BookViewSet.dashboard, view name will be just core.viewsets.BookViewSet. All the methods in the view set will have same view name. This results in combining stats of all views inside a model view set.

Another issue with view names is, when profiling views in admin, it will always show same view names like django.contrib.admin.options, django.contrib.admin.options.changelist_view
irrespective of the model a user is visiting.

I have made a temporary fix to test it out 7bfc2c3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.