Skip to content

Commit

Permalink
don't filter out logs for missing revision number if predeploy (#4322)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-g-town authored Feb 23, 2024
1 parent b833691 commit 2469e0e
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions dashboard/src/main/home/app-dashboard/validate-apply/logs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,15 @@ export const useLogs = ({
});
const newLogsParsed = parseLogsFromAgent(newLogs);

const logsWithRevisionNumber = newLogsParsed
.filter(
(log) =>
!!log.app_revision_id &&
!!revisionIdToNumber[log.app_revision_id] &&
revisionIdToNumber[log.app_revision_id] !== 0
)
.map((log) => ({
...log,
revision: revisionIdToNumber[log.app_revision_id].toString(),
}));
const logsWithRevisionNumber = newLogsParsed.map((log) => ({
...log,
revision:
!!log.app_revision_id &&
!!revisionIdToNumber[log.app_revision_id] &&
revisionIdToNumber[log.app_revision_id] !== 0
? revisionIdToNumber[log.app_revision_id].toString()
: "",
}));

const newLogsFiltered = filterLogs(logsWithRevisionNumber);
pushLogs(newLogsFiltered);
Expand All @@ -282,10 +280,16 @@ export const useLogs = ({
return false;
}

// if we are filtering out predeploy logs, filter out logs that have "predeploy" in the service name
if (filterPredeploy && log.service_name.endsWith("predeploy")) {
return false;
}

// if we are missing a revision number, filter out the log unless we are showing predeploy logs (which don't have a revision number)
if (!log.revision && filterPredeploy) {
return false;
}

return true;
});
};
Expand Down Expand Up @@ -341,17 +345,15 @@ export const useLogs = ({
newLogs.reverse();
}

const logsWithRevisionNumber = newLogs
.filter(
(log) =>
!!log.app_revision_id &&
!!revisionIdToNumber[log.app_revision_id] &&
revisionIdToNumber[log.app_revision_id] !== 0
)
.map((log) => ({
...log,
revision: revisionIdToNumber[log.app_revision_id].toString(),
}));
const logsWithRevisionNumber = newLogs.map((log) => ({
...log,
revision:
!!log.app_revision_id &&
!!revisionIdToNumber[log.app_revision_id] &&
revisionIdToNumber[log.app_revision_id] !== 0
? revisionIdToNumber[log.app_revision_id].toString()
: "",
}));

return {
logs: logsWithRevisionNumber,
Expand Down

0 comments on commit 2469e0e

Please sign in to comment.