This is a cache of https://www.elastic.co/guide/en/apm/agent/go/current/getting-started.html. It is a snapshot of the page at 2024-09-27T01:00:33.455+0000.
Set up the Agent | APM Go Agent Reference [<strong>2</strong>.x] | Elastic

Set up the Agent

edit

To start reporting your Go application217;s performance to Elastic APM, you need to do a few things:

Install the Agent

edit

Within a Go module, install the Elastic APM Go agent package using go get:

go get -u go.elastic.co/apm/v2

Requirements

edit

You can find a list of the supported frameworks and other technologies in the Supported Technologies section.

Instrument Go Source Code

edit

Instrumentation is the process of extending your application217;s code to report trace data to Elastic APM. Go applications must be instrumented manually at the source code level. There are two ways to instrument your applications:

Where possible, use the built-in modules to report transactions served by web and RPC frameworks in your application.

Configure the Agent

edit

To simplify development and testing, the agent defaults to sending data to the Elastic APM Server at http://localhost:8200. To send data to an alternative location, you must configure ELASTIC_APM_SERVER_URL. Depending on the configuration of your server, you may also need to set ELASTIC_APM_API_KEY, ELASTIC_APM_SECRET_TOKEN, and ELASTIC_APM_VERIFY_SERVER_CERT. All other variables have usable defaults.

See Configuration to learn about all available options.