From b6282f25b7a2412fa71fa04bbe84750d91256c86 Mon Sep 17 00:00:00 2001 From: keyonghan <54558023+keyonghan@users.noreply.github.com> Date: Mon, 18 Jul 2022 11:12:04 -0700 Subject: [PATCH] Add logs for autosubmit triage (#1987) --- auto_submit/lib/requests/check_pull_request.dart | 4 ++++ auto_submit/lib/service/validation_service.dart | 2 ++ 2 files changed, 6 insertions(+) diff --git a/auto_submit/lib/requests/check_pull_request.dart b/auto_submit/lib/requests/check_pull_request.dart index 3c1ba561b..d168732b2 100644 --- a/auto_submit/lib/requests/check_pull_request.dart +++ b/auto_submit/lib/requests/check_pull_request.dart @@ -45,6 +45,7 @@ class CheckPullRequest extends AuthenticatedRequestHandler { log.info('There are no requests in the queue'); return Response.ok('No requests in the queue.'); } + log.info('Processing ${receivedMessages.length} messages'); ValidationService validationService = ValidationService(config); final List> futures = >[]; @@ -52,12 +53,15 @@ class CheckPullRequest extends AuthenticatedRequestHandler { final String messageData = message.message!.data!; final rawBody = json.decode(String.fromCharCodes(base64.decode(messageData))) as Map; final PullRequest pullRequest = PullRequest.fromJson(rawBody); + log.info('Processing PR: $pullRequest'); if (processingLog.contains(pullRequest.number)) { // Ack duplicate. + log.info('Ack the duplicated message : ${message.ackId!}.'); await pubsub.acknowledge('auto-submit-queue-sub', message.ackId!); continue; } else { await approver.approve(pullRequest); + log.info('Approved pull request: $pullRequest'); processingLog.add(pullRequest.number!); } futures.add(validationService.processMessage(pullRequest, message.ackId!, pubsub)); diff --git a/auto_submit/lib/service/validation_service.dart b/auto_submit/lib/service/validation_service.dart index d9bc6afea..fb4a69e89 100644 --- a/auto_submit/lib/service/validation_service.dart +++ b/auto_submit/lib/service/validation_service.dart @@ -61,6 +61,7 @@ class ValidationService { /// Processes a pub/sub message associated with PullRequest event. Future processMessage(github.PullRequest messagePullRequest, String ackId, PubSub pubsub) async { if (!await shouldProcess(messagePullRequest)) { + log.info('Shout not process $messagePullRequest, and ack the message.'); await pubsub.acknowledge('auto-submit-queue-sub', ackId); return; } @@ -119,6 +120,7 @@ class ValidationService { // If we got to this point it means we are ready to submit the PR. bool processed = await processMerge(config, result, messagePullRequest); if (processed) await pubsub.acknowledge('auto-submit-queue-sub', ackId); + log.info('Ack the processed message : $ackId.'); } /// Merges the commit if the PullRequest passes all the validations.