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({ new AnalyticsTableColumn({
key: "attributes", key: "attributes",
title: "Attributes", title: "Attributes",

View File

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

View File

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

View File

@ -1,14 +1,17 @@
import { MigrationInterface, QueryRunner } from "typeorm"; import { MigrationInterface, QueryRunner } from "typeorm";
export class MigrationName1724659071843 implements MigrationInterface { export class MigrationName1724659071843 implements MigrationInterface {
public name = 'MigrationName1724659071843' public name = "MigrationName1724659071843";
public async up(queryRunner: QueryRunner): Promise<void> { public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "TelemetryException" ADD "occuranceCount" integer NOT NULL DEFAULT '1'`); await queryRunner.query(
`ALTER TABLE "TelemetryException" ADD "occuranceCount" integer NOT NULL DEFAULT '1'`,
);
} }
public async down(queryRunner: QueryRunner): Promise<void> { public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "TelemetryException" DROP COLUMN "occuranceCount"`); await queryRunner.query(
`ALTER TABLE "TelemetryException" DROP COLUMN "occuranceCount"`,
);
} }
} }

View File

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

View File

@ -35,7 +35,7 @@ export type SpanStatus = opentelemetry.api.SpanStatus;
export enum SpanStatusCode { export enum SpanStatusCode {
UNSET = 0, UNSET = 0,
OK = 1, OK = 1,
ERROR = 2 ERROR = 2,
} }
export default class Telemetry { export default class Telemetry {

View File

@ -76,7 +76,15 @@ router.get(
//get list of monitors to be monitored //get list of monitors to be monitored
const monitorProbes: Array<MonitorProbe> = const monitorProbes: Array<MonitorProbe> =
await MonitorProbeService.findBy({ 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: { sort: {
nextPingAt: SortOrder.Ascending, nextPingAt: SortOrder.Ascending,
}, },
@ -229,7 +237,15 @@ router.get(
//get list of monitors to be monitored //get list of monitors to be monitored
const firstMonitorToBeFetched: MonitorProbe | null = const firstMonitorToBeFetched: MonitorProbe | null =
await MonitorProbeService.findOneBy({ 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: { select: {
nextPingAt: true, nextPingAt: true,
monitorId: true, monitorId: true,

View File

@ -308,17 +308,21 @@ router.post(
exception.traceId = dbSpan.traceId; exception.traceId = dbSpan.traceId;
exception.time = eventTime; exception.time = eventTime;
exception.timeUnixNano = eventTimeUnixNano; exception.timeUnixNano = eventTimeUnixNano;
exception.message = (eventAttributes["exception.message"] as string) || ""; exception.message =
exception.stackTrace = (eventAttributes["exception.stacktrace"] as string) || ""; (eventAttributes["exception.message"] as string) || "";
exception.exceptionType = (eventAttributes["exception.type"] as string) || ""; exception.stackTrace =
exception.escaped = (eventAttributes["exception.escaped"] as boolean) || false; (eventAttributes["exception.stacktrace"] as string) || "";
exception.exceptionType =
(eventAttributes["exception.type"] as string) || "";
exception.escaped =
(eventAttributes["exception.escaped"] as boolean) || false;
const exceptionAttributes: JSONObject = { const exceptionAttributes: JSONObject = {
...eventAttributes, ...eventAttributes,
}; };
for(const keys of Object.keys(exceptionAttributes)) { for (const keys of Object.keys(exceptionAttributes)) {
// delete all keys that start with exception to avoid duplicate keys because we already saved it. // delete all keys that start with exception to avoid duplicate keys because we already saved it.
if(keys.startsWith("exception.")) { if (keys.startsWith("exception.")) {
delete exceptionAttributes[keys]; delete exceptionAttributes[keys];
} }
} }