Install New Relic for Go

Install New Relic APM's Go agent to monitor your Go language apps and microservices.

For a "before" and "after" example of instrumenting the HTTP requests in a simple Golang application, see the New Relic Go README on GitHub.

Compatibility and requirements

The New Relic Go agent requires Golang 1.3 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:

  1. From http://github.com/newrelic/go-agent, use your preferred process; for example:

    go get github.com/newrelic/go-agent
  2. Import the github.com/newrelic/go-agent package in your application.
  3. Initialize the New Relic Go agent by adding the following in the main function or in an init block:

    config := newrelic.NewConfig("Your_App_Name", "__YOUR_NEW_RELIC_LICENSE_KEY__")
    app, err := newrelic.NewApplication(config)
  4. Instrument web transactions by wrapping standard HTTP requests in your app code. For example:

    http.HandleFunc(newrelic.WrapHandleFunc(app, "/users", usersHandler))
  5. Instrument other transactions you want to monitor.
  6. Optional: Instrument segments for an extra level of timing detail.
  7. 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.

For more help

Join the discussion about Go monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.