Skip to content

Commit

Permalink
Set cursor timestamp in Logs Explorer links to the beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiitk committed Feb 1, 2024
1 parent 8462f02 commit 5c27685
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions framework/test_app/runners/k8s/k8s_base_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ def logs_explorer_run_history_links(self):
gcp_ui_url=self.gcp_ui_url,
deployment_id=run.deployment_id,
start_time=run.time_start_requested,
cursor_time=run.time_start_completed,
end_time=run.time_stopped,
)

Expand All @@ -929,6 +930,7 @@ def _logs_explorer_link(
deployment_id: Optional[str] = None,
start_time: Optional[_datetime] = None,
end_time: Optional[_datetime] = None,
cursor_time: Optional[_datetime] = None,
):
"""Output the link to test server/client logs in GCP Logs Explorer."""
if not start_time:
Expand All @@ -939,6 +941,10 @@ def _logs_explorer_link(
logs_start = _helper_datetime.iso8601_utc_time(start_time)
logs_end = _helper_datetime.iso8601_utc_time(end_time)
request = {"timeRange": f"{logs_start}/{logs_end}"}
if cursor_time:
request["cursorTimestamp"] = _helper_datetime.iso8601_utc_time(
cursor_time
)
query = {
"resource.type": "k8s_container",
"resource.labels.project_id": gcp_project,
Expand Down

0 comments on commit 5c27685

Please sign in to comment.