github.com/waldiirawan/apm-agent-go/v2@v2.2.2/docs/introduction.asciidoc (about) 1 [[introduction]] 2 == Introduction 3 4 The Elastic APM Go Agent enables you to trace the execution of operations in your https://golang.org/[Go] 5 applications, sending performance metrics and errors to the Elastic APM server. 6 It has built-in support for popular frameworks and toolkits, 7 like http://www.gorillatoolkit.org/[Gorilla] and https://gin-gonic.com/[Gin], 8 as well as support for instrumenting Go's built-in https://golang.org/pkg/net/http/[net/http], 9 https://golang.org/pkg/database/sql/[database/sql] drivers. 10 The Agent also offers an <<api>> for custom instrumentation. 11 12 [float] 13 [[how-it-works]] 14 === How does the Agent work? 15 16 The Agent includes instrumentation modules for <<supported-tech>>, 17 each providing middleware or wrappers for recording interesting events, such as incoming HTTP requests, outgoing HTTP requests, and database queries. 18 19 To collect data about incoming HTTP requests, install router middleware for one of the supported <<supported-tech-web-frameworks>>. 20 Incoming requests will be recorded as transactions, along with any related panics or errors. 21 22 To collect data for outgoing HTTP requests, instrument an `http.Client` or `http.Transport` using <<builtin-modules-apmhttp>>. 23 To collect data about database queries, use <<builtin-modules-apmsql>>, 24 which provides instrumentation for well known database drivers. 25 26 In order to connect transactions with related spans and errors, and propagate traces between services (distributed tracing), 27 the agent relies on Go's built-in https://golang.org/pkg/context/[context] package: 28 transactions and spans are stored in context objects. 29 For example, for incoming HTTP requests, in-flight trace data will be recorded in the `context` object accessible through 30 https://golang.org/pkg/net/http/#Request.Context[net/http.Context]. 31 Read more about this in <<custom-instrumentation-propagation>>. 32 33 In addition to capturing events like those mentioned above, 34 the agent also collects system and application metrics at regular intervals. 35 This collection happens in a background goroutine that is automatically started when the agent is initialized. 36 37 [float] 38 [[additional-components]] 39 === Additional Components 40 41 APM Agents work in conjunction with the {apm-guide-ref}/index.html[APM Server], {ref}/index.html[Elasticsearch], and {kibana-ref}/index.html[Kibana]. 42 The {apm-guide-ref}/index.html[APM Guide] provides details on how these components work together, 43 and provides a matrix outlining {apm-guide-ref}/agent-server-compatibility.html[Agent and Server compatibility].