A small convenience layer that sits on top of newrelic-go-agent, to make it easy to create transactions for NewRelic in Go.
New Relic's Agent SDK only supports Linux, so by default the agent is disabled to allow development on non-Linux environments. It will however build and run on Linux environments (including Heroku & Cloud Foundry).
You will need godep installed to manage dependencies.
- Add the github.com/sky-uk/newrelic-go-agent to your app's imports section.
- Run godep save -r ./...
- Add newrelic.Init to your app.
- Add Heroku's Go buildpack to your manifest.yml (Cloud Foundry's should work too).
- Grab the New Relic Agent SDK and extract the binaries into your app's base directory:
tar zxvf nr_agent_sdk-v0.16.1.0-beta.x86_64.tar.gz --strip=2 -C . "nr_agent_sdk-v0.16.1.0-beta.x86_64/lib"
This could be added to CircleCI/Jenkins as part of a build. - Change your Procfile/manifest.yml start command to have LD_LIBRARY_PATH=. before your app's binary location.
e.g.
Add
command: LD_LIBRARY_PATH=. your-app-name
to your CF's manifest.yml
Or add
web: LD_LIBRARY_PATH=. ./your-app-name
to your Procfile.
7. Push your app!
8. If your app requires a firewall to communicate to New Relic, it will use the HTTP_PROXY env variable by default.
As explained earlier this will not run on Darwin or any non-Linux environment.
Follow the above guide for Heroku/Cloud Foundry, but build with:
go build -tags heroku ./...
Run your app with:
LD_LIBRARY_PATH=. ./your-app-name
Check out the examples folder for a 'hello world'.
Check the original repo for more.