Go OpenTelemetry APM

Complete these tasks to properly integrate OpenTelemetry APM in Go:

Install

Run these install commands to install Go packages:

go get go.opentelemetry.io/otel \
  go.opentelemetry.io/otel/trace \
  go.opentelemetry.io/otel/sdk \

Set Up Instrumentation

To set up the instrumentation, follow these steps from the see OpenTelemetry’s documentation of Instrumentation Setup.

For creating spans using the OpenTelemetry Go, use the following OpenTelemetry documentation: Creating Spans.

To use auto-instrumentation instead of manually creating spans for your functions, explore the Instrumentation Libraries.

Instrumentation Libraries

OpenTelemetry Go can automatically instrument and support a number of libraries, frameworks, and application servers, as separate third-party NPN packages. We recommend that you review the available OpenTelemetry Registry for Go.

To install any of the packages in the instrumentation library, run the following command:

go get go.opentelemetry.io/contrib/instrumentation/{import-path}/otel{package-name}

Examples

You can use a set of fully-functional, working examples of OpenTelemetry for Go from OpenTelemetry Go.