Install New Relic for Go

Install New Relic for Go to monitor your Go language apps and microservices.

For more about the features of New Relic for Go, see Welcome to New Relic for Go.

Compatibility and requirements

To use New Relic Go monitoring, you must be using Golang 1.3 or higher on Linux, OS X, or Windows.

Get New Relic for Go

To install New Relic for Go:

  1. You'll need a New Relic license key. If you already have a New Relic account, you can find your license key in the New Relic user interface. If you don't yet have an account, sign up for New Relic here.
  2. Install the New Relic Go agent from http://github.com/newrelic/go-agent using your preferred process (for example, go get github.com/newrelic/go-agent).
  3. Import the github.com/newrelic/go-agent package in your application.
  4. Initialize the New Relic 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)
    	
  5. Instrument web transactions by wrapping standard HTTP requests in your app code. Here's an example:

    http.HandleFunc(newrelic.WrapHandleFunc(app, "/users", usersHandler))
    				
  6. Instrument other transactions you want to monitor. Optionally, you can also instrument segments for an extra level of timing detail.

  7. Compile and deploy your application.

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.

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

For more help

Additional documentation resources include:

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.