Instrumenting a Buffalo Application with New Relic
--
Currently I maintain a little buffalo application called GolangFlow.io, which was inspired by RubyFlow.com for any Rubyists out there.
I wanted to keep track of the response time and internals of my Buffalo app and turned to New Relic to do just that. The Buffalo creator Mark Bates was kind enough to quickly help me so I decided to write a short post for any Gopher trying to do the same.
The implementation is really simple, open up your favorite code editor, VS Code is my choice now a days. You’ll want to navigate to the actions
directory and edit app.go
You’ll want to add the following code, you may have to tweak my example depending on your own app.go
as the example below is tailored for this post.
Let’s add the New Relic package using dep package management.
dep ensure -add github.com/newrelic/go-agent
As you can see, we must set a Environment VAR, in this case, I’m using Heroku as my platform of choice. Change APP_NAME to the name of your heroku app. I would set this before deploying to Heroku if your using the platform.
heroku config:set NEW_RELIC_LICENSE_KEY=XXXXX -a APP_NAME
After Deployment, you’ll need to wait about 5–10 minutes before data starts showing up in the New Relic Dashboard.
Hope you enjoyed this little post!