@oneuptime/common 7.0.2990 → 7.0.3010
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/ExceptionInstance.ts +488 -0
- package/Models/AnalyticsModels/Index.ts +2 -0
- package/Models/AnalyticsModels/Span.ts +2 -2
- package/Models/DatabaseModels/Index.ts +4 -0
- package/Models/DatabaseModels/TelemetryException.ts +978 -0
- package/Server/API/StatusAPI.ts +63 -51
- package/Server/EnvironmentConfig.ts +3 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.ts +93 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.ts +60 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.ts +17 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Infrastructure/Queue.ts +36 -1
- package/Server/Infrastructure/QueueWorker.ts +2 -2
- package/Server/Services/DatabaseService.ts +4 -5
- package/Server/Services/ExceptionInstanceService.ts +11 -0
- package/Server/Services/Index.ts +5 -0
- package/Server/Services/StatusPageDomainService.ts +118 -59
- package/Server/Services/TelemetryExceptionService.ts +10 -0
- package/Server/Types/Database/Permissions/Index.ts +1 -1
- package/Server/Types/Database/UpdateByID.ts +1 -1
- package/Server/Utils/Greenlock/Greenlock.ts +331 -204
- package/Server/Utils/Logger.ts +8 -2
- package/Server/Utils/Telemetry.ts +109 -25
- package/Types/Code/CodeType.ts +1 -0
- package/Types/Database/PartialEntity.ts +14 -1
- package/Types/Date.ts +9 -1
- package/Types/Icon/IconProp.ts +2 -0
- package/Types/Permission.ts +39 -0
- package/UI/Components/ActionCard/ActionCard.tsx +66 -0
- package/UI/Components/Alerts/Alert.tsx +69 -60
- package/UI/Components/Card/Card.tsx +1 -0
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +4 -17
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +1005 -0
- package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +3 -0
- package/UI/Components/Charts/ChartLibrary/Utils/ChartColors.ts +117 -0
- package/UI/Components/Charts/ChartLibrary/Utils/Cx.ts +8 -0
- package/UI/Components/Charts/ChartLibrary/Utils/GetYAxisDomain.ts +15 -0
- package/UI/Components/Charts/ChartLibrary/Utils/HasOnlyOneValueForKey.ts +19 -0
- package/UI/Components/Charts/ChartLibrary/Utils/UseWindowOnResize.ts +17 -0
- package/UI/Components/Charts/Line/LineChart.tsx +58 -225
- package/UI/Components/Charts/Types/ChartCurve.ts +7 -0
- package/UI/Components/Charts/Types/DataPoint.ts +7 -0
- package/UI/Components/Charts/Types/SeriesPoint.ts +7 -0
- package/UI/Components/Charts/Types/SeriesPoints.ts +6 -0
- package/UI/Components/Charts/Types/XAxis/XAxis.ts +21 -0
- package/UI/Components/Charts/Types/XAxis/XAxisMaxMin.ts +3 -0
- package/UI/Components/Charts/Types/XAxis/XAxisPrecision.ts +26 -0
- package/UI/Components/Charts/Types/XAxis/XAxisType.ts +6 -0
- package/UI/Components/Charts/Types/XValue.ts +3 -0
- package/UI/Components/Charts/Types/YAxis/YAxis.ts +22 -0
- package/UI/Components/Charts/Types/YAxis/YAxisMaxMin.ts +3 -0
- package/UI/Components/Charts/Types/YAxis/YAxisType.ts +5 -0
- package/UI/Components/Charts/Types/YValue.ts +3 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +188 -0
- package/UI/Components/Charts/Utils/XAxis.ts +267 -0
- package/UI/Components/Detail/Detail.tsx +6 -1
- package/UI/Components/GanttChart/Row/Row.tsx +4 -2
- package/UI/Components/GanttChart/Row/RowLabel.tsx +7 -3
- package/UI/Components/Icon/Icon.tsx +16 -0
- package/UI/Components/LogsViewer/LogsViewer.tsx +1 -1
- package/UI/Components/Types/FieldType.ts +1 -0
- package/UI/Config.ts +2 -0
- package/UI/Utils/Telemetry.ts +7 -2
- package/Utils/Crypto.ts +11 -0
- package/build/dist/Models/AnalyticsModels/ExceptionInstance.js +445 -0
- package/build/dist/Models/AnalyticsModels/ExceptionInstance.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/Index.js +2 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Span.js +2 -2
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryException.js +1010 -0
- package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -0
- package/build/dist/Server/API/StatusAPI.js +52 -44
- package/build/dist/Server/API/StatusAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +1 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.js +26 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Queue.js +20 -1
- package/build/dist/Server/Infrastructure/Queue.js.map +1 -1
- package/build/dist/Server/Infrastructure/QueueWorker.js +2 -2
- package/build/dist/Server/Infrastructure/QueueWorker.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/ExceptionInstanceService.js +9 -0
- package/build/dist/Server/Services/ExceptionInstanceService.js.map +1 -0
- package/build/dist/Server/Services/Index.js +4 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/StatusPageDomainService.js +101 -53
- package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +9 -0
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -0
- package/build/dist/Server/Types/Database/Permissions/Index.js.map +1 -1
- package/build/dist/Server/Utils/Greenlock/Greenlock.js +234 -157
- package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
- package/build/dist/Server/Utils/Logger.js +5 -1
- package/build/dist/Server/Utils/Logger.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry.js +63 -22
- package/build/dist/Server/Utils/Telemetry.js.map +1 -1
- package/build/dist/Types/Code/CodeType.js +1 -0
- package/build/dist/Types/Code/CodeType.js.map +1 -1
- package/build/dist/Types/Database/PartialEntity.js +3 -0
- package/build/dist/Types/Database/PartialEntity.js.map +1 -1
- package/build/dist/Types/Date.js +7 -1
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/Icon/IconProp.js +2 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/Permission.js +33 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/UI/Components/ActionCard/ActionCard.js +27 -0
- package/build/dist/UI/Components/ActionCard/ActionCard.js.map +1 -0
- package/build/dist/UI/Components/Alerts/Alert.js +36 -45
- package/build/dist/UI/Components/Alerts/Alert.js.map +1 -1
- package/build/dist/UI/Components/Card/Card.js +1 -1
- package/build/dist/UI/Components/Card/Card.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +4 -9
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +388 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/ChartColors.js +88 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/ChartColors.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/Cx.js +7 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/Cx.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/GetYAxisDomain.js +7 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/GetYAxisDomain.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/HasOnlyOneValueForKey.js +14 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/HasOnlyOneValueForKey.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/UseWindowOnResize.js +14 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/UseWindowOnResize.js.map +1 -0
- package/build/dist/UI/Components/Charts/Line/LineChart.js +30 -136
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/ChartCurve.js +8 -0
- package/build/dist/UI/Components/Charts/Types/ChartCurve.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/DataPoint.js +2 -0
- package/build/dist/UI/Components/Charts/Types/DataPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/SeriesPoint.js +2 -0
- package/build/dist/UI/Components/Charts/Types/SeriesPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/SeriesPoints.js +2 -0
- package/build/dist/UI/Components/Charts/Types/SeriesPoints.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxis.js +8 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxis.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisMaxMin.js +2 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisMaxMin.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js +27 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisType.js +7 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisType.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XValue.js +2 -0
- package/build/dist/UI/Components/Charts/Types/XValue.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxis.js +8 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxis.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxisMaxMin.js +2 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxisMaxMin.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxisType.js +6 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxisType.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/YValue.js +2 -0
- package/build/dist/UI/Components/Charts/Types/YValue.js.map +1 -0
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +109 -0
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js +241 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -0
- package/build/dist/UI/Components/Detail/Detail.js +5 -1
- package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
- package/build/dist/UI/Components/GanttChart/Row/Row.js +2 -2
- package/build/dist/UI/Components/GanttChart/Row/Row.js.map +1 -1
- package/build/dist/UI/Components/GanttChart/Row/RowLabel.js +3 -3
- package/build/dist/UI/Components/GanttChart/Row/RowLabel.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +6 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/Types/FieldType.js +1 -0
- package/build/dist/UI/Components/Types/FieldType.js.map +1 -1
- package/build/dist/UI/Config.js +1 -0
- package/build/dist/UI/Config.js.map +1 -1
- package/build/dist/UI/Utils/Telemetry.js +6 -3
- package/build/dist/UI/Utils/Telemetry.js.map +1 -1
- package/build/dist/Utils/Crypto.js +10 -0
- package/build/dist/Utils/Crypto.js.map +1 -0
- package/package.json +15 -13
- package/UI/Components/Charts/Bar/Bar.tsx +0 -0
- package/UI/Components/Charts/Base/BaseChart.tsx +0 -0
- package/UI/Components/Charts/Tooltip/Tooltip.tsx +0 -84
- package/build/dist/UI/Components/Charts/Bar/Bar.js +0 -2
- package/build/dist/UI/Components/Charts/Bar/Bar.js.map +0 -1
- package/build/dist/UI/Components/Charts/Base/BaseChart.js +0 -2
- package/build/dist/UI/Components/Charts/Base/BaseChart.js.map +0 -1
- package/build/dist/UI/Components/Charts/Tooltip/Tooltip.js +0 -34
- package/build/dist/UI/Components/Charts/Tooltip/Tooltip.js.map +0 -1
package/Server/API/StatusAPI.ts
CHANGED
|
@@ -6,7 +6,7 @@ import Express, {
|
|
|
6
6
|
} from "../Utils/Express";
|
|
7
7
|
import logger from "../Utils/Logger";
|
|
8
8
|
import Response from "../Utils/Response";
|
|
9
|
-
import Telemetry from "../Utils/Telemetry";
|
|
9
|
+
import Telemetry, { Span, TelemetryCounter } from "../Utils/Telemetry";
|
|
10
10
|
import Exception from "Common/Types/Exception/Exception";
|
|
11
11
|
import ServerException from "Common/Types/Exception/ServerException";
|
|
12
12
|
|
|
@@ -16,36 +16,36 @@ export interface StatusAPIOptions {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default class StatusAPI {
|
|
19
|
-
public static statusCheckSuccessCounter = Telemetry.getCounter({
|
|
20
|
-
name: "status.check.success",
|
|
21
|
-
description: "Status check counter",
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// ready counter
|
|
25
|
-
public static stausReadySuccess = Telemetry.getCounter({
|
|
26
|
-
name: "status.ready.success",
|
|
27
|
-
description: "Ready check counter",
|
|
28
|
-
});
|
|
29
|
-
// live counter
|
|
30
|
-
|
|
31
|
-
public static stausLiveSuccess = Telemetry.getCounter({
|
|
32
|
-
name: "status.live.success",
|
|
33
|
-
description: "Live check counter",
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// ready failed counter
|
|
37
|
-
public static stausReadyFailed = Telemetry.getCounter({
|
|
38
|
-
name: "status.ready.failed",
|
|
39
|
-
description: "Ready check counter",
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// live failed counter
|
|
43
|
-
public static stausLiveFailed = Telemetry.getCounter({
|
|
44
|
-
name: "status.live.failed",
|
|
45
|
-
description: "Live check counter",
|
|
46
|
-
});
|
|
47
|
-
|
|
48
19
|
public static init(options: StatusAPIOptions): ExpressRouter {
|
|
20
|
+
const statusCheckSuccessCounter: TelemetryCounter = Telemetry.getCounter({
|
|
21
|
+
name: "status.check.success",
|
|
22
|
+
description: "Status check counter",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// ready counter
|
|
26
|
+
const stausReadySuccess: TelemetryCounter = Telemetry.getCounter({
|
|
27
|
+
name: "status.ready.success",
|
|
28
|
+
description: "Ready check counter",
|
|
29
|
+
});
|
|
30
|
+
// live counter
|
|
31
|
+
|
|
32
|
+
const stausLiveSuccess: TelemetryCounter = Telemetry.getCounter({
|
|
33
|
+
name: "status.live.success",
|
|
34
|
+
description: "Live check counter",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// ready failed counter
|
|
38
|
+
const stausReadyFailed: TelemetryCounter = Telemetry.getCounter({
|
|
39
|
+
name: "status.ready.failed",
|
|
40
|
+
description: "Ready check counter",
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// live failed counter
|
|
44
|
+
const stausLiveFailed: TelemetryCounter = Telemetry.getCounter({
|
|
45
|
+
name: "status.live.failed",
|
|
46
|
+
description: "Live check counter",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
49
|
const router: ExpressRouter = Express.getRouter();
|
|
50
50
|
|
|
51
51
|
router.get("/app-name", (_req: ExpressRequest, res: ExpressResponse) => {
|
|
@@ -54,7 +54,7 @@ export default class StatusAPI {
|
|
|
54
54
|
|
|
55
55
|
// General status
|
|
56
56
|
router.get("/status", (req: ExpressRequest, res: ExpressResponse) => {
|
|
57
|
-
|
|
57
|
+
statusCheckSuccessCounter.add(1);
|
|
58
58
|
|
|
59
59
|
logger.info("Status check: ok");
|
|
60
60
|
|
|
@@ -67,24 +67,35 @@ export default class StatusAPI {
|
|
|
67
67
|
router.get(
|
|
68
68
|
"/status/ready",
|
|
69
69
|
async (req: ExpressRequest, res: ExpressResponse) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
return Telemetry.startActiveSpan({
|
|
71
|
+
name: "/status/ready",
|
|
72
|
+
fn: async (span: Span) => {
|
|
73
|
+
try {
|
|
74
|
+
logger.debug("Ready check");
|
|
75
|
+
await options.readyCheck();
|
|
76
|
+
logger.info("Ready check: ok");
|
|
77
|
+
stausReadySuccess.add(1);
|
|
78
|
+
|
|
79
|
+
span.recordException(new ServerException("Server is ready"));
|
|
80
|
+
|
|
81
|
+
Response.sendJsonObjectResponse(req, res, {
|
|
82
|
+
status: "ok",
|
|
83
|
+
});
|
|
84
|
+
span.end();
|
|
85
|
+
} catch (e) {
|
|
86
|
+
span.recordException(e as Exception);
|
|
87
|
+
stausReadyFailed.add(1);
|
|
88
|
+
Response.sendErrorResponse(
|
|
89
|
+
req,
|
|
90
|
+
res,
|
|
91
|
+
e instanceof Exception
|
|
92
|
+
? e
|
|
93
|
+
: new ServerException("Server is not ready"),
|
|
94
|
+
);
|
|
95
|
+
span.end();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
});
|
|
88
99
|
},
|
|
89
100
|
);
|
|
90
101
|
|
|
@@ -96,12 +107,13 @@ export default class StatusAPI {
|
|
|
96
107
|
logger.debug("Live check");
|
|
97
108
|
await options.readyCheck();
|
|
98
109
|
logger.info("Live check: ok");
|
|
99
|
-
|
|
110
|
+
stausLiveSuccess.add(1);
|
|
111
|
+
|
|
100
112
|
Response.sendJsonObjectResponse(req, res, {
|
|
101
113
|
status: "ok",
|
|
102
114
|
});
|
|
103
115
|
} catch (e) {
|
|
104
|
-
|
|
116
|
+
stausLiveFailed.add(1);
|
|
105
117
|
Response.sendErrorResponse(
|
|
106
118
|
req,
|
|
107
119
|
res,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1724610006927 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1724610006927";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "TelemetryException" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP, "version" integer NOT NULL, "projectId" uuid NOT NULL, "telemetryServiceId" uuid NOT NULL, "message" character varying, "stackTrace" character varying, "exceptionType" character varying, "fingerprint" character varying(100), "createdByUserId" uuid, "deletedByUserId" uuid, "markedAsResolvedAt" TIMESTAMP WITH TIME ZONE, "markedAsMutedAt" TIMESTAMP WITH TIME ZONE, "firstSeenAt" TIMESTAMP WITH TIME ZONE, "lastSeenAt" TIMESTAMP WITH TIME ZONE, "assignToUserId" uuid, "assignToTeamId" uuid, "markedAsResolvedByUserId" uuid, "markedAsMutedByUserId" uuid, CONSTRAINT "PK_53717afe73c3e72c11713e5e25f" PRIMARY KEY ("_id"))`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE INDEX "IDX_3310c3a807a7e8bca9d1bd8e0e" ON "TelemetryException" ("projectId") `,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`CREATE INDEX "IDX_6470c69cb5f53c5899c0483df5" ON "TelemetryException" ("telemetryServiceId") `,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`CREATE INDEX "IDX_e270eb229cd583c653c2176db9" ON "TelemetryException" ("fingerprint") `,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_3310c3a807a7e8bca9d1bd8e0eb" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
27
|
+
);
|
|
28
|
+
await queryRunner.query(
|
|
29
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_6470c69cb5f53c5899c0483df5f" FOREIGN KEY ("telemetryServiceId") REFERENCES "TelemetryService"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
30
|
+
);
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_d2e1b4f5dcaebbf14ed6cbd303d" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_757f473e68b584bc42fcfbd9373" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
36
|
+
);
|
|
37
|
+
await queryRunner.query(
|
|
38
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_f7ec3f51dae2b4963cfb8fe5c46" FOREIGN KEY ("assignToUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
39
|
+
);
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_63221e8bd973ab71a49598d6c88" FOREIGN KEY ("assignToTeamId") REFERENCES "Team"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
42
|
+
);
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_10c7733499d5afa9b857f4a00c5" FOREIGN KEY ("markedAsResolvedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
45
|
+
);
|
|
46
|
+
await queryRunner.query(
|
|
47
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_199e3572d19b75e59f2082251f8" FOREIGN KEY ("markedAsMutedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
52
|
+
await queryRunner.query(
|
|
53
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_199e3572d19b75e59f2082251f8"`,
|
|
54
|
+
);
|
|
55
|
+
await queryRunner.query(
|
|
56
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_10c7733499d5afa9b857f4a00c5"`,
|
|
57
|
+
);
|
|
58
|
+
await queryRunner.query(
|
|
59
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_63221e8bd973ab71a49598d6c88"`,
|
|
60
|
+
);
|
|
61
|
+
await queryRunner.query(
|
|
62
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_f7ec3f51dae2b4963cfb8fe5c46"`,
|
|
63
|
+
);
|
|
64
|
+
await queryRunner.query(
|
|
65
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_757f473e68b584bc42fcfbd9373"`,
|
|
66
|
+
);
|
|
67
|
+
await queryRunner.query(
|
|
68
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_d2e1b4f5dcaebbf14ed6cbd303d"`,
|
|
69
|
+
);
|
|
70
|
+
await queryRunner.query(
|
|
71
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_6470c69cb5f53c5899c0483df5f"`,
|
|
72
|
+
);
|
|
73
|
+
await queryRunner.query(
|
|
74
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_3310c3a807a7e8bca9d1bd8e0eb"`,
|
|
75
|
+
);
|
|
76
|
+
await queryRunner.query(
|
|
77
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
|
|
78
|
+
);
|
|
79
|
+
await queryRunner.query(
|
|
80
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
|
|
81
|
+
);
|
|
82
|
+
await queryRunner.query(
|
|
83
|
+
`DROP INDEX "public"."IDX_e270eb229cd583c653c2176db9"`,
|
|
84
|
+
);
|
|
85
|
+
await queryRunner.query(
|
|
86
|
+
`DROP INDEX "public"."IDX_6470c69cb5f53c5899c0483df5"`,
|
|
87
|
+
);
|
|
88
|
+
await queryRunner.query(
|
|
89
|
+
`DROP INDEX "public"."IDX_3310c3a807a7e8bca9d1bd8e0e"`,
|
|
90
|
+
);
|
|
91
|
+
await queryRunner.query(`DROP TABLE "TelemetryException"`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1724613666632 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1724613666632";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_199e3572d19b75e59f2082251f8"`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`ALTER TABLE "TelemetryException" DROP COLUMN "markedAsMutedAt"`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "TelemetryException" DROP COLUMN "markedAsMutedByUserId"`,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`ALTER TABLE "TelemetryException" ADD "markedAsArchivedAt" TIMESTAMP WITH TIME ZONE`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "TelemetryException" ADD "markedAsArchivedByUserId" uuid`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "TelemetryException" ADD "isResolved" boolean NOT NULL DEFAULT false`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "TelemetryException" ADD "isArchived" boolean NOT NULL DEFAULT false`,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_3def22373f0cb84e16cb355b5e5" FOREIGN KEY ("markedAsArchivedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
35
|
+
await queryRunner.query(
|
|
36
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT "FK_3def22373f0cb84e16cb355b5e5"`,
|
|
37
|
+
);
|
|
38
|
+
await queryRunner.query(
|
|
39
|
+
`ALTER TABLE "TelemetryException" DROP COLUMN "isArchived"`,
|
|
40
|
+
);
|
|
41
|
+
await queryRunner.query(
|
|
42
|
+
`ALTER TABLE "TelemetryException" DROP COLUMN "isResolved"`,
|
|
43
|
+
);
|
|
44
|
+
await queryRunner.query(
|
|
45
|
+
`ALTER TABLE "TelemetryException" DROP COLUMN "markedAsArchivedByUserId"`,
|
|
46
|
+
);
|
|
47
|
+
await queryRunner.query(
|
|
48
|
+
`ALTER TABLE "TelemetryException" DROP COLUMN "markedAsArchivedAt"`,
|
|
49
|
+
);
|
|
50
|
+
await queryRunner.query(
|
|
51
|
+
`ALTER TABLE "TelemetryException" ADD "markedAsMutedByUserId" uuid`,
|
|
52
|
+
);
|
|
53
|
+
await queryRunner.query(
|
|
54
|
+
`ALTER TABLE "TelemetryException" ADD "markedAsMutedAt" TIMESTAMP WITH TIME ZONE`,
|
|
55
|
+
);
|
|
56
|
+
await queryRunner.query(
|
|
57
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_199e3572d19b75e59f2082251f8" FOREIGN KEY ("markedAsMutedByUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1724659071843 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1724659071843";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "TelemetryException" ADD "occuranceCount" integer NOT NULL DEFAULT '1'`,
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "TelemetryException" DROP COLUMN "occuranceCount"`,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -41,6 +41,9 @@ import { MigrationName1722892318363 } from "./1722892318363-MigrationName";
|
|
|
41
41
|
import { MigrationName1723825511054 } from "./1723825511054-MigrationName";
|
|
42
42
|
import { MigrationName1723828588502 } from "./1723828588502-MigrationName";
|
|
43
43
|
import { MigrationName1724078044172 } from "./1724078044172-MigrationName";
|
|
44
|
+
import { MigrationName1724610006927 } from "./1724610006927-MigrationName";
|
|
45
|
+
import { MigrationName1724613666632 } from "./1724613666632-MigrationName";
|
|
46
|
+
import { MigrationName1724659071843 } from "./1724659071843-MigrationName";
|
|
44
47
|
|
|
45
48
|
export default [
|
|
46
49
|
InitialMigration,
|
|
@@ -86,4 +89,7 @@ export default [
|
|
|
86
89
|
MigrationName1723825511054,
|
|
87
90
|
MigrationName1723828588502,
|
|
88
91
|
MigrationName1724078044172,
|
|
92
|
+
MigrationName1724610006927,
|
|
93
|
+
MigrationName1724613666632,
|
|
94
|
+
MigrationName1724659071843,
|
|
89
95
|
];
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ClusterKey,
|
|
3
|
+
RedisHostname,
|
|
4
|
+
RedisPassword,
|
|
5
|
+
RedisPort,
|
|
6
|
+
} from "../EnvironmentConfig";
|
|
2
7
|
import Dictionary from "Common/Types/Dictionary";
|
|
3
8
|
import { JSONObject } from "Common/Types/JSON";
|
|
4
9
|
import { Queue as BullQueue, Job, JobsOptions } from "bullmq";
|
|
10
|
+
import { ExpressAdapter } from "@bull-board/express";
|
|
11
|
+
import { createBullBoard } from "@bull-board/api";
|
|
12
|
+
import { BullMQAdapter } from "@bull-board/api/bullMQAdapter";
|
|
13
|
+
import { ExpressRouter } from "../Utils/Express";
|
|
5
14
|
|
|
6
15
|
export enum QueueName {
|
|
7
16
|
Workflow = "Workflow",
|
|
@@ -51,6 +60,32 @@ export default class Queue {
|
|
|
51
60
|
await this.getQueue(queueName).removeRepeatableByKey(jobId);
|
|
52
61
|
}
|
|
53
62
|
|
|
63
|
+
public static getInspectorRoute(): string {
|
|
64
|
+
return "/api/inspect/queue/:clusterKey";
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public static getQueueInspectorRouter(): ExpressRouter {
|
|
68
|
+
const serverAdapter: ExpressAdapter = new ExpressAdapter();
|
|
69
|
+
|
|
70
|
+
createBullBoard({
|
|
71
|
+
queues: [
|
|
72
|
+
...Object.values(QueueName).map((queueName: QueueName) => {
|
|
73
|
+
return new BullMQAdapter(this.getQueue(queueName));
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
76
|
+
serverAdapter: serverAdapter,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
serverAdapter.setBasePath(
|
|
80
|
+
this.getInspectorRoute().replace(
|
|
81
|
+
"/:clusterKey",
|
|
82
|
+
"/" + ClusterKey.toString(),
|
|
83
|
+
),
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return serverAdapter.getRouter();
|
|
87
|
+
}
|
|
88
|
+
|
|
54
89
|
public static async addJob(
|
|
55
90
|
queueName: QueueName,
|
|
56
91
|
jobId: string,
|
|
@@ -31,7 +31,7 @@ export default class QueueWorker {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
public static async runJobWithTimeout(
|
|
34
|
-
|
|
34
|
+
timeoutInMS: number,
|
|
35
35
|
jobCallback: PromiseVoidFunction,
|
|
36
36
|
): Promise<void> {
|
|
37
37
|
type TimeoutPromise = (ms: number) => Promise<void>;
|
|
@@ -46,6 +46,6 @@ export default class QueueWorker {
|
|
|
46
46
|
);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
return await Promise.race([timeoutPromise(
|
|
49
|
+
return await Promise.race([timeoutPromise(timeoutInMS), jobCallback()]);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -59,7 +59,6 @@ import Typeof from "../../Types/Typeof";
|
|
|
59
59
|
import API from "Common/Utils/API";
|
|
60
60
|
import Slug from "Common/Utils/Slug";
|
|
61
61
|
import { DataSource, Repository, SelectQueryBuilder } from "typeorm";
|
|
62
|
-
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
|
|
63
62
|
import { FindWhere } from "../../Types/BaseDatabase/Query";
|
|
64
63
|
|
|
65
64
|
class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
|
@@ -427,10 +426,10 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
|
|
427
426
|
}
|
|
428
427
|
|
|
429
428
|
private async sanitizeCreateOrUpdate(
|
|
430
|
-
data: TBaseModel |
|
|
429
|
+
data: TBaseModel | PartialEntity<TBaseModel>,
|
|
431
430
|
props: DatabaseCommonInteractionProps,
|
|
432
431
|
isUpdate: boolean = false,
|
|
433
|
-
): Promise<TBaseModel |
|
|
432
|
+
): Promise<TBaseModel | PartialEntity<TBaseModel>> {
|
|
434
433
|
data = this.checkMaxLengthOfFields(data as TBaseModel);
|
|
435
434
|
|
|
436
435
|
const columns: Columns = this.model.getTableColumns();
|
|
@@ -1274,12 +1273,12 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
|
|
1274
1273
|
beforeUpdateBy.props,
|
|
1275
1274
|
);
|
|
1276
1275
|
|
|
1277
|
-
const data:
|
|
1276
|
+
const data: PartialEntity<TBaseModel> =
|
|
1278
1277
|
(await this.sanitizeCreateOrUpdate(
|
|
1279
1278
|
beforeUpdateBy.data,
|
|
1280
1279
|
updateBy.props,
|
|
1281
1280
|
true,
|
|
1282
|
-
)) as
|
|
1281
|
+
)) as PartialEntity<TBaseModel>;
|
|
1283
1282
|
|
|
1284
1283
|
if (!(updateBy.skip instanceof PositiveNumber)) {
|
|
1285
1284
|
updateBy.skip = new PositiveNumber(updateBy.skip);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ClickhouseDatabase from "../Infrastructure/ClickhouseDatabase";
|
|
2
|
+
import AnalyticsDatabaseService from "./AnalyticsDatabaseService";
|
|
3
|
+
import ExceptionInstance from "Common/Models/AnalyticsModels/ExceptionInstance";
|
|
4
|
+
|
|
5
|
+
export class ExceptionInstanceService extends AnalyticsDatabaseService<ExceptionInstance> {
|
|
6
|
+
public constructor(clickhouseDatabase?: ClickhouseDatabase | undefined) {
|
|
7
|
+
super({ modelType: ExceptionInstance, database: clickhouseDatabase });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default new ExceptionInstanceService();
|
package/Server/Services/Index.ts
CHANGED
|
@@ -130,6 +130,8 @@ import AnalyticsBaseModel from "Common/Models/AnalyticsModels/AnalyticsBaseModel
|
|
|
130
130
|
import CopilotPullRequestService from "./CopilotPullRequestService";
|
|
131
131
|
import ServiceCatalogDependencyService from "./ServiceCatalogDependencyService";
|
|
132
132
|
import TelemetryAttributeService from "./TelemetryAttributeService";
|
|
133
|
+
import TelemetryExceptionService from "./TelemetryExceptionService";
|
|
134
|
+
import ExceptionInstanceService from "./ExceptionInstanceService";
|
|
133
135
|
|
|
134
136
|
const services: Array<BaseService> = [
|
|
135
137
|
AcmeCertificateService,
|
|
@@ -271,6 +273,8 @@ const services: Array<BaseService> = [
|
|
|
271
273
|
CopilotActionService,
|
|
272
274
|
ServiceCopilotCodeRepositoryService,
|
|
273
275
|
CopilotPullRequestService,
|
|
276
|
+
|
|
277
|
+
TelemetryExceptionService,
|
|
274
278
|
];
|
|
275
279
|
|
|
276
280
|
export const AnalyticsServices: Array<
|
|
@@ -281,6 +285,7 @@ export const AnalyticsServices: Array<
|
|
|
281
285
|
MetricService,
|
|
282
286
|
MonitorMetricsByMinuteService,
|
|
283
287
|
TelemetryAttributeService,
|
|
288
|
+
ExceptionInstanceService,
|
|
284
289
|
];
|
|
285
290
|
|
|
286
291
|
export default services;
|