Skip to content

Commit

Permalink
Merge pull request #947 from hpcc-systems/yadhap/change-date-format-i…
Browse files Browse the repository at this point in the history
…n-monitoring-notifications

formatted date to locale string on job monitoring notifications
  • Loading branch information
FancMa01 authored Nov 21, 2024
2 parents 25addd5 + 2dfb2d9 commit dc198c4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ const monitoring_logs = models.monitoring_logs;
},
jobName: jobName,
wuState: wuData.State,
wuId: wuData.Wuid,
monitoringName,
issue: {
Issue: _.startCase(notificationDescription),
Expand All @@ -253,7 +254,7 @@ const monitoring_logs = models.monitoring_logs;
State: wuData.State,
"Discovered at": findLocalDateTimeAtCluster(
clusterDetail.timezone_offset
),
).toLocaleString(),
},
notificationId: generateNotificationId({
notificationPrefix,
Expand All @@ -267,10 +268,10 @@ const monitoring_logs = models.monitoring_logs;
}, // region: "USA", product: "Telematics", domain: "Insurance", severity: 3,
firstLogged: findLocalDateTimeAtCluster(
clusterDetail.timezone_offset
),
).toLocaleString(),
lastLogged: findLocalDateTimeAtCluster(
clusterDetail.timezone_offset
),
).toLocaleString(),
});

// Add notification payload to notificationsToBeQueued
Expand Down
9 changes: 5 additions & 4 deletions Tombolo/server/jobs/jobMonitoring/monitorJobPunctuality.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ const Integrations = models.integrations;
Issue: `Job not started on expected time`,
Cluster: clusterInfo.name,
"Job Name/Filter": jobNamePattern,
"Expected Start": window.start,
"Current Time": window.currentTime,
"Expected Start": (window.start).toLocaleString(),
"Current Time": (window.currentTime).toLocaleString(),
},
notificationId: generateNotificationId({
notificationPrefix,
Expand All @@ -330,10 +330,10 @@ const Integrations = models.integrations;
}, // region: "USA", product: "Telematics", domain: "Insurance", severity: 3,
firstLogged: new Date(
now.getTime() + offSet * 60 * 1000
).toISOString(),
).toLocaleString(),
lastLogged: new Date(
now.getTime() + offSet * 60 * 1000
).toISOString(),
).toLocaleString(),
});

// Queue email notification
Expand Down Expand Up @@ -373,6 +373,7 @@ const Integrations = models.integrations;
);
}
} catch (error) {
console.log(error);
logger.error(
`Error while processing jobs for punctuality check ${jobMonitoring.id}: ${error.message}`
);
Expand Down
7 changes: 4 additions & 3 deletions Tombolo/server/jobs/jobMonitoring/monitorJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ const monitoring_name = "Job Monitoring";
recipients: { primaryContacts, secondaryContacts, notifyContacts },
jobName: jobName,
wuState: wu.State,
wuId : wu.Wuid,
monitoringName,
issue: {
Issue: `Job in ${wu.State} state`,
Expand All @@ -372,7 +373,7 @@ const monitoring_name = "Job Monitoring";
"Returned Job": wu.Jobname,
"Discovered at": findLocalDateTimeAtCluster(
clusterInfoObj[clusterId].timezone_offset
),
).toLocaleString(),
State: wu.State,
},
notificationId: generateNotificationId({
Expand All @@ -387,10 +388,10 @@ const monitoring_name = "Job Monitoring";
}, // region: "USA", product: "Telematics", domain: "Insurance", severity: 3,
firstLogged: findLocalDateTimeAtCluster(
clusterInfoObj[clusterId].timezone_offset
),
).toLocaleString(),
lastLogged: findLocalDateTimeAtCluster(
clusterInfoObj[clusterId].timezone_offset
),
).toLocaleString(),
});

//Create notification queue
Expand Down
2 changes: 2 additions & 0 deletions Tombolo/server/jobs/jobMonitoring/monitorJobsUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ const createNotificationPayload = ({
recipients,
notificationId,
asrSpecificMetaData = {}, // region: "USA", product: "Telematics", domain: "Insurance", severity: 3,
wuId,
issue,
firstLogged,
lastLogged,
Expand All @@ -583,6 +584,7 @@ const createNotificationPayload = ({
issue,
firstLogged,
lastLogged,
wuId,
remedy: {
Instruction:
"Please contact one of the following to facilitate issue resolution:",
Expand Down
8 changes: 8 additions & 0 deletions Tombolo/server/notificationTemplates/email/jobMonitoring.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@
</tr>
<% }%>

<% if(typeof wuId !== 'undefined'){ %>
<tr class="section-table-td">
<td class="section-table-td"> WUID</td>
<td class="section-table-td"><%= wuId %> </td>
</tr>
<% }%>


<% if(typeof severity !== 'undefined'){ %>
<tr class="section-table-td">
<td class="section-table-td"> Severity</td>
Expand Down

0 comments on commit dc198c4

Please sign in to comment.