Go Custom Instrumentation
AppSignal is compatible with several OpenTelemetry instrumentation packages.
This does not always cover all of your application's libraries and code. For more fine-grained reporting, you can add custom instrumentation.
We support Go tracing as laid out in the OpenTelemetry documentation. To make spans show up in the AppSignal interface with more detail, it is necessary to add some AppSignal specific attributes to spans.
These span attributes are described in more detail in our OpenTelemetry Custom Instrumentation Attributes section. This page will give some examples on how to set those attributes on spans in Go apps.
When adding custom instrumentation, first import the OpenTelemetry trace package in the file you want to add the instrumentation to.
Then using that trace package, create a new span:
Note that the context might vary depending on which part of your app you're instrumenting from, we'll use
context.Background() for the example
ctx, span := tracer.Start(context.Background(), "hello-span") defer span.End()
More ways to create and get spans is documented in the OpenTelemetry Go Manual Instrumentation page.
Once you have created, or fetched, a span, you can set certain attributes that are specific to AppSignal to customize how the data arrives in AppSignal. Find the full list of attributes in our OpenTelemetry attributes section.