@oneuptime/common 10.0.96 → 10.0.98

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.
Files changed (131) hide show
  1. package/Models/AnalyticsModels/Log.ts +6 -0
  2. package/Models/AnalyticsModels/Metric.ts +6 -0
  3. package/Models/AnalyticsModels/Profile.ts +6 -0
  4. package/Models/AnalyticsModels/Span.ts +6 -0
  5. package/Models/DatabaseModels/Alert.ts +52 -0
  6. package/Models/DatabaseModels/DockerHost.ts +3 -10
  7. package/Models/DatabaseModels/Host.ts +1015 -0
  8. package/Models/DatabaseModels/HostOwnerTeam.ts +462 -0
  9. package/Models/DatabaseModels/HostOwnerUser.ts +461 -0
  10. package/Models/DatabaseModels/Incident.ts +52 -0
  11. package/Models/DatabaseModels/Index.ts +6 -0
  12. package/Models/DatabaseModels/KubernetesCluster.ts +0 -7
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1778006035712-AddHostTables.ts +201 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1778013317872-AddHostIpAddresses.ts +15 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1778066346303-WidenHostOsVersionToLongText.ts +42 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1778070278986-MigrationName.ts +79 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  18. package/Server/Services/DockerHostService.ts +18 -5
  19. package/Server/Services/HostOwnerTeamService.ts +10 -0
  20. package/Server/Services/HostOwnerUserService.ts +10 -0
  21. package/Server/Services/HostService.ts +251 -0
  22. package/Server/Services/LogAggregationService.ts +10 -3
  23. package/Server/Services/MetricService.ts +200 -0
  24. package/Server/Services/TraceAggregationService.ts +8 -3
  25. package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +46 -18
  26. package/Server/Utils/Monitor/MonitorAlert.ts +37 -0
  27. package/Server/Utils/Monitor/MonitorIncident.ts +37 -0
  28. package/Tests/Server/Services/LogAggregationService.test.ts +25 -0
  29. package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +145 -0
  30. package/Types/Metrics/MetricQueryConfigData.ts +9 -0
  31. package/Types/Permission.ts +134 -0
  32. package/UI/Components/Charts/Area/AreaChart.tsx +1 -1
  33. package/UI/Components/Charts/Bar/BarChart.tsx +1 -1
  34. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +17 -8
  35. package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +11 -6
  36. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +17 -8
  37. package/UI/Components/Charts/Line/LineChart.tsx +1 -1
  38. package/UI/Components/ExpandableText/ExpandableText.tsx +29 -7
  39. package/UI/Components/JSONTable/JSONTable.tsx +27 -1
  40. package/UI/Components/LogsViewer/LogsViewer.tsx +3 -0
  41. package/UI/Components/LogsViewer/components/LogDetailsPanel.tsx +109 -23
  42. package/UI/Components/LogsViewer/components/LogSearchBar.tsx +11 -4
  43. package/UI/Components/Navbar/NavBarMenu.tsx +17 -2
  44. package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +10 -3
  45. package/Utils/ValueFormatter.ts +57 -3
  46. package/build/dist/Models/AnalyticsModels/Log.js +6 -0
  47. package/build/dist/Models/AnalyticsModels/Log.js.map +1 -1
  48. package/build/dist/Models/AnalyticsModels/Metric.js +6 -0
  49. package/build/dist/Models/AnalyticsModels/Metric.js.map +1 -1
  50. package/build/dist/Models/AnalyticsModels/Profile.js +6 -0
  51. package/build/dist/Models/AnalyticsModels/Profile.js.map +1 -1
  52. package/build/dist/Models/AnalyticsModels/Span.js +6 -0
  53. package/build/dist/Models/AnalyticsModels/Span.js.map +1 -1
  54. package/build/dist/Models/DatabaseModels/Alert.js +51 -0
  55. package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
  56. package/build/dist/Models/DatabaseModels/DockerHost.js +3 -10
  57. package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
  58. package/build/dist/Models/DatabaseModels/Host.js +1041 -0
  59. package/build/dist/Models/DatabaseModels/Host.js.map +1 -0
  60. package/build/dist/Models/DatabaseModels/HostOwnerTeam.js +480 -0
  61. package/build/dist/Models/DatabaseModels/HostOwnerTeam.js.map +1 -0
  62. package/build/dist/Models/DatabaseModels/HostOwnerUser.js +479 -0
  63. package/build/dist/Models/DatabaseModels/HostOwnerUser.js.map +1 -0
  64. package/build/dist/Models/DatabaseModels/Incident.js +51 -0
  65. package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
  66. package/build/dist/Models/DatabaseModels/Index.js +6 -0
  67. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  68. package/build/dist/Models/DatabaseModels/KubernetesCluster.js +0 -7
  69. package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
  70. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778006035712-AddHostTables.js +76 -0
  71. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778006035712-AddHostTables.js.map +1 -0
  72. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778013317872-AddHostIpAddresses.js +12 -0
  73. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778013317872-AddHostIpAddresses.js.map +1 -0
  74. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778066346303-WidenHostOsVersionToLongText.js +31 -0
  75. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778066346303-WidenHostOsVersionToLongText.js.map +1 -0
  76. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778070278986-MigrationName.js +34 -0
  77. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778070278986-MigrationName.js.map +1 -0
  78. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  79. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  80. package/build/dist/Server/Services/DockerHostService.js +12 -5
  81. package/build/dist/Server/Services/DockerHostService.js.map +1 -1
  82. package/build/dist/Server/Services/HostOwnerTeamService.js +9 -0
  83. package/build/dist/Server/Services/HostOwnerTeamService.js.map +1 -0
  84. package/build/dist/Server/Services/HostOwnerUserService.js +9 -0
  85. package/build/dist/Server/Services/HostOwnerUserService.js.map +1 -0
  86. package/build/dist/Server/Services/HostService.js +214 -0
  87. package/build/dist/Server/Services/HostService.js.map +1 -0
  88. package/build/dist/Server/Services/LogAggregationService.js +10 -3
  89. package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
  90. package/build/dist/Server/Services/MetricService.js +160 -0
  91. package/build/dist/Server/Services/MetricService.js.map +1 -1
  92. package/build/dist/Server/Services/TraceAggregationService.js +8 -3
  93. package/build/dist/Server/Services/TraceAggregationService.js.map +1 -1
  94. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +46 -18
  95. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
  96. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +32 -0
  97. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  98. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +32 -0
  99. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  100. package/build/dist/Tests/Server/Services/LogAggregationService.test.js +13 -0
  101. package/build/dist/Tests/Server/Services/LogAggregationService.test.js.map +1 -1
  102. package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js +123 -0
  103. package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js.map +1 -1
  104. package/build/dist/Types/Permission.js +120 -0
  105. package/build/dist/Types/Permission.js.map +1 -1
  106. package/build/dist/UI/Components/Charts/Area/AreaChart.js +1 -1
  107. package/build/dist/UI/Components/Charts/Bar/BarChart.js +1 -1
  108. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +15 -7
  109. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  110. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +10 -6
  111. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
  112. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +16 -8
  113. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  114. package/build/dist/UI/Components/Charts/Line/LineChart.js +1 -1
  115. package/build/dist/UI/Components/ExpandableText/ExpandableText.js +10 -5
  116. package/build/dist/UI/Components/ExpandableText/ExpandableText.js.map +1 -1
  117. package/build/dist/UI/Components/JSONTable/JSONTable.js +8 -1
  118. package/build/dist/UI/Components/JSONTable/JSONTable.js.map +1 -1
  119. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +1 -1
  120. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  121. package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js +40 -14
  122. package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js.map +1 -1
  123. package/build/dist/UI/Components/LogsViewer/components/LogSearchBar.js +10 -4
  124. package/build/dist/UI/Components/LogsViewer/components/LogSearchBar.js.map +1 -1
  125. package/build/dist/UI/Components/Navbar/NavBarMenu.js +15 -2
  126. package/build/dist/UI/Components/Navbar/NavBarMenu.js.map +1 -1
  127. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +10 -3
  128. package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
  129. package/build/dist/Utils/ValueFormatter.js +47 -3
  130. package/build/dist/Utils/ValueFormatter.js.map +1 -1
  131. package/package.json +1 -1
@@ -0,0 +1,201 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class AddHostTables1778006035712 implements MigrationInterface {
4
+ public name = "AddHostTables1778006035712";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "Host" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "name" character varying(100) NOT NULL, "slug" character varying(100) NOT NULL, "description" character varying(500), "hostIdentifier" character varying(100) NOT NULL, "otelCollectorStatus" character varying(100) DEFAULT 'disconnected', "lastSeenAt" TIMESTAMP WITH TIME ZONE, "osType" character varying(100), "osVersion" character varying(100), "hostId" character varying(100), "hostArch" character varying(100), "hostType" character varying(100), "cpuCores" integer, "totalMemoryBytes" bigint, "processCount" integer, "containerRuntime" character varying(100), "dockerHostId" uuid, "kubernetesClusterId" uuid, "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_8932b1fbd5379a13b1b36ec2d3d" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_e22ae9b0a967fb6543ff8c301f" ON "Host" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_3fde0ad120dcc2add43571d32f" ON "Host" ("hostIdentifier") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE TABLE "HostOwnerTeam" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "teamId" uuid NOT NULL, "hostId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "isOwnerNotified" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_84405badc1534865339c8c5e406" PRIMARY KEY ("_id"))`,
18
+ );
19
+ await queryRunner.query(
20
+ `CREATE INDEX "IDX_c1d978cf937110822c0a8c16b6" ON "HostOwnerTeam" ("projectId") `,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE INDEX "IDX_1290ff7710538a05b836d6963f" ON "HostOwnerTeam" ("teamId") `,
24
+ );
25
+ await queryRunner.query(
26
+ `CREATE INDEX "IDX_cfd5c58b1da0f125d89e18e0bc" ON "HostOwnerTeam" ("hostId") `,
27
+ );
28
+ await queryRunner.query(
29
+ `CREATE INDEX "IDX_495bfc6fd17ac913d87b4e1343" ON "HostOwnerTeam" ("isOwnerNotified") `,
30
+ );
31
+ await queryRunner.query(
32
+ `CREATE TABLE "HostOwnerUser" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "userId" uuid NOT NULL, "hostId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "isOwnerNotified" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_0162afb1404ef9533b18c896e4e" PRIMARY KEY ("_id"))`,
33
+ );
34
+ await queryRunner.query(
35
+ `CREATE INDEX "IDX_0a702bcd1aae2116c995c9e629" ON "HostOwnerUser" ("projectId") `,
36
+ );
37
+ await queryRunner.query(
38
+ `CREATE INDEX "IDX_3defdc18ccc7f39331f2421642" ON "HostOwnerUser" ("userId") `,
39
+ );
40
+ await queryRunner.query(
41
+ `CREATE INDEX "IDX_548d344a8aacbfcfe9c7e976d2" ON "HostOwnerUser" ("hostId") `,
42
+ );
43
+ await queryRunner.query(
44
+ `CREATE INDEX "IDX_b31e255a3a84c744f345655de3" ON "HostOwnerUser" ("isOwnerNotified") `,
45
+ );
46
+ await queryRunner.query(
47
+ `CREATE TABLE "HostLabel" ("hostId" uuid NOT NULL, "labelId" uuid NOT NULL, CONSTRAINT "PK_86a7f1b9bc210b18c81113b5a33" PRIMARY KEY ("hostId", "labelId"))`,
48
+ );
49
+ await queryRunner.query(
50
+ `CREATE INDEX "IDX_59e952ca592c04398e3d64bfde" ON "HostLabel" ("hostId") `,
51
+ );
52
+ await queryRunner.query(
53
+ `CREATE INDEX "IDX_9430f41b66935ad844c956aee6" ON "HostLabel" ("labelId") `,
54
+ );
55
+ await queryRunner.query(
56
+ `ALTER TABLE "Host" ADD CONSTRAINT "FK_e22ae9b0a967fb6543ff8c301f1" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
57
+ );
58
+ await queryRunner.query(
59
+ `ALTER TABLE "Host" ADD CONSTRAINT "FK_4bd303f959a5149deaf49cc7829" FOREIGN KEY ("dockerHostId") REFERENCES "DockerHost"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
60
+ );
61
+ await queryRunner.query(
62
+ `ALTER TABLE "Host" ADD CONSTRAINT "FK_f3aaabe9c2b44fb291de44db2b8" FOREIGN KEY ("kubernetesClusterId") REFERENCES "KubernetesCluster"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
63
+ );
64
+ await queryRunner.query(
65
+ `ALTER TABLE "Host" ADD CONSTRAINT "FK_d49356815c565cb9d8daddbb673" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
66
+ );
67
+ await queryRunner.query(
68
+ `ALTER TABLE "Host" ADD CONSTRAINT "FK_aa5c88e1babc531c2f494117f2e" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
69
+ );
70
+ await queryRunner.query(
71
+ `ALTER TABLE "HostOwnerTeam" ADD CONSTRAINT "FK_c1d978cf937110822c0a8c16b63" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
72
+ );
73
+ await queryRunner.query(
74
+ `ALTER TABLE "HostOwnerTeam" ADD CONSTRAINT "FK_1290ff7710538a05b836d6963f5" FOREIGN KEY ("teamId") REFERENCES "Team"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
75
+ );
76
+ await queryRunner.query(
77
+ `ALTER TABLE "HostOwnerTeam" ADD CONSTRAINT "FK_cfd5c58b1da0f125d89e18e0bc8" FOREIGN KEY ("hostId") REFERENCES "Host"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
78
+ );
79
+ await queryRunner.query(
80
+ `ALTER TABLE "HostOwnerTeam" ADD CONSTRAINT "FK_ee4a1b1c2c24c1b2e9a75aa16c9" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
81
+ );
82
+ await queryRunner.query(
83
+ `ALTER TABLE "HostOwnerTeam" ADD CONSTRAINT "FK_6d4be0abe0aafe5f92dabe17c39" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
84
+ );
85
+ await queryRunner.query(
86
+ `ALTER TABLE "HostOwnerUser" ADD CONSTRAINT "FK_0a702bcd1aae2116c995c9e6294" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
87
+ );
88
+ await queryRunner.query(
89
+ `ALTER TABLE "HostOwnerUser" ADD CONSTRAINT "FK_3defdc18ccc7f39331f24216427" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
90
+ );
91
+ await queryRunner.query(
92
+ `ALTER TABLE "HostOwnerUser" ADD CONSTRAINT "FK_548d344a8aacbfcfe9c7e976d22" FOREIGN KEY ("hostId") REFERENCES "Host"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
93
+ );
94
+ await queryRunner.query(
95
+ `ALTER TABLE "HostOwnerUser" ADD CONSTRAINT "FK_77c8d3ccc2887cd21f6fee2e283" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
96
+ );
97
+ await queryRunner.query(
98
+ `ALTER TABLE "HostOwnerUser" ADD CONSTRAINT "FK_aae3727b2c7f6567667f367996a" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
99
+ );
100
+ await queryRunner.query(
101
+ `ALTER TABLE "HostLabel" ADD CONSTRAINT "FK_59e952ca592c04398e3d64bfde6" FOREIGN KEY ("hostId") REFERENCES "Host"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
102
+ );
103
+ await queryRunner.query(
104
+ `ALTER TABLE "HostLabel" ADD CONSTRAINT "FK_9430f41b66935ad844c956aee6a" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
105
+ );
106
+ }
107
+
108
+ public async down(queryRunner: QueryRunner): Promise<void> {
109
+ await queryRunner.query(
110
+ `ALTER TABLE "HostLabel" DROP CONSTRAINT "FK_9430f41b66935ad844c956aee6a"`,
111
+ );
112
+ await queryRunner.query(
113
+ `ALTER TABLE "HostLabel" DROP CONSTRAINT "FK_59e952ca592c04398e3d64bfde6"`,
114
+ );
115
+ await queryRunner.query(
116
+ `ALTER TABLE "HostOwnerUser" DROP CONSTRAINT "FK_aae3727b2c7f6567667f367996a"`,
117
+ );
118
+ await queryRunner.query(
119
+ `ALTER TABLE "HostOwnerUser" DROP CONSTRAINT "FK_77c8d3ccc2887cd21f6fee2e283"`,
120
+ );
121
+ await queryRunner.query(
122
+ `ALTER TABLE "HostOwnerUser" DROP CONSTRAINT "FK_548d344a8aacbfcfe9c7e976d22"`,
123
+ );
124
+ await queryRunner.query(
125
+ `ALTER TABLE "HostOwnerUser" DROP CONSTRAINT "FK_3defdc18ccc7f39331f24216427"`,
126
+ );
127
+ await queryRunner.query(
128
+ `ALTER TABLE "HostOwnerUser" DROP CONSTRAINT "FK_0a702bcd1aae2116c995c9e6294"`,
129
+ );
130
+ await queryRunner.query(
131
+ `ALTER TABLE "HostOwnerTeam" DROP CONSTRAINT "FK_6d4be0abe0aafe5f92dabe17c39"`,
132
+ );
133
+ await queryRunner.query(
134
+ `ALTER TABLE "HostOwnerTeam" DROP CONSTRAINT "FK_ee4a1b1c2c24c1b2e9a75aa16c9"`,
135
+ );
136
+ await queryRunner.query(
137
+ `ALTER TABLE "HostOwnerTeam" DROP CONSTRAINT "FK_cfd5c58b1da0f125d89e18e0bc8"`,
138
+ );
139
+ await queryRunner.query(
140
+ `ALTER TABLE "HostOwnerTeam" DROP CONSTRAINT "FK_1290ff7710538a05b836d6963f5"`,
141
+ );
142
+ await queryRunner.query(
143
+ `ALTER TABLE "HostOwnerTeam" DROP CONSTRAINT "FK_c1d978cf937110822c0a8c16b63"`,
144
+ );
145
+ await queryRunner.query(
146
+ `ALTER TABLE "Host" DROP CONSTRAINT "FK_aa5c88e1babc531c2f494117f2e"`,
147
+ );
148
+ await queryRunner.query(
149
+ `ALTER TABLE "Host" DROP CONSTRAINT "FK_d49356815c565cb9d8daddbb673"`,
150
+ );
151
+ await queryRunner.query(
152
+ `ALTER TABLE "Host" DROP CONSTRAINT "FK_f3aaabe9c2b44fb291de44db2b8"`,
153
+ );
154
+ await queryRunner.query(
155
+ `ALTER TABLE "Host" DROP CONSTRAINT "FK_4bd303f959a5149deaf49cc7829"`,
156
+ );
157
+ await queryRunner.query(
158
+ `ALTER TABLE "Host" DROP CONSTRAINT "FK_e22ae9b0a967fb6543ff8c301f1"`,
159
+ );
160
+ await queryRunner.query(
161
+ `DROP INDEX "public"."IDX_9430f41b66935ad844c956aee6"`,
162
+ );
163
+ await queryRunner.query(
164
+ `DROP INDEX "public"."IDX_59e952ca592c04398e3d64bfde"`,
165
+ );
166
+ await queryRunner.query(`DROP TABLE "HostLabel"`);
167
+ await queryRunner.query(
168
+ `DROP INDEX "public"."IDX_b31e255a3a84c744f345655de3"`,
169
+ );
170
+ await queryRunner.query(
171
+ `DROP INDEX "public"."IDX_548d344a8aacbfcfe9c7e976d2"`,
172
+ );
173
+ await queryRunner.query(
174
+ `DROP INDEX "public"."IDX_3defdc18ccc7f39331f2421642"`,
175
+ );
176
+ await queryRunner.query(
177
+ `DROP INDEX "public"."IDX_0a702bcd1aae2116c995c9e629"`,
178
+ );
179
+ await queryRunner.query(`DROP TABLE "HostOwnerUser"`);
180
+ await queryRunner.query(
181
+ `DROP INDEX "public"."IDX_495bfc6fd17ac913d87b4e1343"`,
182
+ );
183
+ await queryRunner.query(
184
+ `DROP INDEX "public"."IDX_cfd5c58b1da0f125d89e18e0bc"`,
185
+ );
186
+ await queryRunner.query(
187
+ `DROP INDEX "public"."IDX_1290ff7710538a05b836d6963f"`,
188
+ );
189
+ await queryRunner.query(
190
+ `DROP INDEX "public"."IDX_c1d978cf937110822c0a8c16b6"`,
191
+ );
192
+ await queryRunner.query(`DROP TABLE "HostOwnerTeam"`);
193
+ await queryRunner.query(
194
+ `DROP INDEX "public"."IDX_3fde0ad120dcc2add43571d32f"`,
195
+ );
196
+ await queryRunner.query(
197
+ `DROP INDEX "public"."IDX_e22ae9b0a967fb6543ff8c301f"`,
198
+ );
199
+ await queryRunner.query(`DROP TABLE "Host"`);
200
+ }
201
+ }
@@ -0,0 +1,15 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class AddHostIpAddresses1778013317872 implements MigrationInterface {
4
+ public name = "AddHostIpAddresses1778013317872";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "Host" ADD "hostIpAddresses" character varying(500)`,
9
+ );
10
+ }
11
+
12
+ public async down(queryRunner: QueryRunner): Promise<void> {
13
+ await queryRunner.query(`ALTER TABLE "Host" DROP COLUMN "hostIpAddresses"`);
14
+ }
15
+ }
@@ -0,0 +1,42 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ /*
4
+ * macOS resourcedetection reports os.description as the full uname output
5
+ * (e.g. "macOS 26.3.1 (25D2128) (Darwin … Kernel Version … RELEASE_ARM64_T6000 arm64)"),
6
+ * which exceeds the 100-char ShortText limit. The OTel ingest pipeline
7
+ * passes osVersion through the same atomic UPDATE that sets lastSeenAt and
8
+ * the rest of the host metadata, so a too-long value silently failed every
9
+ * field on the row — including lastSeenAt — leaving newly-discovered hosts
10
+ * permanently empty and demoted to "disconnected" by the 5-min cron.
11
+ *
12
+ * Widen Host.osVersion and DockerHost.osVersion to LongText (500). Use
13
+ * ALTER COLUMN ... TYPE so existing rows keep their osVersion data instead
14
+ * of being wiped by the DROP+ADD pattern TypeORM auto-generated.
15
+ */
16
+ export class WidenHostOsVersionToLongText1778066346303
17
+ implements MigrationInterface
18
+ {
19
+ public name: string = "WidenHostOsVersionToLongText1778066346303";
20
+
21
+ public async up(queryRunner: QueryRunner): Promise<void> {
22
+ await queryRunner.query(
23
+ `ALTER TABLE "Host" ALTER COLUMN "osVersion" TYPE character varying(500)`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "DockerHost" ALTER COLUMN "osVersion" TYPE character varying(500)`,
27
+ );
28
+ }
29
+
30
+ public async down(queryRunner: QueryRunner): Promise<void> {
31
+ /*
32
+ * Note: any rows with osVersion > 100 chars must be manually
33
+ * shortened before this rollback, otherwise the ALTER COLUMN will fail.
34
+ */
35
+ await queryRunner.query(
36
+ `ALTER TABLE "DockerHost" ALTER COLUMN "osVersion" TYPE character varying(100)`,
37
+ );
38
+ await queryRunner.query(
39
+ `ALTER TABLE "Host" ALTER COLUMN "osVersion" TYPE character varying(100)`,
40
+ );
41
+ }
42
+ }
@@ -0,0 +1,79 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1778070278986 implements MigrationInterface {
4
+ public name = "MigrationName1778070278986";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "IncidentHost" ("incidentId" uuid NOT NULL, "hostId" uuid NOT NULL, CONSTRAINT "PK_af405a55232f0a9b86f8e61afc8" PRIMARY KEY ("incidentId", "hostId"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_754c607846b4d3fed7812910af" ON "IncidentHost" ("incidentId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_761485a265848de15cbe146577" ON "IncidentHost" ("hostId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE TABLE "AlertHost" ("alertId" uuid NOT NULL, "hostId" uuid NOT NULL, CONSTRAINT "PK_7d743416076d53cd4d3eb81e510" PRIMARY KEY ("alertId", "hostId"))`,
18
+ );
19
+ await queryRunner.query(
20
+ `CREATE INDEX "IDX_70537c0436813fa8056e5390e9" ON "AlertHost" ("alertId") `,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE INDEX "IDX_f241ff3816d26dfaa3ca615b18" ON "AlertHost" ("hostId") `,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
30
+ );
31
+ await queryRunner.query(
32
+ `ALTER TABLE "IncidentHost" ADD CONSTRAINT "FK_754c607846b4d3fed7812910aff" FOREIGN KEY ("incidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
33
+ );
34
+ await queryRunner.query(
35
+ `ALTER TABLE "IncidentHost" ADD CONSTRAINT "FK_761485a265848de15cbe1465776" FOREIGN KEY ("hostId") REFERENCES "Host"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "AlertHost" ADD CONSTRAINT "FK_70537c0436813fa8056e5390e96" FOREIGN KEY ("alertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
39
+ );
40
+ await queryRunner.query(
41
+ `ALTER TABLE "AlertHost" ADD CONSTRAINT "FK_f241ff3816d26dfaa3ca615b185" FOREIGN KEY ("hostId") REFERENCES "Host"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
42
+ );
43
+ }
44
+
45
+ public async down(queryRunner: QueryRunner): Promise<void> {
46
+ await queryRunner.query(
47
+ `ALTER TABLE "AlertHost" DROP CONSTRAINT "FK_f241ff3816d26dfaa3ca615b185"`,
48
+ );
49
+ await queryRunner.query(
50
+ `ALTER TABLE "AlertHost" DROP CONSTRAINT "FK_70537c0436813fa8056e5390e96"`,
51
+ );
52
+ await queryRunner.query(
53
+ `ALTER TABLE "IncidentHost" DROP CONSTRAINT "FK_761485a265848de15cbe1465776"`,
54
+ );
55
+ await queryRunner.query(
56
+ `ALTER TABLE "IncidentHost" DROP CONSTRAINT "FK_754c607846b4d3fed7812910aff"`,
57
+ );
58
+ await queryRunner.query(
59
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
60
+ );
61
+ await queryRunner.query(
62
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
63
+ );
64
+ await queryRunner.query(
65
+ `DROP INDEX "public"."IDX_f241ff3816d26dfaa3ca615b18"`,
66
+ );
67
+ await queryRunner.query(
68
+ `DROP INDEX "public"."IDX_70537c0436813fa8056e5390e9"`,
69
+ );
70
+ await queryRunner.query(`DROP TABLE "AlertHost"`);
71
+ await queryRunner.query(
72
+ `DROP INDEX "public"."IDX_761485a265848de15cbe146577"`,
73
+ );
74
+ await queryRunner.query(
75
+ `DROP INDEX "public"."IDX_754c607846b4d3fed7812910af"`,
76
+ );
77
+ await queryRunner.query(`DROP TABLE "IncidentHost"`);
78
+ }
79
+ }
@@ -298,6 +298,10 @@ import { MigrationName1777571961028 } from "./1777571961028-MigrationName";
298
298
  import { MigrationName1777629313843 } from "./1777629313843-MigrationName";
299
299
  import { MigrationName1777933061000 } from "./1777933061000-MigrationName";
300
300
  import { MigrationName1777972687018 } from "./1777972687018-MigrationName";
301
+ import { AddHostTables1778006035712 } from "./1778006035712-AddHostTables";
302
+ import { AddHostIpAddresses1778013317872 } from "./1778013317872-AddHostIpAddresses";
303
+ import { WidenHostOsVersionToLongText1778066346303 } from "./1778066346303-WidenHostOsVersionToLongText";
304
+ import { MigrationName1778070278986 } from "./1778070278986-MigrationName";
301
305
  export default [
302
306
  InitialMigration,
303
307
  MigrationName1717678334852,
@@ -599,4 +603,8 @@ export default [
599
603
  MigrationName1777629313843,
600
604
  MigrationName1777933061000,
601
605
  MigrationName1777972687018,
606
+ AddHostTables1778006035712,
607
+ AddHostIpAddresses1778013317872,
608
+ WidenHostOsVersionToLongText1778066346303,
609
+ MigrationName1778070278986,
602
610
  ];
@@ -6,6 +6,7 @@ import QueryHelper from "../Types/Database/QueryHelper";
6
6
  import OneUptimeDate from "../../Types/Date";
7
7
  import LIMIT_MAX from "../../Types/Database/LimitMax";
8
8
  import GlobalCache from "../Infrastructure/GlobalCache";
9
+ import crypto from "crypto";
9
10
 
10
11
  const LAST_SEEN_CACHE_NAMESPACE: string = "docker-host-last-seen";
11
12
  const LAST_SEEN_THROTTLE_SECONDS: number = 60;
@@ -96,19 +97,31 @@ export class Service extends DatabaseService<Model> {
96
97
  },
97
98
  ): Promise<void> {
98
99
  const cacheKey: string = hostId.toString();
100
+ const extrasFingerprint: string = crypto
101
+ .createHash("sha1")
102
+ .update(
103
+ JSON.stringify({
104
+ osType: extra?.osType ?? null,
105
+ osVersion: extra?.osVersion ?? null,
106
+ }),
107
+ )
108
+ .digest("hex");
99
109
 
100
110
  const cached: string | null = await GlobalCache.getString(
101
111
  LAST_SEEN_CACHE_NAMESPACE,
102
112
  cacheKey,
103
113
  );
104
114
 
105
- if (cached) {
106
- return; // another pod already updated recently
115
+ if (cached === extrasFingerprint) {
116
+ return; // same data was written recently
107
117
  }
108
118
 
109
- await GlobalCache.setString(LAST_SEEN_CACHE_NAMESPACE, cacheKey, "1", {
110
- expiresInSeconds: LAST_SEEN_THROTTLE_SECONDS,
111
- });
119
+ await GlobalCache.setString(
120
+ LAST_SEEN_CACHE_NAMESPACE,
121
+ cacheKey,
122
+ extrasFingerprint,
123
+ { expiresInSeconds: LAST_SEEN_THROTTLE_SECONDS },
124
+ );
112
125
 
113
126
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
127
  const data: any = {
@@ -0,0 +1,10 @@
1
+ import DatabaseService from "./DatabaseService";
2
+ import Model from "../../Models/DatabaseModels/HostOwnerTeam";
3
+
4
+ export class Service extends DatabaseService<Model> {
5
+ public constructor() {
6
+ super(Model);
7
+ }
8
+ }
9
+
10
+ export default new Service();
@@ -0,0 +1,10 @@
1
+ import DatabaseService from "./DatabaseService";
2
+ import Model from "../../Models/DatabaseModels/HostOwnerUser";
3
+
4
+ export class Service extends DatabaseService<Model> {
5
+ public constructor() {
6
+ super(Model);
7
+ }
8
+ }
9
+
10
+ export default new Service();