Commit a17f7b5
feat(temporal): add temporal integrations auto instrumentation (#367)
Temporal is now available as a first-class integration via
braintrust.auto_instrument(), which patches Temporal client and worker
setup to install BraintrustPlugin automatically when temporalio is
installed.
New applications can enable Temporal tracing with:
```python
import braintrust
braintrust.auto_instrument()
```
For explicit setup without global auto-instrumentation, users can call
setup_temporal():
```python
from braintrust.integrations.temporal import setup_temporal
setup_temporal(project_name="my-project")
```
If an application manually constructs Temporal plugin lists, use
BraintrustPlugin directly:
```python
from braintrust.integrations.temporal import BraintrustPlugin
plugins = [BraintrustPlugin(), *existing_plugins]
```
Migration guide: replace old contrib imports with integrations imports
for new code:
```python
# Before
from braintrust.contrib.temporal import BraintrustPlugin, BraintrustInterceptor
# After
from braintrust.integrations.temporal import BraintrustPlugin, BraintrustInterceptor
```
Prefer braintrust.auto_instrument() for new applications. The
braintrust.contrib.temporal module remains as a deprecated compatibility
re-export for its previous public API: BraintrustPlugin and
BraintrustInterceptor.
---------
Co-authored-by: Nova (SFK) <nova@starfolk.ai>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 4b0ec7f commit a17f7b5
12 files changed
Lines changed: 613 additions & 434 deletions
File tree
- py
- src/braintrust
- contrib/temporal
- integrations
- auto_test_scripts
- temporal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
| 455 | + | |
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| 189 | + | |
| 190 | + | |
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
| |||
0 commit comments