• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

Install New Relic for Go

Our Go agent auto-instruments your code so you can start monitoring your Go language apps and microservices. You can use our launcher, or follow the instructions in this document to complete a basic Go agent installation.

If you don't have one already, create a New Relic account. It's free, forever.

Add Go data

Compatibility and requirements

The Go agent requires Golang 1.17 or higher on Linux, macOS, or Windows. For more information, see Go agent compatibility and requirements.

Install the Go agent

In order to install the Go agent, you need a . Then, to install the agent:

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

    bash
    $
    go get github.com/newrelic/go-agent/v3/newrelic
  2. Import the github.com/newrelic/go-agent/v3/newrelic package in your application.

    import "github.com/newrelic/go-agent/v3/newrelic"
  3. Initialize the Go agent by adding the following in the main function or in an init block:

    app, err := newrelic.NewApplication(
    newrelic.ConfigAppName("Your Application Name"),
    newrelic.ConfigLicense("YOUR_NEW_RELIC_LICENSE_KEY")
    )
  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 APM UI. If no data appears within a few minutes, follow the troubleshooting tips.

Did this doc help with your installation?

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.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.