GithubHelp home page GithubHelp logo

dz0ny / pyramid_straw Goto Github PK

View Code? Open in Web Editor NEW
3.0 5.0 2.0 2 MB

Makes debugging SQLAlchemy in Pyramid a joy.

Makefile 0.02% Python 0.81% Mako 0.18% JavaScript 98.88% HTML 0.11%
pyramid-framework debug sqlachemy

pyramid_straw's Introduction

Pyramid Straw

Build Status

The first tool you should use to analyze whats going on with your database, when developing pyramid apps.


screenshots/cover.png screenshots/new_functionalily_on_sql_explained_modal.jpg screenshots/pev_modal.png

Installing

Include project after debug_toolbar.

pyramid.includes =
    pyramid_straw.profiler
    pyramid_straw.panel

Configuration

Project consists of two parts

Config options

pyramid_straw.only_paths
pyramid_straw.report_hook
pyramid_straw.disable_inspect

pyramid_straw.only_paths

If you want to limit what is backtraced for each query (defaults to package where it is included). You can override pyramid_straw.only_paths.

For example:

pyramid_straw.only_paths = ['/home/dz0ny/ebn/src/']

pyramid_straw.report_hook

And if you want to send reports somewhere else you can use report hook that needs to be callable and accepts data dict for each query. This would be little expensive in production so beware.

For example:

def report_hook(data):
    requests.post(config.my_report_url, json=data)

config.add_settings({
    'pyramid_straw.report_hook': report_hook
})

pyramid_straw.disable_inspect

You can also disable query inspection with setting disable_inspect to false. For example:

config.add_settings({
    'pyramid_straw.disable_inspect': False
}) ```

pyramid_straw's People

Contributors

dz0ny avatar enkidulan avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyramid_straw's Issues

Analytics based on overtime statistics

NOTE: This issue is still on progress, don't bother to read further yet.

Motivation:
Analytical view SQLAlchemy in pyramid_debugtoolbar does not provide statistical/historical view on sql/functions queries/calls which make it impossible to track general tendentious and to find and investigate extremes (and possibly anomalies).

Idea:

  1. Implement functionality for gathering descriptive statistics to associate flowing parameters with query/call: mean, average deviation, median, mode...
  2. Implement functionality that would gather query explains and profiling of call stack (if possible) for cases that exit allowed deviation.

Implementation notes:

  • all sql query explains and call stack profiling logic should be as close to pyramid_debugtoolbar as much possible so it could be integrated into its code base.
  • view function is a main source of events (and in context of pyramid_debugtoolbar the only one) so all queries probably should be associated with it.
  • the statistic gathering functionality should be based pyramid_debugtoolbar and provide simple view to represent statistical information for each view (mean, average deviation, median, mode, ...) and extreme cases
  • as a storage endpoint for analytical information should be used a DB that support OLAP cube (or at least have group by and aggregation functionality - if sqlite allow it, would be great to use it as a starter).
  • for each event source provide box plot for better representation (image taken from http://rstudio.owlmetabolomics.com:8031/AgingAnalysis/):
    boxplot
  • provide accumulative statistic of time spend(load) for each event source per hour/day/week/mount

Consider replacing PEV with simpler tool for visualization

Internal https://github.com/AlexTatiyants/pev calculations doesn't seem to be that complicated and came goes to visualization part, but the tool itself appeared to be quite hard to integrate with and it is quite complicated to extend or modify. PEV was fine as POC but for as a project dependency it could become quite hard to maintain it. The other thing is that it's really slow - it takes couple of seconds to load the app before it start working, also the size of static files for that app is 8MB which is kind of insane...

support for sqlite, mysql, etc...

Wasn't able to pyramid_straw with sqlite, on every request it was giving strange trace-back, I guess it should be handle somehow, at least with providing sane trace-back that pyramid_straw doesn't support any DB backends except psql

PEV won't reneder until user perform action on input fields

Impossible to click submit button on pev's new plan form until type something in execution plan field, even if it has some value.

PEV renders in iframe in modal window, all data that is received from backed populates in following way 3c5fd01
which doesn't seem to trigger pev's event listeners, probably to fix that it's required to broadcast keypress event for textarea inputs.

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.