1
Upgrade the SDK
2
Install the OpenTelemetry package
Add
@braintrust/otel to your project:3
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:
4
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():5
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.