Monday I stopped by the New Relic office for live streaming #RailsConf. Creator #DHH talked about the future of Rails - Rails 4 and multiple caching options, designing pattern details. I saw New Relic last time when they brought the Obama tech team to SF. Not impressed, but today I hit a Heroku bug and was tired of tailing the logs (having to constantly go back to my machine) and Pg Admin to shared Amazon servers... yeah too much overhead for my one-pager. What do I do? Also, what's a better opportunity to learn a tool without having to read the documentations? We all know documentations are important in coding.
For Rails app hosted on Heroku
Deploy to Heroku and select New Relic as an Add-on
Command line $heroku addons:add newrelic in the Rails app directory of your newly deployed app
You may be prompted for heroku.com/verify
That means you have to enter your credit card, no worries, you won't be charged. But you may want to reset your Heroku password to something more secure.
Run $heroku addons:add newrelic again after "verification"
Feel free to run $heroku addons:docs newrelic to open up the documentation
Or visit https://devcenter.heroku.com/articles/newrelic
Follow documentation to add gem to gemfile (gem 'newrelic_rpm') then bundle install
In Rails app directory:
$curl https://raw.github.com/gist/2253296/newrelic.yml > config/newrelic.yml
Modify your newrelic.yml file that you just received in the config directory of your Rails app. Change your app name
app_name:"your app name here"
or use the environment variable format provided
Go to your app refresh a few times, navigate through a few pages and generate some traffic
Log back into Heroku, navigate to your app admin, then the Add-on, select new relic, you will be automatically log into your Dashboard
You just gained access to your full performance and error log for both front end and back end. I was able to get data on page rendering, DOM load, script and database performance. It was awesome. For those who don't like $heroku logs --tail, or simply aren't on the right computer all the time with the right toolbelt. Here's an awesome way to view your stats.
While the stats is a bit of overkill compared to Google Analytics for an average user, but the error log (narrowing down to controller, methods, and specific ruby stack trace) was invaluable even for a noob.
A common noob mistake that I and many people make: forgetting to update the repo, so you will need to
$git add . (or add whatever)
$git commit -m"e.g. adding the newrelic.yml file"
$git push heroku master
Tuesday, April 30, 2013
What is a domain name system (DNS)? How stuff works explains it in a very good graph I was very confused by the Wikipedia explanatio...
The bogus request from P2PU to hunt for HTML tags in real life has yielded a lot of good thoughts. My first impression was that this is stup...
I recently submitted Project 1 of the Udacity Full Stack Nanodegree curriculum. This blog post is my reflection and review on the experience...