File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,6 +68,35 @@ export GOFLAGS="-toolexec='orchestrion toolexec'"
6868go 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+
71100That's it! Your LLM client calls are now automatically traced. No middleware or wrapper code needed in your application.
72101
73102### Manual Instrumentation
You can’t perform that action at this time.
0 commit comments