Two new side projects - xhgui2 & lint-review

I try to keep fairly busy. Between work, being a dad, and working on existing open source projects, I found time to work on two new ones.

Xhgui2

Profiling is a very interesting topic for me. I love spending time sifting through results trying to find ways to make code run faster or use less memory. XHProf is a C-extension created by Facebook. It allows you to generate function level call counts, memory use, and execution runtime for your application. XHProf is interesting as a profiler because it can easily be run in production on a sub-sample of requests.

Xhgui2 hooks into an application and storing profile data in MongoDB. It allows you to view summary information, profile data, callgraphs and compare runs with historical data. Paul Reinheimer and I started the project after discussing it an TrueNorthPHP 2012. We’ve been working on the project for a few months now, and I feel it is a suitable replacement for the existing HTML interface bundled with XHProf. It is a pretty basic PHP application, that has been a great for learning both MongoDB and D3js. D3 takes some time to learn, but once you figure it out, it is amazingly powerful. While D3 has worked out really well, I can’t say the same about working with MongoDB. Profiling requires some basic statistics, and MongoDB’s aggregation framework falls really short of providing the required feature. Using Map reduce is the only option. This limitation has delayed the implementation of some features.

I’ve enjoyed working on Xhgui2 immensely and use it during my day job. In the future, I’m hoping to find time to create a useful dashboard and provide better tools for finding anomalous runs. I would also like a way to annotate performance changes, and tie them back to deployments or other events. You can check the project out on github .

Lint-review

Lint review started out as a solution to a problem I had at work. Our team appreciates the benefits coding standards bring to a larger team. But not everyone can remember what the standards are, and they often forget to run the lint checking tools on their work. I was spending a considerable amount of time in code review correcting coding standards issues. While useful, I feel my time can be better spent. I set out to find a tool that could do the following:

  • Integrate with code linters for the various platforms we use (php, python, javascript, css).
  • Provide feedback quickly and accurately. Ideally as github pull request comments.
  • Provide feedback before code was merged into master.

I was unsuccessful in my search and ended up writing my own tool that does all of the above. By integrating with github’s API and webhooks lint-review is able to do automated code reviews. I decided to use python + celery for this project as the task queue + async workers fit really well with the workflow. Celery is a bit painful to configure as there are many configuration options. Once I figured out the configuration and setup, it worked quite well. I don’t feel that lint-review is totally done as there are many other tools I could/should integrate, but it is done enough to be an important part of our daily code review process at work.

In the future I hope to add more lint tool integration and possibly integrate other code quality tools. You can check the project out on github .

Comments

i have been using Xhgui2. It is great but why did you only want to store data one out of a hundred requests :

In line 34, /external/header.php :
if (rand(0, 100) === 42) {
}

Could you clarify this line ?

meotimdihia on 6/25/13

meotimdihia: Sure the original idea was that in many cases you don’t want to profile more than 1% of requests. My thinking was that if people wanted to profile a larger sample of requests they could modify that line to do what they needed. The percentage of profiled requests could be exposed as a setting but that would mean bootstrapping Xhgui on every request to the monitored application.

mark story on 6/25/13

Way cool! Some extremely have valid points! I appreciate you writing this article, also really good.

Zach Smith on 6/28/13

Comments are not open at this time.