EventInterceptor tracks workflow and activity execution events for monitoring and observability. Automatically publishes events when workflows and activities start and end, including workflow state information. All activities automatically publish start/end events, and all workflows automatically publish start/end events with state. Events are published even if workflows or activities fail, and event publishing failures are logged but don't fail workflows.
EventInterceptor is part of the Interceptors system and can be combined with other interceptors.
EventInterceptor
Classapplication_sdk.interceptors.eventsTracks workflow and activity execution events for monitoring and observability. Automatically publishes events when workflows and activities start and end, including workflow state information. All activities automatically publish start/end events, and all workflows automatically publish start/end events with state. Events are published even if workflows or activities fail, and event publishing failures are logged but don't fail workflows.
Methods1
__init__
__init__(self)Usage Examples
Register EventInterceptor with worker
Register EventInterceptor to automatically track workflow and activity events
from temporalio.worker import Worker
from application_sdk.interceptors import EventInterceptor
worker = Worker(
client,
task_queue="my-task-queue",
workflows=[MyWorkflow],
activities=[my_activity],
interceptors=[EventInterceptor()]
)
Event types
The EventInterceptor automatically publishes these event types:
| Event Name | Event Type | When Published | Metadata |
|---|---|---|---|
ACTIVITY_START | APPLICATION_EVENT | Before activity execution | None |
ACTIVITY_END | APPLICATION_EVENT | After activity execution | None |
WORKFLOW_START | APPLICATION_EVENT | Before workflow execution | workflow_state: RUNNING |
WORKFLOW_END | APPLICATION_EVENT | After workflow execution | workflow_state: COMPLETED or FAILED |
See also
- Interceptors: Overview of all interceptors and how to combine them
- RedisLockInterceptor: Manage distributed locks for activities using Redis
- CleanupInterceptor: Automatically clean up temporary artifacts and activity state
- Handle events: Event handling patterns in workflows