Install the Go Library
In your project, install the library using the go get command:
go get github.com/solarwinds/apm-go
Initialize the library
Initialize the library, most often inside the main function of your project.
// Initialize the SolarWinds APM library
cb, err := swo.Start(
// Optionally add service-level resource attributes
semconv.ServiceVersion("v0.0.1"),
attribute.String("environment", "testing"),
)
if err != nil {
// Handle error
}
// This function returned from 'Start()' will tell the apm library to
// shut down, often deferred until the end of 'main()'.
defer cb()
Instrument your code
Use the OpenTelemetry API and publicly available OTel Go libraries to instrument your code. See the README for examples. Additional SolarWinds APM APIs are also available to provide custom features. See Using the swo
API for details.