Comments (11)
It's worth noting that this change would be required to get this module into the CWP 2.0 recipe, since at the moment it conflicts with 2 or 3 other SilverStripe modules with also proxy the database.
from silverstripe-debugbar.
I think we need to get this done before this module can be tagged as stable for SilverStripe 4. What do you think about this @lekoala?
from silverstripe-debugbar.
it makes sense to be able to simply add an extension to the database instead of make a full proxy.
i'm a bit sad however that the extension points are not included in the core itself and the we need to rely on a module that dynamically attach behaviours to methods, too much magic for me
what do you think @tractorcow ? is the db proxy really the way the SilverStripe team wants to go? why not simply add a couple of extension points in the database class itself?
from silverstripe-debugbar.
i'm a bit sad however that the extension points are not included in the core itself and the we need to rely on a module that dynamically attach behaviours to methods, too much magic for me
Yes I agree. Maybe 4.2 we could do that and not need the proxy. It just never made it in, in time.
from silverstripe-debugbar.
ok, meanwhile we can actually do both: if the module is installed, use it, otherwise keep the current behaviour.
from silverstripe-debugbar.
hey @tractorcow I had a look at the proxy db module. Do you see a way to get time before AND after the query? as far as I can tell, the middleware is executed before the last callback that will actually execute the query, so there is no easy way to get the time needed to execute the query.
In ProxiedBehaviour::invoke could you add another loop with the result returned by the last $next(...$args) ?
Or if you have any other idea of course... I still believe it would be a lot easier to add to extension point in Database::benchmarkQuery method : $this->extend('onBeforeQuery', ...) and $this->extend('onAfterQuery', ...).
from silverstripe-debugbar.
from silverstripe-debugbar.
Well, I can call next, but it's only going to call the next middleware, not actually execute the query.
Something like this
// Get time and memory for the request
$startTime = microtime(true);
$startMemory = memory_get_usage(true);
// Execute all middleware
$result = $next(...$args);
$endTime = round(microtime(true) - $startTime, 4);
$endMemory = memory_get_usage(true);
Doesn't work at all, but I think that's to be expected because from what I've seen, it's not a double pass middleware, but I may be wrong. Collecting the queries is easy enough, it's just profiling them that is difficult.
from silverstripe-debugbar.
@lekoala the last item in the middleware is execution of the query. Your last code comment should work.
If it's not I've done something wrong in the module.
from silverstripe-debugbar.
Indeed! Too much callback mystery in my mind...
Implemented in b56a8ed
from silverstripe-debugbar.
Just updated the test suite as well, but it is failing for lots of strange reason on my computer (no config manifests and nest/unest issues) so it's probably not thoroughly tested
from silverstripe-debugbar.
Related Issues (20)
- CACHEINCLUDE_FORCE_EXPIRE doesn't work
- ClickToShowFields appended to & duplicating queries HOT 5
- Instructions on how to add a tab to the debugbar HOT 10
- Compatibility with Silverstripe 4.7 / Symfony-YAML 4 HOT 2
- Timeline improvement idea on master branch HOT 4
- Downstream merge HOT 3
- Undefined Index notices (and are you taking PR's for the 3.x branches?) HOT 4
- [Emergency] Uncaught Error: Call to a member function getCollector() on bool HOT 3
- Release to include trackTime HOT 1
- php 8.1 Deprecation HOT 1
- upgrading to cms 4.11 dependency issue HOT 4
- Deprecation warning PHP8.1 HOT 4
- setup github workflow HOT 3
- Debugbar would cause tinycme to crash & blocks CMS page from loading (Invalid or unexpected token in javascript) HOT 1
- [Idea] Export tab to CSV/Something HOT 1
- Debugbar requirements not included in 4.12 HOT 2
- CMS 5 - Email tab won't work HOT 2
- Requirements require themselves too early HOT 6
- Query trace shows incorrect class/method names HOT 2
- Javascript script is wrongly rendered inside of another javascript file causing tinyMCE to crash and halt loading of CMS HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silverstripe-debugbar.