prefect.server.api.events

Functions

create_events

create_events(events: List[Event], ephemeral_request: bool = Depends(is_ephemeral_request)) -> None
Record a batch of Events. For more information, see https://docs.prefect.io/v3/concepts/events.

stream_events_in

stream_events_in(websocket: WebSocket) -> None
Open a WebSocket to stream incoming Events

stream_workspace_events_out

stream_workspace_events_out(websocket: WebSocket) -> None
Open a WebSocket to stream Events

verified_page_token

verified_page_token(page_token: str = Query(..., alias='page-token')) -> str

read_events

read_events(request: Request, filter: Optional[EventFilter] = Body(None, description='Additional optional filter criteria to narrow down the set of Events'), limit: int = Body(INTERACTIVE_PAGE_SIZE, ge=0, le=INTERACTIVE_PAGE_SIZE, embed=True, description='The number of events to return with each page'), db: PrefectDBInterface = Depends(provide_database_interface)) -> EventPage
Queries for Events matching the given filter criteria in the given Account. Returns the first page of results, and the URL to request the next page (if there are more results).

read_account_events_page

read_account_events_page(request: Request, page_token: str = Depends(verified_page_token), db: PrefectDBInterface = Depends(provide_database_interface)) -> EventPage
Returns the next page of Events for a previous query against the given Account, and the URL to request the next page (if there are more results).
generate_next_page_link(request: Request, page_token: Optional[str]) -> Optional[str]

count_account_events

count_account_events(filter: EventFilter, countable: Countable = Path(...), time_unit: TimeUnit = Body(default=TimeUnit.day), time_interval: float = Body(default=1.0, ge=0.01), db: PrefectDBInterface = Depends(provide_database_interface)) -> List[EventCount]
Returns distinct objects and the count of events associated with them. Objects that can be counted include the day the event occurred, the type of event, or the IDs of the resources associated with the event.

handle_event_count_request

handle_event_count_request(session: AsyncSession, filter: EventFilter, countable: Countable, time_unit: TimeUnit, time_interval: float) -> List[EventCount]