AppSignal Go Configuration

This documentation explains how to configure OpenTelemetry to export data to AppSignal. To report OpenTelemetry data to AppSignal, several things need to be configured in the Go OpenTelemetry packages.

Initialize the OpenTelemetry tracer

The OpenTelemetry tracer must be initialized before or during your application's start-up (in a web application, before the routes are loaded and the server starts) to ensure that all telemetry data is sent through the exporter to AppSignal.

We recommend that you create an initTracer() function like the one in the example below:

func initTracer() func(context.Context) error { client := otlptracehttp.NewClient( otlptracehttp.WithInsecure(), otlptracehttp.WithEndpoint(""), ) exporter, err := otlptrace.New(context.Background(), client) if err != nil { log.Fatal("creating OTLP trace exporter: %w") } tracerProvider := sdktrace.NewTracerProvider( sdktrace.WithSampler(sdktrace.AlwaysSample()), sdktrace.WithBatcher(exporter), ) otel.SetTracerProvider(tracerProvider) return exporter.Shutdown } func main() { cleanup := initTracer() defer cleanup(context.Background()) // Your app start up code. // ... }

This example contains the basic setup for a Go app using OpenTelemetry that exports data to the AppSignal standalone agent listening on port 8099.

Add Instrumentation Packages

The next step is to instrument Go packages like Gin-gonic, Gorilla, etc. This will provide much more data to really dig into the performance of your applications.

The steps for every package are usually as follows:

  • Install the OpenTelemetry instrumentation package for the library you want to instrument.
  • Follow the installation instructions for the instrumentation package.

For more installation and configuration information per library, please consult the Go instrumentations section.