Set up the Agentedit

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

Install the Agentedit

Install the Elastic APM Go agent package using go get:

go get -u go.elastic.co/apm

Requirementsedit

The Go agent is tested with Go 1.8+ on Linux, Windows, and MacOS.

Instrument Go Source Codeedit

Instrumentation is the process of extending your application’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 Agentedit

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.