Install New Relic APM's Go agent to monitor your Go language apps and microservices.
Compatibility and requirements
The New Relic Go agent requires Golang 1.7 or higher on Linux, macOS, or Windows. For full compatibility information, see Go agent compatibility and requirements.
Install the Go agent
In order to install the New Relic Go agent, you need a New Relic license key. Then, to install the agent:
From http://github.com/newrelic/go-agent, use your preferred process; for example:
go get github.com/newrelic/go-agent
- Import the
github.com/newrelic/go-agent/v3/newrelicpackage in your application.
Initialize the New Relic Go agent by adding the following in the
mainfunction or in an
app, err := newrelic.NewApplication( newrelic.ConfigAppName("Your Application Name"), newrelic.ConfigLicense("__YOUR_NEW_RELIC_LICENSE_KEY__"), )
Instrument web transactions by wrapping standard HTTP requests in your app code. For example:
http.HandleFunc(newrelic.WrapHandleFunc(app, "/users", usersHandler))
- Instrument other transactions you want to monitor.
- Optional: Instrument segments for an extra level of timing detail.
- Compile and deploy your application.
View your app's data in New Relic
Wait a few minutes for your application to send data to New Relic. Then, check your app's performance in the New Relic APM UI. If no data appears within a few minutes, follow the troubleshooting tips.
Keep your agent up to date
To take full advantage of New Relic's latest features, enhancements, and important security patches, keep your app's Go agent up to date.