diff --git a/Common/Models/AnalyticsModels/ExceptionInstance.ts b/Common/Models/AnalyticsModels/ExceptionInstance.ts index 97218ef578..f0b9a0e876 100644 --- a/Common/Models/AnalyticsModels/ExceptionInstance.ts +++ b/Common/Models/AnalyticsModels/ExceptionInstance.ts @@ -298,7 +298,6 @@ export default class ExceptionInstance extends AnalyticsBaseModel { }, }), - new AnalyticsTableColumn({ key: "attributes", title: "Attributes", diff --git a/Common/Models/DatabaseModels/TelemetryException.ts b/Common/Models/DatabaseModels/TelemetryException.ts index 19c1456dac..ab7d0bbea7 100644 --- a/Common/Models/DatabaseModels/TelemetryException.ts +++ b/Common/Models/DatabaseModels/TelemetryException.ts @@ -971,5 +971,4 @@ export default class TelemetryException extends DatabaseBaseModel { default: 1, }) public occuranceCount?: number = undefined; - } diff --git a/Common/Server/API/StatusAPI.ts b/Common/Server/API/StatusAPI.ts index 51a90f8d43..df30c012a8 100644 --- a/Common/Server/API/StatusAPI.ts +++ b/Common/Server/API/StatusAPI.ts @@ -1,4 +1,3 @@ - import LocalCache from "../Infrastructure/LocalCache"; import Express, { ExpressRequest, diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.ts index d81f364e6d..2be83e76bb 100644 --- a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.ts +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.ts @@ -25,7 +25,7 @@ export class MigrationName1724613666632 implements MigrationInterface { await queryRunner.query( `ALTER TABLE "TelemetryException" ADD "isArchived" boolean NOT NULL DEFAULT false`, ); - + await queryRunner.query( `ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_3def22373f0cb84e16cb355b5e5" FOREIGN KEY ("markedAsArchivedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`, ); diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.ts index 691bad02e3..43cc49cd44 100644 --- a/Common/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.ts +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.ts @@ -1,14 +1,17 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class MigrationName1724659071843 implements MigrationInterface { - public name = 'MigrationName1724659071843' + public name = "MigrationName1724659071843"; - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "TelemetryException" ADD "occuranceCount" integer NOT NULL DEFAULT '1'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "TelemetryException" DROP COLUMN "occuranceCount"`); - } + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "TelemetryException" ADD "occuranceCount" integer NOT NULL DEFAULT '1'`, + ); + } + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "TelemetryException" DROP COLUMN "occuranceCount"`, + ); + } } diff --git a/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts b/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts index 481a80d134..72967296a8 100644 --- a/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +++ b/Common/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts @@ -91,5 +91,5 @@ export default [ MigrationName1724078044172, MigrationName1724610006927, MigrationName1724613666632, - MigrationName1724659071843 + MigrationName1724659071843, ]; diff --git a/Common/Server/Utils/Telemetry.ts b/Common/Server/Utils/Telemetry.ts index 278cd344a1..be0cbdadd3 100644 --- a/Common/Server/Utils/Telemetry.ts +++ b/Common/Server/Utils/Telemetry.ts @@ -33,9 +33,9 @@ export type Span = opentelemetry.api.Span; export type SpanStatus = opentelemetry.api.SpanStatus; export enum SpanStatusCode { - UNSET = 0, - OK = 1, - ERROR = 2 + UNSET = 0, + OK = 1, + ERROR = 2, } export default class Telemetry { diff --git a/Ingestor/API/Monitor.ts b/Ingestor/API/Monitor.ts index aab3e1429d..4e9834f41d 100644 --- a/Ingestor/API/Monitor.ts +++ b/Ingestor/API/Monitor.ts @@ -76,7 +76,15 @@ router.get( //get list of monitors to be monitored const monitorProbes: Array = await MonitorProbeService.findBy({ - query: getMonitorFetchQuery(new ObjectID(req.params["probeId"])), + query: { + ...getMonitorFetchQuery(new ObjectID(req.params["probeId"])), + nextPingAt: QueryHelper.lessThanEqualToOrNull( + OneUptimeDate.addRemoveMinutes( + OneUptimeDate.getCurrentDate(), + -3, + ), + ), + }, sort: { nextPingAt: SortOrder.Ascending, }, @@ -229,7 +237,15 @@ router.get( //get list of monitors to be monitored const firstMonitorToBeFetched: MonitorProbe | null = await MonitorProbeService.findOneBy({ - query: getMonitorFetchQuery(new ObjectID(req.params["probeId"])), + query: { + ...getMonitorFetchQuery(new ObjectID(req.params["probeId"])), + nextPingAt: QueryHelper.lessThanEqualToOrNull( + OneUptimeDate.addRemoveMinutes( + OneUptimeDate.getCurrentDate(), + -3, + ), + ), + }, select: { nextPingAt: true, monitorId: true, diff --git a/Ingestor/API/OTelIngest.ts b/Ingestor/API/OTelIngest.ts index 94ac2449f0..ec65088e97 100644 --- a/Ingestor/API/OTelIngest.ts +++ b/Ingestor/API/OTelIngest.ts @@ -308,17 +308,21 @@ router.post( exception.traceId = dbSpan.traceId; exception.time = eventTime; exception.timeUnixNano = eventTimeUnixNano; - exception.message = (eventAttributes["exception.message"] as string) || ""; - exception.stackTrace = (eventAttributes["exception.stacktrace"] as string) || ""; - exception.exceptionType = (eventAttributes["exception.type"] as string) || ""; - exception.escaped = (eventAttributes["exception.escaped"] as boolean) || false; + exception.message = + (eventAttributes["exception.message"] as string) || ""; + exception.stackTrace = + (eventAttributes["exception.stacktrace"] as string) || ""; + exception.exceptionType = + (eventAttributes["exception.type"] as string) || ""; + exception.escaped = + (eventAttributes["exception.escaped"] as boolean) || false; const exceptionAttributes: JSONObject = { ...eventAttributes, }; - for(const keys of Object.keys(exceptionAttributes)) { - // delete all keys that start with exception to avoid duplicate keys because we already saved it. - if(keys.startsWith("exception.")) { + for (const keys of Object.keys(exceptionAttributes)) { + // delete all keys that start with exception to avoid duplicate keys because we already saved it. + if (keys.startsWith("exception.")) { delete exceptionAttributes[keys]; } }