This topic documents how to get started with the LaunchDarkly observability plugin for the Go SDK.
The Go SDK supports the observability plugin for error monitoring, logging, and tracing.
LaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
This reference guide assumes that you are somewhat familiar with the LaunchDarkly Go SDK.
The observability plugin is compatible with the Go SDK, version 7.11 and later. Using the observability plugin requires Go 1.24.3 or higher.
Follow these steps to get started:
LaunchDarkly uses a plugin to the Go SDK to provide observability.
The first step is to make both the SDK and the observability plugin available as dependencies. How you do this depends on what dependency management system you are using:
go build will automatically download them. The SDK and its dependencies are modules.go get command and specify the SDK version, such as go get github.com/launchdarkly/go-server-sdk/v7 and go get github.com/launchdarkly/observability-sdk/go.There are several packages that you can import, depending on which features you are using. To work with observability, you need the following:
Next, initialize the SDK and the plugin.
To initialize, you need your LaunchDarkly environment’s SDK key. This authorizes your application to connect to a particular environment within LaunchDarkly. To learn more, read Initialize the client in the Go SDK reference guide.
Here’s how to initialize the SDK and plugin:
You can configure options for the observability plugin when you initialize the SDK. The plugin constructor takes an optional function with the configuration details.
Here is an example:
For more information on plugin options, as well as how they interact with environment variables and existing OpenTelemetry configuration, read Configuration for server-side observability.
LaunchDarkly provides several examples, each demonstrating the LaunchDarkly Observability plugin with different Go frameworks and libraries:
The observability plugin supports the following features. After the SDK and plugins are initialized, you can access these from within your application:
After you initialize the SDK and observability plugin, your application automatically starts sending observability data back to LaunchDarkly in the form of custom events. You can review this information in the LaunchDarkly user interface. To learn how, read Observability and OpenTelemetry autogenerated metrics.