Skip to content

Commit 4024ecc

Browse files
authored
chore: Add example to go readme. (#186)
## Summary Adds a basic example to the readme. ## How did you test this change? <!-- Frontend - Leave a screencast or a screenshot to visually describe the changes. --> ## Are there any deployment considerations? <!-- Backend - Do we need to consider migrations or backfilling data? -->
1 parent ee51f80 commit 4024ecc

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

go/README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,30 @@ go get github.com/launchdarkly/observability-sdk/go
1717
Install the plugin when configuring your LaunchDarkly SDK.
1818

1919
```go
20-
// TODO: Add code sample for Go observability plugin configuration
20+
import (
21+
ld "github.com/launchdarkly/go-server-sdk/v7"
22+
"github.com/launchdarkly/go-server-sdk/v7/ldplugins"
23+
ldobserve "github.com/launchdarkly/observability-sdk/go"
24+
)
25+
26+
func main() {
27+
client, _ := ld.MakeCustomClient(os.Getenv("LAUNCHDARKLY_SDK_KEY"),
28+
ld.Config{
29+
Plugins: []ldplugins.Plugin{
30+
ldobserve.NewObservabilityPlugin(
31+
ldobserve.WithEnvironment("test"),
32+
ldobserve.WithServiceName("go-plugin-example"),
33+
ldobserve.WithServiceVersion(version.Commit),
34+
),
35+
},
36+
}, 5*time.Second)
37+
38+
// Implementation specific code.
39+
}
2140
```
2241

42+
Example applications are available here: https://github.com/launchdarkly/observability-sdk/tree/main/e2e/go-plugin
43+
2344
LaunchDarkly overview
2445
-------------------------
2546
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today!

0 commit comments

Comments
 (0)