From affd4cbd64597418e20abc47e4393c3c22c7d3d6 Mon Sep 17 00:00:00 2001 From: jigold Date: Mon, 23 Oct 2023 11:17:16 -0400 Subject: [PATCH] [ci] Fix namespace used for logging queries on PR page (#13813) DEFAULT_NAMESPACE will always point to `default` for the production CI deployment. --- ci/ci/ci.py | 4 +++- ci/ci/utils.py | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ci/ci/ci.py b/ci/ci/ci.py index c6e08388f34..8acd737c13f 100644 --- a/ci/ci/ci.py +++ b/ci/ci/ci.py @@ -191,7 +191,9 @@ async def get_pr(request: web.Request, userdata: UserData) -> web.Response: start_time = status['time_created'] end_time = status['time_completed'] assert start_time is not None - page_context['logging_queries'] = gcp_logging_queries(start_time, end_time) + page_context['logging_queries'] = gcp_logging_queries( + batch.attributes['namespace'], start_time, end_time + ) else: page_context['logging_queries'] = None else: diff --git a/ci/ci/utils.py b/ci/ci/utils.py index 0bc7bebad11..26157828653 100644 --- a/ci/ci/utils.py +++ b/ci/ci/utils.py @@ -7,8 +7,6 @@ from gear import Database from gear.cloud_config import get_gcp_config -from .environment import DEFAULT_NAMESPACE - def generate_token(size=12): assert size > 0 @@ -105,9 +103,8 @@ def gcp_worker_logging_url( return f'https://console.cloud.google.com/logs/query;query={urllib.parse.quote(query)};{urllib.parse.quote(timestamp_query)}?project={project}' -def gcp_logging_queries(start_time: str, end_time: Optional[str]): +def gcp_logging_queries(namespace: str, start_time: str, end_time: Optional[str]): project = get_gcp_config().project - namespace = DEFAULT_NAMESPACE return { 'batch-k8s-error-warning': gcp_service_logging_url( project,