Skip to content

Commit 92ccc2e

Browse files
authored
fix go setup docs (#36)
1 parent be5960a commit 92ccc2e

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,35 @@ export GOFLAGS="-toolexec='orchestrion toolexec'"
6868
go build ./...
6969
```
7070

71+
**4. Initialize OpenTelemetry and Braintrust in your application:**
72+
```go
73+
import (
74+
"context"
75+
"log"
76+
77+
"go.opentelemetry.io/otel"
78+
"go.opentelemetry.io/otel/sdk/trace"
79+
"github.com/braintrustdata/braintrust-sdk-go"
80+
)
81+
82+
func main() {
83+
ctx := context.Background()
84+
85+
// Set up OpenTelemetry tracer
86+
tp := trace.NewTracerProvider()
87+
defer tp.Shutdown(ctx)
88+
otel.SetTracerProvider(tp)
89+
90+
// Initialize Braintrust (registers the exporter)
91+
_, err := braintrust.New(tp, braintrust.WithProject("my-project"))
92+
if err != nil {
93+
log.Fatal(err)
94+
}
95+
96+
// Your LLM calls are now automatically traced
97+
}
98+
```
99+
71100
That's it! Your LLM client calls are now automatically traced. No middleware or wrapper code needed in your application.
72101

73102
### Manual Instrumentation

0 commit comments

Comments
 (0)