Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0589a99
Clean up references/core/ai-integration.md
donald-pinckney Feb 13, 2026
22d90c5
Clean up references/core/common-gotchas.md
donald-pinckney Feb 13, 2026
a32152b
Clean up references/core/common-gotchas.md
donald-pinckney Feb 13, 2026
9ce8441
Clean up references/core/determinism.md
donald-pinckney Feb 13, 2026
519b2ea
Clean up references/core/determinism.md
donald-pinckney Feb 13, 2026
49c449a
Update error-reference.md
donald-pinckney Feb 17, 2026
d2a4af3
Update interactive-workflows.md
donald-pinckney Feb 17, 2026
e62865a
Clean up patterns.md
donald-pinckney Feb 17, 2026
324b532
Cut shell scripts
donald-pinckney Feb 17, 2026
5d3f79f
Edit troubleshooting.md
donald-pinckney Feb 17, 2026
19a9589
remove interceptors for now
donald-pinckney Feb 18, 2026
761b220
remove dynamic workflows
donald-pinckney Feb 18, 2026
4d032f4
clarify on heartbeating of async activity completions, and prompt it …
donald-pinckney Feb 18, 2026
8d77164
Improve references/python/advanced-features.md
donald-pinckney Feb 18, 2026
ceb40a0
Use explicit namespace in connect
donald-pinckney Feb 18, 2026
c61bc64
remove duplicated content from determinism.md, clean up
donald-pinckney Feb 18, 2026
236eab2
Improve references/python/data-handling.md
donald-pinckney Feb 18, 2026
43b1ed7
Prefer start_to_close_timeout
donald-pinckney Feb 18, 2026
cc593e3
don't explicitely provide defaults for retry policies
donald-pinckney Feb 18, 2026
24f0e3e
error-handling.md cleanup
donald-pinckney Feb 18, 2026
18cb1e8
move idempotency patterns to patterns.md
donald-pinckney Feb 18, 2026
03e8706
remove multi-param activities
donald-pinckney Feb 18, 2026
3f7dc9d
small edits
donald-pinckney Feb 18, 2026
9163fa2
Unify sandbox stuff into one file
donald-pinckney Feb 18, 2026
4c288cf
local activities aren't experimental
donald-pinckney Feb 18, 2026
b8b47ca
Clean up references/python/sync-vs-async.md
donald-pinckney Feb 18, 2026
9bc285f
Cleanup observability.md, remove duplicated search attributes
donald-pinckney Feb 19, 2026
f455d39
Cut otel for now
donald-pinckney Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup observability.md, remove duplicated search attributes
  • Loading branch information
donald-pinckney committed Feb 19, 2026
commit 9bc285f72a5f2db9dbe9e5ba4da43ce3e0c5e918
36 changes: 31 additions & 5 deletions references/python/data-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ client = await Client.connect(

## Search Attributes

Custom searchable fields for workflow visibility.
Custom searchable fields for workflow visibility. These can be created at workflow start:

```python
from temporalio.common import (
Expand Down Expand Up @@ -141,11 +141,37 @@ handle = await client.start_workflow(
SearchAttributePair(CREATED_AT, datetime.now(timezone.utc)),
]),
)
```

Or upserted during workflow execution:

```python
from temporalio import workflow
from temporalio.common import SearchAttributeKey, SearchAttributePair, TypedSearchAttributes

# Inside workflow: upsert
workflow.upsert_search_attributes(TypedSearchAttributes([
SearchAttributePair(ORDER_STATUS, "completed"),
]))
ORDER_STATUS = SearchAttributeKey.for_keyword("OrderStatus")

@workflow.defn
class OrderWorkflow:
@workflow.run
async def run(self, order: Order) -> str:
# ... process order ...

# Update search attribute
workflow.upsert_search_attributes(TypedSearchAttributes([
SearchAttributePair(ORDER_STATUS, "completed"),
]))
return "done"
```

### Querying Workflows by Search Attributes

```python
# List workflows using search attributes
async for workflow in client.list_workflows(
'OrderStatus = "processing" OR OrderStatus = "pending"'
):
print(f"Workflow {workflow.id} is still processing")
```

## Workflow Memo
Expand Down
84 changes: 15 additions & 69 deletions references/python/observability.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,16 @@ Activity logger includes:
- Workflow ID and run ID
- Attempt number (for retries)

### Custom Logger Configuration
### Customizing Logger Configuration

```python
import logging

# Configure a custom handler
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
))

# Apply to Temporal's logger
temporal_logger = logging.getLogger("temporalio")
temporal_logger.addHandler(handler)
temporal_logger.setLevel(logging.INFO)
# Applies to temporalio.workflow.logger and temporalio.activity.logger, as Temporal inherits the default logger
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)
```

## Metrics
Expand All @@ -75,18 +70,19 @@ temporal_logger.setLevel(logging.INFO)
from temporalio.client import Client
from temporalio.runtime import Runtime, TelemetryConfig, PrometheusConfig

# Configure Prometheus metrics endpoint
# Create a custom runtime
runtime = Runtime(
telemetry=TelemetryConfig(
metrics=PrometheusConfig(bind_address="0.0.0.0:9090")
metrics=PrometheusConfig(bind_address="0.0.0.0:9000")
)
)

client = await Client.connect(
"localhost:7233",
namespace="default",
runtime=runtime,
)
# Set it as the global default BEFORE any Client/Worker is created
# Do this only ONCE.
Runtime.set_default(runtime, error_if_already_set=True)
# error_if_already_set can be False if you want to overwrite an existing default without raising.

# ...elsewhere, client = ... as usual
```

### Key SDK Metrics
Expand Down Expand Up @@ -130,59 +126,9 @@ worker = Worker(

## Search Attributes (Visibility)

### Setting Search Attributes at Start
See the Search Attributes section of `references/python/data-handling.md`

```python
from temporalio.common import SearchAttributes, SearchAttributeKey

# Define typed search attribute keys
ORDER_ID = SearchAttributeKey.for_keyword("OrderId")
CUSTOMER_TYPE = SearchAttributeKey.for_keyword("CustomerType")
ORDER_TOTAL = SearchAttributeKey.for_float("OrderTotal")

# Start workflow with search attributes
await client.execute_workflow(
OrderWorkflow.run,
order,
id=f"order-{order.id}",
task_queue="orders",
search_attributes=SearchAttributes.from_pairs([
(ORDER_ID, order.id),
(CUSTOMER_TYPE, order.customer_type),
(ORDER_TOTAL, order.total),
]),
)
```

### Upserting Search Attributes from Workflow

```python
@workflow.defn
class OrderWorkflow:
@workflow.run
async def run(self, order: Order) -> str:
# Update status as workflow progresses
workflow.upsert_search_attributes([
(ORDER_STATUS, "processing"),
])

await workflow.execute_activity(process_order, order, ...)

workflow.upsert_search_attributes([
(ORDER_STATUS, "completed"),
])
return "done"
```

### Querying Workflows by Search Attributes

```python
# List workflows using search attributes
async for workflow in client.list_workflows(
'OrderStatus = "processing" AND CustomerType = "premium"'
):
print(f"Workflow {workflow.id} is still processing")
```

## Best Practices

Expand Down