Skip to main content

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

Class
📁application_sdk.interceptors.events

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.

Methods1

__init__

__init__(self)
Initialize EventInterceptor. No parameters required.

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 NameEvent TypeWhen PublishedMetadata
ACTIVITY_STARTAPPLICATION_EVENTBefore activity executionNone
ACTIVITY_ENDAPPLICATION_EVENTAfter activity executionNone
WORKFLOW_STARTAPPLICATION_EVENTBefore workflow executionworkflow_state: RUNNING
WORKFLOW_ENDAPPLICATION_EVENTAfter workflow executionworkflow_state: COMPLETED or FAILED

See also