mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Update SendCreatedResourceNotification to convert rootCause to HTML
This commit is contained in:
@@ -135,8 +135,11 @@ RunCron(
|
||||
MarkdownContentType.Email,
|
||||
)) || "",
|
||||
rootCause:
|
||||
await Markdown.convertToHTML(incident.rootCause ||
|
||||
"No root cause identified for this incident", MarkdownContentType.Email) || "",
|
||||
(await Markdown.convertToHTML(
|
||||
incident.rootCause ||
|
||||
"No root cause identified for this incident",
|
||||
MarkdownContentType.Email,
|
||||
)) || "",
|
||||
incidentViewLink: (
|
||||
await IncidentService.getIncidentLinkInDashboard(
|
||||
incident.projectId!,
|
||||
|
||||
@@ -142,7 +142,11 @@ export class CriteriaFilterUtil {
|
||||
monitorType === MonitorType.API ||
|
||||
monitorType === MonitorType.Website
|
||||
) {
|
||||
return [CheckOn.IsOnline, CheckOn.ResponseStatusCode, CheckOn.ResponseTime];
|
||||
return [
|
||||
CheckOn.IsOnline,
|
||||
CheckOn.ResponseStatusCode,
|
||||
CheckOn.ResponseTime,
|
||||
];
|
||||
} else if (
|
||||
monitorType === MonitorType.Ping ||
|
||||
monitorType === MonitorType.IP ||
|
||||
|
||||
@@ -52,8 +52,7 @@ export default class EvaluateOverTime {
|
||||
|
||||
const values: Array<number | boolean> = monitorMetricsItems
|
||||
.map((item: MonitorMetricsByMinute) => {
|
||||
|
||||
if(data.metricType === CheckOn.IsOnline) {
|
||||
if (data.metricType === CheckOn.IsOnline) {
|
||||
return item.metricValue === 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,8 @@ export default class ProbeMonitorResponseService {
|
||||
|
||||
// get last log. We do this because there are many monitoring steps and we need to store those.
|
||||
logger.debug(
|
||||
`${dataToProcess.monitorId.toString()} - monitor type ${monitor.monitorType
|
||||
`${dataToProcess.monitorId.toString()} - monitor type ${
|
||||
monitor.monitorType
|
||||
}`,
|
||||
);
|
||||
|
||||
@@ -254,7 +255,7 @@ export default class ProbeMonitorResponseService {
|
||||
if (incidentTemplate.autoResolveIncident) {
|
||||
if (
|
||||
!autoResolveCriteriaInstanceIdIncidentIdsDictionary[
|
||||
criteriaInstance.data.id.toString()
|
||||
criteriaInstance.data.id.toString()
|
||||
]
|
||||
) {
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary[
|
||||
@@ -315,11 +316,13 @@ export default class ProbeMonitorResponseService {
|
||||
|
||||
if (response.criteriaMetId && response.rootCause) {
|
||||
logger.debug(
|
||||
`${dataToProcess.monitorId.toString()} - Criteria met: ${response.criteriaMetId
|
||||
`${dataToProcess.monitorId.toString()} - Criteria met: ${
|
||||
response.criteriaMetId
|
||||
}`,
|
||||
);
|
||||
logger.debug(
|
||||
`${dataToProcess.monitorId.toString()} - Root cause: ${response.rootCause
|
||||
`${dataToProcess.monitorId.toString()} - Root cause: ${
|
||||
response.rootCause
|
||||
}`,
|
||||
);
|
||||
|
||||
@@ -334,7 +337,7 @@ export default class ProbeMonitorResponseService {
|
||||
!response.criteriaMetId &&
|
||||
monitorSteps.data.defaultMonitorStatusId &&
|
||||
monitor.currentMonitorStatusId?.toString() !==
|
||||
monitorSteps.data.defaultMonitorStatusId.toString()
|
||||
monitorSteps.data.defaultMonitorStatusId.toString()
|
||||
) {
|
||||
logger.debug(
|
||||
`${dataToProcess.monitorId.toString()} - No criteria met. Change to default status.`,
|
||||
@@ -623,7 +626,7 @@ export default class ProbeMonitorResponseService {
|
||||
input.criteriaInstance.data?.changeMonitorStatus &&
|
||||
input.criteriaInstance.data?.monitorStatusId &&
|
||||
input.criteriaInstance.data?.monitorStatusId.toString() !==
|
||||
input.monitor.currentMonitorStatusId?.toString()
|
||||
input.monitor.currentMonitorStatusId?.toString()
|
||||
) {
|
||||
logger.debug(
|
||||
`${input.monitor.id?.toString()} - Change monitor status to ${input.criteriaInstance.data?.monitorStatusId.toString()}`,
|
||||
@@ -677,9 +680,9 @@ export default class ProbeMonitorResponseService {
|
||||
(incident: Incident) => {
|
||||
return (
|
||||
incident.createdCriteriaId ===
|
||||
input.criteriaInstance.data?.id.toString() &&
|
||||
input.criteriaInstance.data?.id.toString() &&
|
||||
incident.createdIncidentTemplateId ===
|
||||
criteriaIncident.id.toString()
|
||||
criteriaIncident.id.toString()
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -784,9 +787,9 @@ export default class ProbeMonitorResponseService {
|
||||
openIncident: Incident;
|
||||
rootCause: string;
|
||||
dataToProcess:
|
||||
| ProbeMonitorResponse
|
||||
| IncomingMonitorRequest
|
||||
| DataToProcess;
|
||||
| ProbeMonitorResponse
|
||||
| IncomingMonitorRequest
|
||||
| DataToProcess;
|
||||
}): Promise<void> {
|
||||
const resolvedStateId: ObjectID =
|
||||
await IncidentStateTimelineService.getResolvedStateIdForProject(
|
||||
@@ -846,7 +849,7 @@ export default class ProbeMonitorResponseService {
|
||||
|
||||
if (
|
||||
input.autoResolveCriteriaInstanceIdIncidentIdsDictionary[
|
||||
input.openIncident.createdCriteriaId?.toString()
|
||||
input.openIncident.createdCriteriaId?.toString()
|
||||
]
|
||||
) {
|
||||
if (
|
||||
@@ -905,7 +908,7 @@ export default class ProbeMonitorResponseService {
|
||||
|
||||
if ((input.dataToProcess as ProbeMonitorResponse).failureCause) {
|
||||
input.probeApiIngestResponse.rootCause += `
|
||||
**Failure Cause**: ${((input.dataToProcess as ProbeMonitorResponse).failureCause || "")}
|
||||
**Cause**: ${(input.dataToProcess as ProbeMonitorResponse).failureCause || ""}
|
||||
`;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -284,6 +284,10 @@ export class MonitorCharts {
|
||||
}
|
||||
|
||||
public static getChartTitle(data: { checkOn: CheckOn }): string {
|
||||
if (data.checkOn === CheckOn.IsOnline) {
|
||||
return "Monitor Status (Online/Offline)";
|
||||
}
|
||||
|
||||
return data.checkOn;
|
||||
}
|
||||
|
||||
@@ -299,7 +303,7 @@ export class MonitorCharts {
|
||||
} else if (data.checkOn === CheckOn.CPUUsagePercent) {
|
||||
return "CPU Usage in % for this server.";
|
||||
} else if (data.checkOn === CheckOn.IsOnline) {
|
||||
return "Online or Offline Monitor Status.";
|
||||
return "Online or Offline Monitor Status. 1 is Online, 0 is Offline.";
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user