• Log in

Go agent configuration

You can edit configuration settings for the Go agent to control some aspects of how New Relic monitors your app; for example:

  • Turn high-security mode on.
  • Add custom tags for filtering and sorting in the UI.
  • Turn off the collection of errors, transaction events, transaction traces, and custom events.

Configuration methods and precedence

The primary way to configure the Go agent is by modifying the newrelic.Config struct as part of calling newrelic.NewApplication(), which is part of the standard installation process. With Go agent versions 2.7.0 or higher, you can also set a limited number of configuration options using server-side configuration in the UI.

The Go agent follows this order of precedence for configuration. If enabled, server-side configuration overrides all corresponding values in the newrelic.Config struct, even if the server-side values are left blank.

If server-side configuration is enabled with the Go agent, it overrides all corresponding values in the newrelic.Config struct, even if the server-side values are left blank.

Here are detailed descriptions of each configuration method:

Change configuration settings

To make Go agent configuration changes, set the values in the newrelic.Config struct from within a custom newrelic.ConfigOption. For example, to turn New Relic monitoring off temporarily for testing purposes, change the Enabled value to false:

app, err := newrelic.NewApplication(
newrelic.ConfigAppName("Your Application Name"),
newrelic.ConfigLicense("YOUR_NEW_RELIC_LICENSE_KEY"),
func(config *newrelic.Config) {
config.Enabled = false
},
)

In this and the following examples, config represents your New Relic config struct, although you may have given it a different variable name when you installed the Go agent and initiated the configuration in your app.

General configuration settings

If you're using New Relic APM and CodeStream, see how to associate repositories and how to associate build SHAs or release tags with errors inbox.

Custom events configuration

You can create custom events and make them available for querying and analysis.

Transaction events configuration

Transaction events are used in collecting events corresponding to web requests and background tasks. Event data allows the New Relic UI to show additional information such as histograms and percentiles.

Error collector configuration

The following settings are used to configure the error collector:

Tip

For an overview of error configuration in New Relic, see Manage errors in APM.

Transaction tracer configuration

Here are settings for changing transaction tracer configuration. For more information about transaction traces, see Transaction traces.

Datastore tracer configuration

Here are datastore settings, including slow query enabling and settings.

Cross application tracing configuration

Here are settings for changing the cross application tracing feature.

Distributed tracing configuration

Important

Enabling distributed tracing requires Go agent version 2.1.0 or higher, and it disables cross application tracing. It also has effects on other features. Before enabling, read the transition guide.

Distributed tracing lets you see the path that a request takes as it travels through a distributed system.

When distributed tracing is enabled, you can collect span events.

Span events configuration

Span events are reported for distributed tracing. Distributed tracing must be enabled to report span events. These settings control the collection of span events:

Infinite Tracing configuration

To enable Infinite Tracing, enable distributed tracing (set config.DistributedTracer.Enabled = true on the newrelic.Config struct) and add the additional settings below. For an example, see Language agents: Configure distributed tracing.

For help getting a valid Infinite Tracing trace observer host entry, see Find or create a trace observer endpoint.

Application logging settings

The following settings are available for configuration of application logging in the agent.

Important

Requires Go agent version 3.17.0 or higher

Copyright © 2022 New Relic Inc.

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