@oneuptime/common 10.5.9 → 10.5.18
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 +1 -1
- package/Models/AnalyticsModels/Log.ts +1 -1
- package/Models/AnalyticsModels/Metric.ts +1 -1
- package/Models/AnalyticsModels/Profile.ts +1 -1
- package/Models/AnalyticsModels/ProfileSample.ts +1 -1
- package/Models/AnalyticsModels/Span.ts +1 -1
- package/Models/DatabaseModels/TelemetryException.ts +46 -34
- package/Models/DatabaseModels/TelemetryUsageBilling.ts +35 -2
- package/Server/API/AIAgentDataAPI.ts +25 -7
- package/Server/API/TelemetryAPI.ts +6 -0
- package/Server/API/TelemetryExceptionAPI.ts +6 -2
- package/Server/EnvironmentConfig.ts +27 -0
- package/Server/Infrastructure/ClickhouseDatabase.ts +21 -1
- package/Server/Infrastructure/Postgres/DataSourceOptions.ts +19 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1780381124553-MigrationName.ts +28 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1780382837019-MigrationName.ts +24 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1780387560604-MigrationName.ts +47 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1780388219225-MigrationName.ts +34 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Infrastructure/PostgresDatabase.ts +27 -1
- package/Server/Infrastructure/QueueWorker.ts +54 -4
- package/Server/Infrastructure/Redis.ts +11 -0
- package/Server/Services/AnalyticsDatabaseService.ts +87 -0
- package/Server/Services/DatabaseService.ts +73 -0
- package/Server/Services/TelemetryAttributeService.ts +38 -2
- package/Server/Services/TelemetryExceptionService.ts +24 -49
- package/Server/Services/TelemetryUsageBillingService.ts +289 -166
- package/Server/Types/AnalyticsDatabase/ModelPermission.ts +102 -72
- package/Server/Types/Database/Permissions/OwnedScopePermission.ts +81 -60
- package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +67 -0
- package/Server/Utils/Express.ts +32 -0
- package/Server/Utils/GracefulShutdown.ts +194 -0
- package/Server/Utils/Logger.ts +12 -1
- package/Server/Utils/Monitor/MonitorLogUtil.ts +22 -17
- package/Server/Utils/Profiling.ts +14 -6
- package/Server/Utils/StartServer.ts +13 -5
- package/Server/Utils/Telemetry/ContextSpanProcessor.ts +48 -0
- package/Server/Utils/Telemetry/LogExceptionExtractor.ts +289 -0
- package/Server/Utils/Telemetry/SpanUtil.ts +16 -35
- package/Server/Utils/Telemetry/StackTraceParser.ts +423 -0
- package/Server/Utils/Telemetry/TelemetryContext.ts +190 -0
- package/Server/Utils/Telemetry.ts +33 -7
- package/Tests/Server/Services/TelemetryAttributeService.test.ts +83 -0
- package/Tests/Server/Utils/Telemetry/LogExceptionExtractor.test.ts +0 -0
- package/Types/Database/AccessControl/OwnedThrough.ts +31 -3
- package/Types/Telemetry/ServiceType.ts +10 -0
- package/UI/Components/AutocompleteTextInput/AutocompleteTextInput.tsx +7 -1
- package/UI/Components/Dictionary/Dictionary.tsx +19 -0
- package/UI/Components/Filters/FiltersForm.tsx +1 -0
- package/UI/Components/Filters/JSONFilter.tsx +2 -0
- package/UI/Components/Filters/Types/Filter.ts +1 -0
- package/UI/Components/LogsViewer/LogsViewer.tsx +16 -0
- package/UI/Utils/Project.ts +6 -0
- package/UI/Utils/Telemetry/Telemetry.ts +65 -0
- package/UI/Utils/TelemetryService.ts +150 -0
- package/build/dist/Models/AnalyticsModels/ExceptionInstance.js +1 -1
- package/build/dist/Models/AnalyticsModels/ExceptionInstance.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Log.js +1 -1
- package/build/dist/Models/AnalyticsModels/Log.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Metric.js +1 -1
- package/build/dist/Models/AnalyticsModels/Metric.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Profile.js +1 -1
- package/build/dist/Models/AnalyticsModels/Profile.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/ProfileSample.js +1 -1
- package/build/dist/Models/AnalyticsModels/ProfileSample.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Span.js +1 -1
- package/build/dist/Models/AnalyticsModels/Span.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryException.js +47 -33
- package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryUsageBilling.js +36 -2
- package/build/dist/Models/DatabaseModels/TelemetryUsageBilling.js.map +1 -1
- package/build/dist/Server/API/AIAgentDataAPI.js +24 -8
- package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js +4 -0
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryExceptionAPI.js +6 -2
- package/build/dist/Server/API/TelemetryExceptionAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +19 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/ClickhouseDatabase.js +16 -2
- package/build/dist/Server/Infrastructure/ClickhouseDatabase.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/DataSourceOptions.js +10 -9
- package/build/dist/Server/Infrastructure/Postgres/DataSourceOptions.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1780381124553-MigrationName.js +23 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1780381124553-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1780382837019-MigrationName.js +19 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1780382837019-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1780387560604-MigrationName.js +22 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1780387560604-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1780388219225-MigrationName.js +25 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1780388219225-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/PostgresDatabase.js +20 -1
- package/build/dist/Server/Infrastructure/PostgresDatabase.js.map +1 -1
- package/build/dist/Server/Infrastructure/QueueWorker.js +40 -3
- package/build/dist/Server/Infrastructure/QueueWorker.js.map +1 -1
- package/build/dist/Server/Infrastructure/Redis.js +5 -0
- package/build/dist/Server/Infrastructure/Redis.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +59 -0
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +62 -0
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryAttributeService.js +23 -1
- package/build/dist/Server/Services/TelemetryAttributeService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +16 -41
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +211 -147
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js +84 -63
- package/build/dist/Server/Types/AnalyticsDatabase/ModelPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnedScopePermission.js +67 -49
- package/build/dist/Server/Types/Database/Permissions/OwnedScopePermission.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +51 -0
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Express.js +23 -0
- package/build/dist/Server/Utils/Express.js.map +1 -1
- package/build/dist/Server/Utils/GracefulShutdown.js +145 -0
- package/build/dist/Server/Utils/GracefulShutdown.js.map +1 -0
- package/build/dist/Server/Utils/Logger.js +8 -1
- package/build/dist/Server/Utils/Logger.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorLogUtil.js +12 -10
- package/build/dist/Server/Utils/Monitor/MonitorLogUtil.js.map +1 -1
- package/build/dist/Server/Utils/Profiling.js +8 -3
- package/build/dist/Server/Utils/Profiling.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +12 -4
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ContextSpanProcessor.js +37 -0
- package/build/dist/Server/Utils/Telemetry/ContextSpanProcessor.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js +214 -0
- package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/SpanUtil.js +15 -24
- package/build/dist/Server/Utils/Telemetry/SpanUtil.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/StackTraceParser.js +365 -0
- package/build/dist/Server/Utils/Telemetry/StackTraceParser.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryContext.js +124 -0
- package/build/dist/Server/Utils/Telemetry/TelemetryContext.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry.js +22 -5
- package/build/dist/Server/Utils/Telemetry.js.map +1 -1
- package/build/dist/Tests/Server/Services/TelemetryAttributeService.test.js +50 -0
- package/build/dist/Tests/Server/Services/TelemetryAttributeService.test.js.map +1 -0
- package/build/dist/Tests/Server/Utils/Telemetry/LogExceptionExtractor.test.js +0 -0
- package/build/dist/Tests/Server/Utils/Telemetry/LogExceptionExtractor.test.js.map +1 -0
- package/build/dist/Types/Database/AccessControl/OwnedThrough.js +7 -2
- package/build/dist/Types/Database/AccessControl/OwnedThrough.js.map +1 -1
- package/build/dist/Types/Telemetry/ServiceType.js +10 -0
- package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
- package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js +7 -1
- package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js.map +1 -1
- package/build/dist/UI/Components/Dictionary/Dictionary.js +10 -0
- package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
- package/build/dist/UI/Components/Filters/FiltersForm.js +1 -1
- package/build/dist/UI/Components/Filters/FiltersForm.js.map +1 -1
- package/build/dist/UI/Components/Filters/JSONFilter.js +1 -1
- package/build/dist/UI/Components/Filters/JSONFilter.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +15 -0
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Utils/Project.js +5 -0
- package/build/dist/UI/Utils/Project.js.map +1 -1
- package/build/dist/UI/Utils/Telemetry/Telemetry.js +44 -0
- package/build/dist/UI/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/UI/Utils/TelemetryService.js +113 -0
- package/build/dist/UI/Utils/TelemetryService.js.map +1 -0
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ import { SpanStatus } from "./Span";
|
|
|
15
15
|
import ServiceType from "../../Types/Telemetry/ServiceType";
|
|
16
16
|
|
|
17
17
|
@OperationalResource()
|
|
18
|
-
@OwnedThrough("serviceId", Service)
|
|
18
|
+
@OwnedThrough("serviceId", Service, { includeProjectScope: true })
|
|
19
19
|
export default class ExceptionInstance extends AnalyticsBaseModel {
|
|
20
20
|
public constructor() {
|
|
21
21
|
const projectIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
@@ -16,7 +16,7 @@ import Service from "../DatabaseModels/Service";
|
|
|
16
16
|
import ServiceType from "../../Types/Telemetry/ServiceType";
|
|
17
17
|
|
|
18
18
|
@OperationalResource()
|
|
19
|
-
@OwnedThrough("serviceId", Service)
|
|
19
|
+
@OwnedThrough("serviceId", Service, { includeProjectScope: true })
|
|
20
20
|
export default class Log extends AnalyticsBaseModel {
|
|
21
21
|
public constructor() {
|
|
22
22
|
const projectIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
@@ -28,7 +28,7 @@ export enum MetricPointType {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
@OperationalResource()
|
|
31
|
-
@OwnedThrough("serviceId", Service)
|
|
31
|
+
@OwnedThrough("serviceId", Service, { includeProjectScope: true })
|
|
32
32
|
export default class Metric extends AnalyticsBaseModel {
|
|
33
33
|
public constructor() {
|
|
34
34
|
const projectIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
@@ -15,7 +15,7 @@ import Service from "../DatabaseModels/Service";
|
|
|
15
15
|
import ServiceType from "../../Types/Telemetry/ServiceType";
|
|
16
16
|
|
|
17
17
|
@OperationalResource()
|
|
18
|
-
@OwnedThrough("serviceId", Service)
|
|
18
|
+
@OwnedThrough("serviceId", Service, { includeProjectScope: true })
|
|
19
19
|
export default class Profile extends AnalyticsBaseModel {
|
|
20
20
|
public constructor() {
|
|
21
21
|
const projectIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
@@ -15,7 +15,7 @@ import Service from "../DatabaseModels/Service";
|
|
|
15
15
|
import ServiceType from "../../Types/Telemetry/ServiceType";
|
|
16
16
|
|
|
17
17
|
@OperationalResource()
|
|
18
|
-
@OwnedThrough("serviceId", Service)
|
|
18
|
+
@OwnedThrough("serviceId", Service, { includeProjectScope: true })
|
|
19
19
|
export default class ProfileSample extends AnalyticsBaseModel {
|
|
20
20
|
public constructor() {
|
|
21
21
|
const projectIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
@@ -47,7 +47,7 @@ export interface SpanLink {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
@OperationalResource()
|
|
50
|
-
@OwnedThrough("serviceId", Service)
|
|
50
|
+
@OwnedThrough("serviceId", Service, { includeProjectScope: true })
|
|
51
51
|
export default class Span extends AnalyticsBaseModel {
|
|
52
52
|
public constructor() {
|
|
53
53
|
const projectIdColumn: AnalyticsTableColumn = new AnalyticsTableColumn({
|
|
@@ -17,9 +17,13 @@ import TenantColumn from "../../Types/Database/TenantColumn";
|
|
|
17
17
|
import IconProp from "../../Types/Icon/IconProp";
|
|
18
18
|
import ObjectID from "../../Types/ObjectID";
|
|
19
19
|
import Permission from "../../Types/Permission";
|
|
20
|
+
import ServiceType from "../../Types/Telemetry/ServiceType";
|
|
20
21
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
21
22
|
import DatabaseBaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
22
23
|
import Service from "./Service";
|
|
24
|
+
import Host from "./Host";
|
|
25
|
+
import DockerHost from "./DockerHost";
|
|
26
|
+
import KubernetesCluster from "./KubernetesCluster";
|
|
23
27
|
|
|
24
28
|
@EnableDocumentation()
|
|
25
29
|
@CanAccessIfCanReadOn("service")
|
|
@@ -60,7 +64,16 @@ import Service from "./Service";
|
|
|
60
64
|
tableDescription:
|
|
61
65
|
"List of all Telemetry Exceptions created for the telemetry service for this OneUptime project and it's status.",
|
|
62
66
|
})
|
|
63
|
-
|
|
67
|
+
/*
|
|
68
|
+
* serviceId is polymorphic (see the column below) — it may reference a
|
|
69
|
+
* Service, Host, DockerHost or KubernetesCluster, or be the projectId for
|
|
70
|
+
* unattributed (Unknown) telemetry. Owned scope unions ownership across all
|
|
71
|
+
* of those resource types, and includeProjectScope lets in-project users
|
|
72
|
+
* see the unattributed bucket (which has no owner resource).
|
|
73
|
+
*/
|
|
74
|
+
@OwnedThrough("serviceId", [Service, Host, DockerHost, KubernetesCluster], {
|
|
75
|
+
includeProjectScope: true,
|
|
76
|
+
})
|
|
64
77
|
@Entity({
|
|
65
78
|
name: "TelemetryException",
|
|
66
79
|
})
|
|
@@ -150,6 +163,15 @@ export default class TelemetryException extends DatabaseBaseModel {
|
|
|
150
163
|
})
|
|
151
164
|
public projectId?: ObjectID = undefined;
|
|
152
165
|
|
|
166
|
+
/*
|
|
167
|
+
* serviceId is polymorphic (disambiguated by serviceType, mirroring the
|
|
168
|
+
* ClickHouse ExceptionInstance rows): it can be a real Service, a Host /
|
|
169
|
+
* DockerHost / KubernetesCluster id, or the projectId for unattributed
|
|
170
|
+
* (Unknown) telemetry. There is intentionally NO @ManyToOne(Service)
|
|
171
|
+
* relation — a Service join would only resolve OpenTelemetry rows and
|
|
172
|
+
* silently null out everything else. The read side resolves serviceId +
|
|
173
|
+
* serviceType to a resource per type (TelemetryServiceUtil) instead.
|
|
174
|
+
*/
|
|
153
175
|
@ColumnAccessControl({
|
|
154
176
|
create: [
|
|
155
177
|
Permission.ProjectOwner,
|
|
@@ -172,27 +194,21 @@ export default class TelemetryException extends DatabaseBaseModel {
|
|
|
172
194
|
Permission.EditTelemetryException,
|
|
173
195
|
],
|
|
174
196
|
})
|
|
197
|
+
@Index()
|
|
175
198
|
@TableColumn({
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
199
|
+
type: TableColumnType.ObjectID,
|
|
200
|
+
required: true,
|
|
201
|
+
title: "Service ID",
|
|
202
|
+
description:
|
|
203
|
+
"ID of the resource this exception belongs to (Service / Host / DockerHost / KubernetesCluster, or the projectId for unattributed telemetry — disambiguated by serviceType).",
|
|
181
204
|
example: "d4e5f6a7-b8c9-0123-def1-234567890123",
|
|
182
205
|
})
|
|
183
|
-
@
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
nullable: true,
|
|
190
|
-
onDelete: "CASCADE",
|
|
191
|
-
orphanedRowAction: "nullify",
|
|
192
|
-
},
|
|
193
|
-
)
|
|
194
|
-
@JoinColumn({ name: "serviceId" })
|
|
195
|
-
public service?: Service = undefined;
|
|
206
|
+
@Column({
|
|
207
|
+
type: ColumnType.ObjectID,
|
|
208
|
+
nullable: false,
|
|
209
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
210
|
+
})
|
|
211
|
+
public serviceId?: ObjectID = undefined;
|
|
196
212
|
|
|
197
213
|
@ColumnAccessControl({
|
|
198
214
|
create: [
|
|
@@ -210,26 +226,22 @@ export default class TelemetryException extends DatabaseBaseModel {
|
|
|
210
226
|
Permission.TelemetryViewer,
|
|
211
227
|
Permission.ReadTelemetryException,
|
|
212
228
|
],
|
|
213
|
-
update: [
|
|
214
|
-
Permission.ProjectOwner,
|
|
215
|
-
Permission.ProjectAdmin,
|
|
216
|
-
Permission.EditTelemetryException,
|
|
217
|
-
],
|
|
229
|
+
update: [],
|
|
218
230
|
})
|
|
219
|
-
@Index()
|
|
220
231
|
@TableColumn({
|
|
221
|
-
type: TableColumnType.
|
|
222
|
-
|
|
223
|
-
title: "Service
|
|
224
|
-
description:
|
|
225
|
-
|
|
232
|
+
type: TableColumnType.ShortText,
|
|
233
|
+
canReadOnRelationQuery: true,
|
|
234
|
+
title: "Service Type",
|
|
235
|
+
description:
|
|
236
|
+
"Resource type that produced this exception (e.g. OpenTelemetry service, Host, DockerHost, KubernetesCluster, or Unknown for unattributed telemetry).",
|
|
237
|
+
example: "OpenTelemetry",
|
|
226
238
|
})
|
|
227
239
|
@Column({
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
240
|
+
nullable: true,
|
|
241
|
+
type: ColumnType.ShortText,
|
|
242
|
+
length: ColumnLength.ShortText,
|
|
231
243
|
})
|
|
232
|
-
public
|
|
244
|
+
public serviceType?: ServiceType = undefined;
|
|
233
245
|
|
|
234
246
|
@ColumnAccessControl({
|
|
235
247
|
create: [
|
|
@@ -15,6 +15,7 @@ import TenantColumn from "../../Types/Database/TenantColumn";
|
|
|
15
15
|
import Decimal from "../../Types/Decimal";
|
|
16
16
|
import IconProp from "../../Types/Icon/IconProp";
|
|
17
17
|
import ProductType from "../../Types/MeteredPlan/ProductType";
|
|
18
|
+
import ServiceType from "../../Types/Telemetry/ServiceType";
|
|
18
19
|
import ObjectID from "../../Types/ObjectID";
|
|
19
20
|
import Permission from "../../Types/Permission";
|
|
20
21
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
@@ -270,8 +271,16 @@ export default class TelemetryUsageBilling extends BaseModel {
|
|
|
270
271
|
{
|
|
271
272
|
eager: false,
|
|
272
273
|
nullable: true,
|
|
273
|
-
|
|
274
|
-
|
|
274
|
+
/*
|
|
275
|
+
* No DB-level foreign key. Telemetry that arrives without a
|
|
276
|
+
* service.name is metered against a synthetic "unattributed"
|
|
277
|
+
* bucket whose serviceId is the projectId (ServiceType.Unknown),
|
|
278
|
+
* which has no matching Service row — a FK would reject those
|
|
279
|
+
* billing rows. The relation is kept for read-side joins; it
|
|
280
|
+
* resolves to null for the unattributed bucket and the UI renders
|
|
281
|
+
* a synthetic "Unknown Service" in its place.
|
|
282
|
+
*/
|
|
283
|
+
createForeignKeyConstraints: false,
|
|
275
284
|
},
|
|
276
285
|
)
|
|
277
286
|
@JoinColumn({ name: "serviceId" })
|
|
@@ -301,6 +310,30 @@ export default class TelemetryUsageBilling extends BaseModel {
|
|
|
301
310
|
})
|
|
302
311
|
public serviceId?: ObjectID = undefined;
|
|
303
312
|
|
|
313
|
+
@ColumnAccessControl({
|
|
314
|
+
create: [],
|
|
315
|
+
read: [
|
|
316
|
+
Permission.ProjectOwner,
|
|
317
|
+
Permission.ProjectAdmin,
|
|
318
|
+
Permission.ManageProjectBilling,
|
|
319
|
+
],
|
|
320
|
+
update: [],
|
|
321
|
+
})
|
|
322
|
+
@TableColumn({
|
|
323
|
+
type: TableColumnType.ShortText,
|
|
324
|
+
canReadOnRelationQuery: true,
|
|
325
|
+
title: "Service Type",
|
|
326
|
+
description:
|
|
327
|
+
"Resource type that produced this telemetry (e.g. OpenTelemetry service, Host, DockerHost, KubernetesCluster, or Unknown for unattributed telemetry).",
|
|
328
|
+
example: "OpenTelemetry",
|
|
329
|
+
})
|
|
330
|
+
@Column({
|
|
331
|
+
nullable: true,
|
|
332
|
+
type: ColumnType.ShortText,
|
|
333
|
+
length: ColumnLength.ShortText,
|
|
334
|
+
})
|
|
335
|
+
public serviceType?: ServiceType = undefined;
|
|
336
|
+
|
|
304
337
|
@ColumnAccessControl({
|
|
305
338
|
create: [],
|
|
306
339
|
read: [],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AIAgentService from "../Services/AIAgentService";
|
|
2
2
|
import LlmProviderService from "../Services/LlmProviderService";
|
|
3
3
|
import TelemetryExceptionService from "../Services/TelemetryExceptionService";
|
|
4
|
+
import ServiceService from "../Services/ServiceService";
|
|
4
5
|
import ServiceCodeRepositoryService from "../Services/ServiceCodeRepositoryService";
|
|
5
6
|
import CodeRepositoryService from "../Services/CodeRepositoryService";
|
|
6
7
|
import AIAgentTaskPullRequestService from "../Services/AIAgentTaskPullRequestService";
|
|
@@ -15,6 +16,7 @@ import Response from "../Utils/Response";
|
|
|
15
16
|
import AIAgent from "../../Models/DatabaseModels/AIAgent";
|
|
16
17
|
import LlmProvider from "../../Models/DatabaseModels/LlmProvider";
|
|
17
18
|
import TelemetryException from "../../Models/DatabaseModels/TelemetryException";
|
|
19
|
+
import Service from "../../Models/DatabaseModels/Service";
|
|
18
20
|
import ServiceCodeRepository from "../../Models/DatabaseModels/ServiceCodeRepository";
|
|
19
21
|
import CodeRepository from "../../Models/DatabaseModels/CodeRepository";
|
|
20
22
|
import AIAgentTaskPullRequest from "../../Models/DatabaseModels/AIAgentTaskPullRequest";
|
|
@@ -174,11 +176,7 @@ export default class AIAgentDataAPI {
|
|
|
174
176
|
exceptionType: true,
|
|
175
177
|
fingerprint: true,
|
|
176
178
|
serviceId: true,
|
|
177
|
-
|
|
178
|
-
_id: true,
|
|
179
|
-
name: true,
|
|
180
|
-
description: true,
|
|
181
|
-
},
|
|
179
|
+
serviceType: true,
|
|
182
180
|
},
|
|
183
181
|
props: {
|
|
184
182
|
isRoot: true,
|
|
@@ -198,6 +196,26 @@ export default class AIAgentDataAPI {
|
|
|
198
196
|
getLogAttributesFromRequest(req as any),
|
|
199
197
|
);
|
|
200
198
|
|
|
199
|
+
/*
|
|
200
|
+
* serviceId is polymorphic — resolve the Service only when it is
|
|
201
|
+
* a real Service. findOneById returns null for Host / DockerHost /
|
|
202
|
+
* KubernetesCluster / unattributed serviceIds (they aren't
|
|
203
|
+
* Services), preserving the previous "name only for real
|
|
204
|
+
* services" behaviour without the dropped ORM relation.
|
|
205
|
+
*/
|
|
206
|
+
const exceptionService: Service | null = exception.serviceId
|
|
207
|
+
? await ServiceService.findOneById({
|
|
208
|
+
id: exception.serviceId,
|
|
209
|
+
select: {
|
|
210
|
+
name: true,
|
|
211
|
+
description: true,
|
|
212
|
+
},
|
|
213
|
+
props: {
|
|
214
|
+
isRoot: true,
|
|
215
|
+
},
|
|
216
|
+
})
|
|
217
|
+
: null;
|
|
218
|
+
|
|
201
219
|
return Response.sendJsonObjectResponse(req, res, {
|
|
202
220
|
exception: {
|
|
203
221
|
id: exception._id?.toString(),
|
|
@@ -209,8 +227,8 @@ export default class AIAgentDataAPI {
|
|
|
209
227
|
service: exception.serviceId
|
|
210
228
|
? {
|
|
211
229
|
id: exception.serviceId.toString(),
|
|
212
|
-
name:
|
|
213
|
-
description:
|
|
230
|
+
name: exceptionService?.name,
|
|
231
|
+
description: exceptionService?.description,
|
|
214
232
|
}
|
|
215
233
|
: null,
|
|
216
234
|
});
|
|
@@ -236,12 +236,18 @@ const getAttributeValues: GetAttributeValuesFunction = async (
|
|
|
236
236
|
? (req.body["metricName"] as string)
|
|
237
237
|
: undefined;
|
|
238
238
|
|
|
239
|
+
const searchText: string | undefined =
|
|
240
|
+
req.body["searchText"] && typeof req.body["searchText"] === "string"
|
|
241
|
+
? (req.body["searchText"] as string)
|
|
242
|
+
: undefined;
|
|
243
|
+
|
|
239
244
|
const values: string[] =
|
|
240
245
|
await TelemetryAttributeService.fetchAttributeValues({
|
|
241
246
|
projectId: databaseProps.tenantId,
|
|
242
247
|
telemetryType,
|
|
243
248
|
metricName,
|
|
244
249
|
attributeKey,
|
|
250
|
+
searchText,
|
|
245
251
|
});
|
|
246
252
|
|
|
247
253
|
return Response.sendJsonObjectResponse(req, res, {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import TelemetryException from "../../Models/DatabaseModels/TelemetryException";
|
|
2
|
-
import TelemetryServiceModel from "../../Models/DatabaseModels/Service";
|
|
3
2
|
import AIAgentTask from "../../Models/DatabaseModels/AIAgentTask";
|
|
4
3
|
import AIAgentTaskTelemetryException from "../../Models/DatabaseModels/AIAgentTaskTelemetryException";
|
|
5
4
|
import BadDataException from "../../Types/Exception/BadDataException";
|
|
@@ -211,8 +210,13 @@ export default class TelemetryExceptionAPI extends BaseAPI<
|
|
|
211
210
|
|
|
212
211
|
const serviceSummariesJson: JSONArray = summary.serviceSummaries.map(
|
|
213
212
|
(entry: DashboardServiceSummary): JSONObject => {
|
|
213
|
+
/*
|
|
214
|
+
* serviceId is polymorphic; the client resolves the display name
|
|
215
|
+
* per serviceType (no Service relation to serialize anymore).
|
|
216
|
+
*/
|
|
214
217
|
return {
|
|
215
|
-
|
|
218
|
+
serviceId: entry.serviceId,
|
|
219
|
+
serviceType: entry.serviceType,
|
|
216
220
|
unresolvedCount: entry.unresolvedCount,
|
|
217
221
|
totalOccurrences: entry.totalOccurrences,
|
|
218
222
|
};
|
|
@@ -204,6 +204,33 @@ export const PostgresIdleTimeoutMs: number = parseInt(
|
|
|
204
204
|
10,
|
|
205
205
|
);
|
|
206
206
|
|
|
207
|
+
/*
|
|
208
|
+
* TCP keepalive initial delay (ms) for Postgres sockets. When the client
|
|
209
|
+
* process dies ungracefully (SIGKILL, OOM, crash) or a network partition cuts
|
|
210
|
+
* the link, Postgres has no way to know the client is gone and the backend
|
|
211
|
+
* lingers as an orphaned connection — by default up to the OS
|
|
212
|
+
* tcp_keepalive_time (~2h on Linux). Enabling socket keepalive makes
|
|
213
|
+
* node-postgres probe the peer so dead connections are detected and torn down
|
|
214
|
+
* promptly.
|
|
215
|
+
*/
|
|
216
|
+
export const PostgresKeepAliveInitialDelayMs: number = parseInt(
|
|
217
|
+
process.env["DATABASE_KEEPALIVE_INITIAL_DELAY_MS"] || "10000",
|
|
218
|
+
10,
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
/*
|
|
222
|
+
* Postgres-side idle-session timeout (ms). Server-side backstop for orphaned
|
|
223
|
+
* connections: the server terminates any session that sits idle (outside a
|
|
224
|
+
* transaction) longer than this. MUST be larger than the pool's
|
|
225
|
+
* idleTimeoutMillis (PostgresIdleTimeoutMs) so the pool reaps its own healthy
|
|
226
|
+
* idle connections first and only truly-orphaned sessions (client gone) ever
|
|
227
|
+
* hit this. Set to 0 to disable. Requires Postgres 14+.
|
|
228
|
+
*/
|
|
229
|
+
export const PostgresIdleSessionTimeoutMs: number = parseInt(
|
|
230
|
+
process.env["DATABASE_IDLE_SESSION_TIMEOUT_MS"] || "300000",
|
|
231
|
+
10,
|
|
232
|
+
);
|
|
233
|
+
|
|
207
234
|
/*
|
|
208
235
|
* TypeORM slow-query log threshold (ms). Any query exceeding this is
|
|
209
236
|
* logged so we can find offenders in production without per-query
|
|
@@ -14,6 +14,7 @@ import HTTPErrorResponse from "../../Types/API/HTTPErrorResponse";
|
|
|
14
14
|
import HTTPResponse from "../../Types/API/HTTPResponse";
|
|
15
15
|
import { JSONObject } from "../../Types/JSON";
|
|
16
16
|
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
17
|
+
import GracefulShutdown, { ShutdownPriority } from "../Utils/GracefulShutdown";
|
|
17
18
|
|
|
18
19
|
export type ClickhouseClient = ClickHouseClient;
|
|
19
20
|
|
|
@@ -21,6 +22,14 @@ export default class ClickhouseDatabase {
|
|
|
21
22
|
private dataSource!: ClickhouseClient | null;
|
|
22
23
|
private options: ClickHouseClientConfigOptions;
|
|
23
24
|
|
|
25
|
+
/*
|
|
26
|
+
* Each instance owns its own pool (App vs. Ingest), so each needs a
|
|
27
|
+
* distinct shutdown-handler name. The two instances share a database name,
|
|
28
|
+
* so a per-instance counter is what makes the names unique.
|
|
29
|
+
*/
|
|
30
|
+
private static instanceCounter: number = 0;
|
|
31
|
+
private readonly instanceId: number = ++ClickhouseDatabase.instanceCounter;
|
|
32
|
+
|
|
24
33
|
public constructor(
|
|
25
34
|
options: ClickHouseClientConfigOptions = dataSourceOptions,
|
|
26
35
|
) {
|
|
@@ -97,7 +106,18 @@ export default class ClickhouseDatabase {
|
|
|
97
106
|
}
|
|
98
107
|
};
|
|
99
108
|
|
|
100
|
-
|
|
109
|
+
const client: ClickhouseClient = await connectToDatabase();
|
|
110
|
+
|
|
111
|
+
// Close this Clickhouse pool on shutdown.
|
|
112
|
+
GracefulShutdown.registerHandler(
|
|
113
|
+
`ClickhouseDatabase#${this.instanceId}`,
|
|
114
|
+
ShutdownPriority.DataStores,
|
|
115
|
+
() => {
|
|
116
|
+
return this.disconnect();
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
return client;
|
|
101
121
|
} catch (err) {
|
|
102
122
|
logger.error("Clickhouse Database Connection Failed");
|
|
103
123
|
logger.error(err);
|
|
@@ -11,7 +11,9 @@ import {
|
|
|
11
11
|
MaxPostgresConnections,
|
|
12
12
|
PostgresConnectionAcquireTimeoutMs,
|
|
13
13
|
PostgresIdleInTransactionTimeoutMs,
|
|
14
|
+
PostgresIdleSessionTimeoutMs,
|
|
14
15
|
PostgresIdleTimeoutMs,
|
|
16
|
+
PostgresKeepAliveInitialDelayMs,
|
|
15
17
|
PostgresQueryTimeoutMs,
|
|
16
18
|
PostgresSlowQueryLogThresholdMs,
|
|
17
19
|
PostgresStatementTimeoutMs,
|
|
@@ -54,6 +56,23 @@ const dataSourceOptions: DataSourceOptions = {
|
|
|
54
56
|
statement_timeout: PostgresStatementTimeoutMs,
|
|
55
57
|
query_timeout: PostgresQueryTimeoutMs,
|
|
56
58
|
idle_in_transaction_session_timeout: PostgresIdleInTransactionTimeoutMs,
|
|
59
|
+
/*
|
|
60
|
+
* Detect dead TCP peers (ungraceful client exit / network partition) so
|
|
61
|
+
* orphaned server-side connections get torn down instead of lingering
|
|
62
|
+
* until the OS keepalive default (~2h).
|
|
63
|
+
*/
|
|
64
|
+
keepAlive: true,
|
|
65
|
+
keepAliveInitialDelayMillis: PostgresKeepAliveInitialDelayMs,
|
|
66
|
+
/*
|
|
67
|
+
* Server-side backstop for orphaned idle sessions. node-postgres has no
|
|
68
|
+
* first-class option for this GUC, so pass it via the libpq `options`
|
|
69
|
+
* startup parameter. Unitless values are milliseconds. Only applied when
|
|
70
|
+
* > 0, and must exceed idleTimeoutMillis (see EnvironmentConfig) so the
|
|
71
|
+
* pool reaps healthy idle connections before the server force-closes them.
|
|
72
|
+
*/
|
|
73
|
+
...(PostgresIdleSessionTimeoutMs > 0
|
|
74
|
+
? { options: `-c idle_session_timeout=${PostgresIdleSessionTimeoutMs}` }
|
|
75
|
+
: {}),
|
|
57
76
|
},
|
|
58
77
|
/*
|
|
59
78
|
* Log any query slower than the configured threshold so we can find
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Drop the foreign key from TelemetryUsageBilling.serviceId -> Service.
|
|
5
|
+
*
|
|
6
|
+
* Telemetry ingested without an OTel service.name is metered against a
|
|
7
|
+
* synthetic "unattributed" bucket whose serviceId is the projectId
|
|
8
|
+
* (ServiceType.Unknown). That id has no matching Service row, so the FK
|
|
9
|
+
* would reject the billing row. serviceId stays a required column; it is
|
|
10
|
+
* just no longer constrained to the Service table (it is polymorphic,
|
|
11
|
+
* mirroring the analytics telemetry rows). The TypeORM relation is kept
|
|
12
|
+
* for read-side joins and resolves to null for the unattributed bucket.
|
|
13
|
+
*/
|
|
14
|
+
export class MigrationName1780381124553 implements MigrationInterface {
|
|
15
|
+
public name = "MigrationName1780381124553";
|
|
16
|
+
|
|
17
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`ALTER TABLE "TelemetryUsageBilling" DROP CONSTRAINT IF EXISTS "FK_b9f49cd8318a35757fc843ee900"`,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
24
|
+
await queryRunner.query(
|
|
25
|
+
`ALTER TABLE "TelemetryUsageBilling" ADD CONSTRAINT "FK_b9f49cd8318a35757fc843ee900" FOREIGN KEY ("serviceId") REFERENCES "Service"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Add TelemetryUsageBilling.serviceType — the resource-type discriminator
|
|
5
|
+
* for a usage row (OpenTelemetry / Host / DockerHost / KubernetesCluster /
|
|
6
|
+
* Unknown). Lets the usage breakdown attribute ingestion to the kind of
|
|
7
|
+
* resource that produced it, now that non-Service telemetry is metered.
|
|
8
|
+
* Nullable; legacy rows (all real Services) are treated as OpenTelemetry.
|
|
9
|
+
*/
|
|
10
|
+
export class MigrationName1780382837019 implements MigrationInterface {
|
|
11
|
+
public name = "MigrationName1780382837019";
|
|
12
|
+
|
|
13
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
14
|
+
await queryRunner.query(
|
|
15
|
+
`ALTER TABLE "TelemetryUsageBilling" ADD COLUMN IF NOT EXISTS "serviceType" character varying(100)`,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
20
|
+
await queryRunner.query(
|
|
21
|
+
`ALTER TABLE "TelemetryUsageBilling" DROP COLUMN IF EXISTS "serviceType"`,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1780387560604 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1780387560604";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "SmsLog" DROP CONSTRAINT "FK_SmsLog_userOnCallLogTimelineId"`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`DROP INDEX "public"."IDX_SmsLog_userOnCallLogTimelineId"`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`CREATE INDEX "IDX_77bd357cbaad40a136a36f5f1e" ON "SmsLog" ("userOnCallLogTimelineId") `,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "SmsLog" ADD CONSTRAINT "FK_77bd357cbaad40a136a36f5f1ed" FOREIGN KEY ("userOnCallLogTimelineId") REFERENCES "UserOnCallLogTimeline"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
28
|
+
await queryRunner.query(
|
|
29
|
+
`ALTER TABLE "SmsLog" DROP CONSTRAINT "FK_77bd357cbaad40a136a36f5f1ed"`,
|
|
30
|
+
);
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`DROP INDEX "public"."IDX_77bd357cbaad40a136a36f5f1e"`,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
|
|
36
|
+
);
|
|
37
|
+
await queryRunner.query(
|
|
38
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
|
|
39
|
+
);
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`CREATE INDEX "IDX_SmsLog_userOnCallLogTimelineId" ON "SmsLog" ("userOnCallLogTimelineId") `,
|
|
42
|
+
);
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`ALTER TABLE "SmsLog" ADD CONSTRAINT "FK_SmsLog_userOnCallLogTimelineId" FOREIGN KEY ("userOnCallLogTimelineId") REFERENCES "UserOnCallLogTimeline"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Make TelemetryException.serviceId polymorphic:
|
|
5
|
+
* - Drop the foreign key to Service. An exception's serviceId can be a
|
|
6
|
+
* Service, a Host / DockerHost / KubernetesCluster id, or the projectId
|
|
7
|
+
* for unattributed (Unknown) telemetry — a FK to Service rejected every
|
|
8
|
+
* non-Service exception and forced ingest to skip them.
|
|
9
|
+
* - Add a serviceType discriminator (OpenTelemetry / Host / DockerHost /
|
|
10
|
+
* KubernetesCluster / Unknown) so the Issues UI can attribute each issue
|
|
11
|
+
* to the kind of resource that produced it. Nullable; legacy rows (all
|
|
12
|
+
* real Services) are treated as OpenTelemetry on read.
|
|
13
|
+
*/
|
|
14
|
+
export class MigrationName1780388219225 implements MigrationInterface {
|
|
15
|
+
public name = "MigrationName1780388219225";
|
|
16
|
+
|
|
17
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`ALTER TABLE "TelemetryException" DROP CONSTRAINT IF EXISTS "FK_08a0cfa9f184257b1e57da4cf50"`,
|
|
20
|
+
);
|
|
21
|
+
await queryRunner.query(
|
|
22
|
+
`ALTER TABLE "TelemetryException" ADD COLUMN IF NOT EXISTS "serviceType" character varying(100)`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
27
|
+
await queryRunner.query(
|
|
28
|
+
`ALTER TABLE "TelemetryException" DROP COLUMN IF EXISTS "serviceType"`,
|
|
29
|
+
);
|
|
30
|
+
await queryRunner.query(
|
|
31
|
+
`ALTER TABLE "TelemetryException" ADD CONSTRAINT "FK_08a0cfa9f184257b1e57da4cf50" FOREIGN KEY ("serviceId") REFERENCES "Service"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -361,6 +361,10 @@ import { AddTransportTypeToProjectSmtpConfig1779975064262 } from "./177997506426
|
|
|
361
361
|
import { AddSmtpTransportTypeToGlobalConfig1779976190561 } from "./1779976190561-AddSmtpTransportTypeToGlobalConfig";
|
|
362
362
|
import { MigrationName1779980428744 } from "./1779980428744-MigrationName";
|
|
363
363
|
import { AddDeliveryTrackingToSmsLog1780317745887 } from "./1780317745887-AddDeliveryTrackingToSmsLog";
|
|
364
|
+
import { MigrationName1780381124553 } from "./1780381124553-MigrationName";
|
|
365
|
+
import { MigrationName1780382837019 } from "./1780382837019-MigrationName";
|
|
366
|
+
import { MigrationName1780387560604 } from "./1780387560604-MigrationName";
|
|
367
|
+
import { MigrationName1780388219225 } from "./1780388219225-MigrationName";
|
|
364
368
|
|
|
365
369
|
export default [
|
|
366
370
|
InitialMigration,
|
|
@@ -726,4 +730,8 @@ export default [
|
|
|
726
730
|
AddSmtpTransportTypeToGlobalConfig1779976190561,
|
|
727
731
|
MigrationName1779980428744,
|
|
728
732
|
AddDeliveryTrackingToSmsLog1780317745887,
|
|
733
|
+
MigrationName1780381124553,
|
|
734
|
+
MigrationName1780382837019,
|
|
735
|
+
MigrationName1780387560604,
|
|
736
|
+
MigrationName1780388219225,
|
|
729
737
|
];
|