Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source-zendesk-support: add logging & ticket_comments checkpoint #2088

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions source-zendesk-support/source_zendesk_support/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ def should_retry(self, response: requests.Response) -> bool:
self.logger.error(f"Skipping stream {self.name}: Check permissions, error message: {error}.")
setattr(self, "raise_on_http_errors", False)
return False
if response.status_code != 200:
self.logger.warning(f"Received a {response.status_code} response.")
return super().should_retry(response)


Expand Down Expand Up @@ -671,6 +673,8 @@ class SourceZendeskSupportTicketEventsExportStream(SourceZendeskIncrementalExpor
@ param event_type : specific event_type to check ["Audit", "Change", "Comment", etc]
"""

state_checkpoint_interval = 1000

cursor_field = "created_at"
response_list_name: str = "ticket_events"
response_target_entity: str = "child_events"
Expand Down Expand Up @@ -707,6 +711,14 @@ def request_params(
Otherwise, returns the start time param from the stream's state/config and the sideload param.
"""
if next_page_token:
# Check if the next_page_token's start time is the the same or earlier than
# the previous request's / checkpointed state's start time.
next_page_start_time = int(next_page_token.get("start_time"))
checkpointed_start_time = self.check_stream_state(stream_state=stream_state)

if next_page_start_time <= checkpointed_start_time:
self.logger.warning(f"start_time query param {next_page_start_time} is less than or equal to than previous start_time param {checkpointed_start_time}. Check if the stream is stuck in a loop.")

return next_page_token

start_time = self.check_stream_state(stream_state=stream_state)
Expand Down
Loading