No traces appear in Braintrust
No traces appear in Braintrust
Initialize Braintrust with
Braintrust.Get() before you create your provider client. Braintrust.Get() sets up the OpenTelemetry pipeline that exports spans to Braintrust, so calls made before it runs are not traced.Make your AI calls on the wrapped client returned by the integration, not the original client:#skip-compile
No traces when managing your own tracer provider
No traces when managing your own tracer provider
By default, the SDK manages OpenTelemetry and registers a process-exit hook that flushes traces when your app terminates, so even short-lived processes export correctly with no extra work.If you opt out of auto-management and wire Braintrust into your own
TracerProviderBuilder (via OpenTelemetryEnable), that hook isn’t registered. In that case, force a flush before the process exits:#skip-compile
ForceFlush returns true when the flush completes within the timeout (10 seconds by default).Traces are written to the wrong project
Traces are written to the wrong project
Spans route to Or pass it through configuration:
BRAINTRUST_DEFAULT_PROJECT_NAME, which defaults to default-dotnet-project when unset. Set the project in the environment:#skip-compile
BRAINTRUST_API_KEY is required error
BRAINTRUST_API_KEY is required error
The SDK looks for your API key in the Create an API key in API key settings if you don’t have one.
BRAINTRUST_API_KEY environment variable, then in a .env.braintrust file searched upward from the working directory. Set the variable:Debug setup and API errors
Debug setup and API errors
Enable debug logging to surface configuration and export issues, and console trace logging to confirm spans are being created before they’re exported: