Set up the Agent
editSet up the Agent
editTo start reporting your Go application’s performance to Elastic APM, you need to do a few things:
Install the Agent
editInstall the Elastic APM Go agent package using go get
:
go get -u go.elastic.co/apm
Requirements
editThe Go agent is tested with Go 1.8+ on Linux, Windows, and MacOS.
Instrument Go Source Code
editInstrumentation 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:
- Using Built-in instrumentation modules.
- Custom instrumentation and Context propagation with the Go Agent API.
Where possible, use the built-in modules to report transactions served by web and RPC frameworks in your application.
Configure the Agent
editTo 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.