Comments (9)
This is somewhat related to #17 which also requested a way to manually enable profiling.
One option is the inclusion of a simple 'rules' system that could iterate a set of criteria to see if the request should be profiled. It could either be built with a series of closures, or a more declarative system.
from xhgui.
I think this is a great feature to leave to leave to a new contributor, it doesn't require a lot of knowledge of the code base, nor a particular understanding of the frameworks but is quite meaningful.
from xhgui.
I'm going to poke around on this, I have some ideas on how this could be built. I'd also like to move the settings file into a settings.default that gets copied into place by the installer.
from xhgui.
-1 on the idea of a file being copied by the insteller. I'd go with a default file that is shipped with the application and the ability to override settings in a second file. So you get something like config.global.php & config.local.php.
from xhgui.
@anho That is effectively the same thing, but with one fewer file being loaded on each request.
from xhgui.
It's not when you are upgrading existing installations and xhgui added further settings to its config. In that case the users have to edit their own config file accordingly to be able to run the app properly. If you provide an actual default config and let the user override only single settings as he wants, you create less friction.
Or am I missing the details of the implementation?
from xhgui.
Hmm good point about making upgrading easier. I was thinking of having the following in the configuration file:
return array(
// Other config
'profiler.enable' => array(
// Profile 1 in 100 requests.
function () { return rand(0, 100) !== 42; },
function () {
// User land code.
}
)
);
This would let people include any environment based conditions they needed. It also lets xhgui come with a reasonable default of 1 in 100 requests. If any of the callable functions returns true, then the profiler would be enabled.
Does this seem like a reasonable approach overall?
from xhgui.
Do you see any use case where the user wants to have more than one callable determining the state of the profiler? I would say: YAGNI.
If I would have a more complex code to enable the profiler I'd just use a class hiding the details. So one callable would be enough.
from xhgui.
Fair point.
from xhgui.
Related Issues (20)
- NetData/DirectAdmin/Ubuntu integration
- PHP files in docker 0.18.0 image aren't readable to www-data user HOT 2
- Removed Profile::getCallgraphNodes method in use HOT 1
- Can't auth with mongodb HOT 14
- redirects after run delete do not honor 'path.prefix' HOT 5
- Docker Hub images HOT 14
- Error on callgraph for profile on symfony based project HOT 1
- PHP 8.1 Support HOT 19
- About PDO JSON support HOT 14
- docker版本的bug: { "error": true, "message": "Failed to decode payload" }
- Missing required parameter in RunController:274 HOT 3
- Export Call Graph
- docker: Cannot import `.xhprof` files - PHP Fatal error: require(): Failed opening required xhgui/external/../vendor/autoload.php' HOT 7
- Fatal error: Uncaught TypeError: Return value of XHGui\ServiceProvider\ServiceProvider::setupPaths() must be an instance HOT 4
- upgrade symfony/options-resolver HOT 1
- PHP8.2 Compatibility for xhgui-collector HOT 1
- Request for Support: Implementing php-twig v3.x Compatibility in XHGui HOT 2
- Changing the ip of the mongo container
- mongo The requested image's platform (linux/amd64) does not match the detected host platform HOT 1
- Add Buggregator to README (OpenSource Tool for Analyzing xhprof profiles)
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 xhgui.