Skip to content

Commit

Permalink
[ci] Fix namespace used for logging queries on PR page (#13813)
Browse files Browse the repository at this point in the history
DEFAULT_NAMESPACE will always point to `default` for the production CI
deployment.
  • Loading branch information
jigold authored Oct 23, 2023
1 parent aecbbff commit affd4cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion ci/ci/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 1 addition & 4 deletions ci/ci/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit affd4cb

Please sign in to comment.