mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Update import statements for ProbeMonitor and ServerMonitor to use ProbeMonitorResponse and ServerMonitorResponse
This commit is contained in:
@@ -67,6 +67,9 @@ import logger from "CommonServer/Utils/Logger";
|
||||
import "./Jobs/Probe/SendOwnerAddedNotification";
|
||||
import "./Jobs/Probe/UpdateConnectionStatus";
|
||||
|
||||
// Telemetry Monitors.
|
||||
import "./Jobs/TelemetryMonitor/MonitorTelemetryMonitor";
|
||||
|
||||
const WorkersFeatureSet: FeatureSet = {
|
||||
init: async (): Promise<void> => {
|
||||
try {
|
||||
|
||||
@@ -108,7 +108,7 @@ export class MonitorTypeHelper {
|
||||
monitorType: MonitorType.Logs,
|
||||
title: "Logs",
|
||||
description: "This monitor type lets you monitor logs from any source.",
|
||||
}
|
||||
},
|
||||
// ,
|
||||
// {
|
||||
// monitorType: MonitorType.Metrics,
|
||||
|
||||
@@ -48,8 +48,7 @@ export default class ObjectID extends DatabaseProperty {
|
||||
}
|
||||
|
||||
public static toJSONArray(ids: Array<ObjectID>): Array<JSONObject> {
|
||||
|
||||
if(!ids || ids.length === 0) {
|
||||
if (!ids || ids.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class MigrationName1722892318363 implements MigrationInterface {
|
||||
public name = "MigrationName1722892318363";
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "Monitor" ADD "telemetryMonitorNextMonitorAt" TIMESTAMP WITH TIME ZONE`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "Monitor" ADD "telemetryMonitorLastMonitorAt" TIMESTAMP WITH TIME ZONE`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "Incident" ADD "telemetryQuery" jsonb`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_540a4857bf04eabc59775ca210" ON "Monitor" ("telemetryMonitorNextMonitorAt") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_02bae6cdc6d5b3092ac393fbb3" ON "Monitor" ("telemetryMonitorLastMonitorAt") `,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "public"."IDX_02bae6cdc6d5b3092ac393fbb3"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "public"."IDX_540a4857bf04eabc59775ca210"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "Incident" DROP COLUMN "telemetryQuery"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "Monitor" DROP COLUMN "telemetryMonitorLastMonitorAt"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "Monitor" DROP COLUMN "telemetryMonitorNextMonitorAt"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import { MigrationName1721754545771 } from "./1721754545771-MigrationName";
|
||||
import { MigrationName1721779190475 } from "./1721779190475-MigrationName";
|
||||
import { MigrationName1722031205897 } from "./1722031205897-MigrationName";
|
||||
import { MigrationName1722543640526 } from "./1722543640526-MigrationName";
|
||||
import { MigrationName1722892318363 } from "./1722892318363-MigrationName";
|
||||
|
||||
export default [
|
||||
InitialMigration,
|
||||
@@ -78,4 +79,5 @@ export default [
|
||||
MigrationName1721779190475,
|
||||
MigrationName1722031205897,
|
||||
MigrationName1722543640526,
|
||||
MigrationName1722892318363,
|
||||
];
|
||||
|
||||
@@ -84,7 +84,7 @@ const LogMonitorStepForm: FunctionComponent<ComponentProps> = (
|
||||
value: 86400,
|
||||
},
|
||||
],
|
||||
title: "Monitor Logs for Last",
|
||||
title: "Monitor Logs for",
|
||||
isAdvancedFilter: true,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import OneUptimeDate from "Common/Types/Date";
|
||||
import InfoCard from "CommonUI/src/Components/InfoCard/InfoCard";
|
||||
import React, { FunctionComponent, ReactElement } from "react";
|
||||
import TelemetryMonitorSummary from "./Types/TelemetryMonitorSummary";
|
||||
|
||||
export interface ComponentProps {
|
||||
telemetryMonitorSummary?: TelemetryMonitorSummary | undefined;
|
||||
}
|
||||
|
||||
const WebsiteMonitorSummaryView: FunctionComponent<ComponentProps> = (
|
||||
props: ComponentProps,
|
||||
): ReactElement => {
|
||||
|
||||
return (
|
||||
<div className="space-y-5">
|
||||
<div className="flex space-x-3">
|
||||
<InfoCard
|
||||
className="w-1/2 shadow-none border-2 border-gray-100 "
|
||||
title="Monitored At"
|
||||
value={
|
||||
props.telemetryMonitorSummary?.lastCheckedAt
|
||||
? OneUptimeDate.getDateAsLocalFormattedString(
|
||||
props.telemetryMonitorSummary?.lastCheckedAt,
|
||||
)
|
||||
: "-"
|
||||
}
|
||||
/>
|
||||
<InfoCard
|
||||
className="w-1/2 shadow-none border-2 border-gray-100 "
|
||||
title="Next Check At"
|
||||
value={
|
||||
props.telemetryMonitorSummary?.nextCheckAt
|
||||
? OneUptimeDate.getDateAsLocalFormattedString(
|
||||
props.telemetryMonitorSummary?.nextCheckAt,
|
||||
)
|
||||
: "-"
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default WebsiteMonitorSummaryView;
|
||||
@@ -10,6 +10,7 @@ import Card from "CommonUI/src/Components/Card/Card";
|
||||
import { MonitorStepProbeResponse } from "Common/Models/DatabaseModels/MonitorProbe";
|
||||
import Probe from "Common/Models/DatabaseModels/Probe";
|
||||
import React, { FunctionComponent, ReactElement, useEffect } from "react";
|
||||
import TelemetryMonitorSummary from "./Types/TelemetryMonitorSummary";
|
||||
|
||||
export interface ComponentProps {
|
||||
probeMonitorResponses?: Array<MonitorStepProbeResponse> | undefined;
|
||||
@@ -17,6 +18,7 @@ export interface ComponentProps {
|
||||
serverMonitorResponse?: ServerMonitorResponse | undefined;
|
||||
probes?: Array<Probe>;
|
||||
monitorType: MonitorType;
|
||||
telemetryMonitorSummary?: TelemetryMonitorSummary | undefined;
|
||||
}
|
||||
|
||||
const Summary: FunctionComponent<ComponentProps> = (
|
||||
@@ -81,6 +83,7 @@ const Summary: FunctionComponent<ComponentProps> = (
|
||||
probeMonitorResponses={probeResponses}
|
||||
incomingMonitorRequest={props.incomingMonitorRequest}
|
||||
serverMonitorResponse={props.serverMonitorResponse}
|
||||
telemetryMonitorSummary={props.telemetryMonitorSummary}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@@ -12,12 +12,16 @@ import MonitorType, {
|
||||
import ProbeMonitorResponse from "Common/Types/Probe/ProbeMonitorResponse";
|
||||
import ErrorMessage from "CommonUI/src/Components/ErrorMessage/ErrorMessage";
|
||||
import React, { FunctionComponent, ReactElement } from "react";
|
||||
import LogMonitorSummaryView from "./LogMonitorView";
|
||||
import TelemetryMonitorSummary from "./Types/TelemetryMonitorSummary";
|
||||
|
||||
|
||||
export interface ComponentProps {
|
||||
monitorType: MonitorType;
|
||||
probeMonitorResponses?: Array<ProbeMonitorResponse> | undefined; // this is an array because of multiple monitor steps.
|
||||
incomingMonitorRequest?: IncomingMonitorRequest | undefined;
|
||||
serverMonitorResponse?: ServerMonitorResponse | undefined;
|
||||
telemetryMonitorSummary?: TelemetryMonitorSummary | undefined;
|
||||
}
|
||||
|
||||
const SummaryInfo: FunctionComponent<ComponentProps> = (
|
||||
@@ -85,6 +89,15 @@ const SummaryInfo: FunctionComponent<ComponentProps> = (
|
||||
);
|
||||
}
|
||||
|
||||
if (props.monitorType === MonitorType.Logs) {
|
||||
return (
|
||||
<LogMonitorSummaryView
|
||||
key={key}
|
||||
telemetryMonitorSummary={props.telemetryMonitorSummary}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return <></>;
|
||||
};
|
||||
|
||||
@@ -124,7 +137,7 @@ const SummaryInfo: FunctionComponent<ComponentProps> = (
|
||||
)}
|
||||
|
||||
{props.incomingMonitorRequest &&
|
||||
props.monitorType === MonitorType.IncomingRequest ? (
|
||||
props.monitorType === MonitorType.IncomingRequest ? (
|
||||
<IncomingRequestMonitorView
|
||||
incomingMonitorRequest={props.incomingMonitorRequest}
|
||||
/>
|
||||
@@ -133,7 +146,7 @@ const SummaryInfo: FunctionComponent<ComponentProps> = (
|
||||
)}
|
||||
|
||||
{props.monitorType === MonitorType.Server &&
|
||||
props.serverMonitorResponse ? (
|
||||
props.serverMonitorResponse ? (
|
||||
<ServerMonitorSummaryView
|
||||
serverMonitorResponse={props.serverMonitorResponse}
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export default interface TelemetryMonitorSummary {
|
||||
lastCheckedAt?: Date | undefined;
|
||||
nextCheckAt?: Date | undefined;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import DisabledWarning from "../../../Components/Monitor/DisabledWarning";
|
||||
import IncomingMonitorLink from "../../../Components/Monitor/IncomingRequestMonitor/IncomingMonitorLink";
|
||||
import { MonitorCharts } from "../../../Components/Monitor/MonitorCharts/MonitorChart";
|
||||
import ServerMonitorDocumentation from "../../../Components/Monitor/ServerMonitor/Documentation";
|
||||
import Metrics from "../../../Components/Monitor/SummaryView/Summary";
|
||||
import Summary from "../../../Components/Monitor/SummaryView/Summary";
|
||||
import ProbeUtil from "../../../Utils/Probe";
|
||||
import PageComponentProps from "../../PageComponentProps";
|
||||
import InBetween from "Common/Types/BaseDatabase/InBetween";
|
||||
@@ -184,6 +184,8 @@ const MonitorView: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
serverMonitorResponse: true,
|
||||
isNoProbeEnabledOnThisMonitor: true,
|
||||
isAllProbesDisconnectedFromThisMonitor: true,
|
||||
telemetryMonitorLastMonitorAt: true,
|
||||
telemetryMonitorNextMonitorAt: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -600,12 +602,16 @@ const MonitorView: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Metrics
|
||||
<Summary
|
||||
monitorType={monitorType!}
|
||||
probes={probes}
|
||||
incomingMonitorRequest={incomingMonitorRequest}
|
||||
probeMonitorResponses={probeResponses}
|
||||
serverMonitorResponse={serverMonitorResponse}
|
||||
telemetryMonitorSummary={{
|
||||
lastCheckedAt: monitor?.telemetryMonitorLastMonitorAt,
|
||||
nextCheckAt: monitor?.telemetryMonitorNextMonitorAt
|
||||
}}
|
||||
/>
|
||||
|
||||
{shouldFetchMonitorMetrics && getMonitorMetricsChartGroup()}
|
||||
|
||||
@@ -261,7 +261,8 @@ export default class CriteriaFilterUtil {
|
||||
i.value === FilterType.GreaterThan ||
|
||||
i.value === FilterType.LessThan ||
|
||||
i.value === FilterType.LessThanOrEqualTo ||
|
||||
i.value === FilterType.GreaterThanOrEqualTo
|
||||
i.value === FilterType.GreaterThanOrEqualTo ||
|
||||
i.value === FilterType.EqualTo
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user