refactor: Update telemetry exception view layout components

This commit is contained in:
Simon Larsen 2024-08-26 14:33:01 +01:00
parent cc7696f481
commit 185eb20d1b
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
9 changed files with 45 additions and 25 deletions

View File

@ -298,7 +298,6 @@ export default class ExceptionInstance extends AnalyticsBaseModel {
},
}),
new AnalyticsTableColumn({
key: "attributes",
title: "Attributes",

View File

@ -971,5 +971,4 @@ export default class TelemetryException extends DatabaseBaseModel {
default: 1,
})
public occuranceCount?: number = undefined;
}

View File

@ -1,4 +1,3 @@
import LocalCache from "../Infrastructure/LocalCache";
import Express, {
ExpressRequest,

View File

@ -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`,
);

View File

@ -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<void> {
await queryRunner.query(`ALTER TABLE "TelemetryException" ADD "occuranceCount" integer NOT NULL DEFAULT '1'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "TelemetryException" DROP COLUMN "occuranceCount"`);
}
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "TelemetryException" ADD "occuranceCount" integer NOT NULL DEFAULT '1'`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "TelemetryException" DROP COLUMN "occuranceCount"`,
);
}
}

View File

@ -91,5 +91,5 @@ export default [
MigrationName1724078044172,
MigrationName1724610006927,
MigrationName1724613666632,
MigrationName1724659071843
MigrationName1724659071843,
];

View File

@ -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 {

View File

@ -76,7 +76,15 @@ router.get(
//get list of monitors to be monitored
const monitorProbes: Array<MonitorProbe> =
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,

View File

@ -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];
}
}