If you’re not using OpenTelemetry, just upgrade the SDK. If you are using OpenTelemetry features, follow the full migration steps:Documentation Index
Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Update imports
Replace imports from
braintrust with imports from @braintrust/otel for OpenTelemetry-related functionality.-
BraintrustSpanProcessor
Before:
After:
-
BraintrustExporter
Before:
After:
-
Distributed tracing utilities
Before:
After:
Update OTel compatibility
If you were previously using the After:If you’re writing tests and need to reset the compatibility mode between test cases, use
BRAINTRUST_OTEL_COMPAT=true environment variable to enable bidirectional interoperability between Braintrust and OpenTelemetry spans, you should now use setupOtelCompat() instead.Before:Important: Call
setupOtelCompat() before creating any Braintrust loggers or OpenTelemetry spans.resetOtelCompat():Verify your setup
After updating imports and, if necessary, OTel compatibility, verify your integration works correctly:
- Run your build process to ensure no import errors.
- Test that traces appear in Braintrust as expected.
- If using distributed tracing, verify parent-child relationships are maintained.
If you encounter issues during migration, please open an issue with details about your setup and the problem you’re experiencing.