Skip to content

feat(temporal): add temporal integrations auto instrumentation#367

Merged
Abhijeet Prasad (AbhiPrasad) merged 3 commits intomainfrom
abhi-feat-temporal-integration-auto-instrument
Apr 29, 2026
Merged

feat(temporal): add temporal integrations auto instrumentation#367
Abhijeet Prasad (AbhiPrasad) merged 3 commits intomainfrom
abhi-feat-temporal-integration-auto-instrument

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

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:

import braintrust

braintrust.auto_instrument()

For explicit setup without global auto-instrumentation, users can call setup_temporal():

from braintrust.integrations.temporal import setup_temporal

setup_temporal(project_name="my-project")

If an application manually constructs Temporal plugin lists, use BraintrustPlugin directly:

from braintrust.integrations.temporal import BraintrustPlugin

plugins = [BraintrustPlugin(), *existing_plugins]

Migration guide: replace old contrib imports with integrations imports for new code:

# 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.

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.

README.md now lists Temporal as an auto-instrumented integration.

Tests: nox -s "test_temporal(latest)"
Nova (SFK) and others added 2 commits April 29, 2026 16:14
The lazy `__getattr__` re-exports of `BraintrustInterceptor` and
`BraintrustPlugin` were tripping pylint's `undefined-all-variable` and
`no-name-in-module` checks. Adding a TYPE_CHECKING import makes the
names visible to static analysis without forcing temporalio to load at
import time.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit a17f7b5 into main Apr 29, 2026
82 checks passed
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the abhi-feat-temporal-integration-auto-instrument branch April 29, 2026 18:07
Abhijeet Prasad (AbhiPrasad) added a commit that referenced this pull request May 4, 2026
@AbhiPrasad
Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants