@oneuptime/common 10.0.39 → 10.0.40

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 (282) hide show
  1. package/Models/AnalyticsModels/Index.ts +4 -0
  2. package/Models/AnalyticsModels/Profile.ts +687 -0
  3. package/Models/AnalyticsModels/ProfileSample.ts +547 -0
  4. package/Models/DatabaseModels/Dashboard.ts +357 -0
  5. package/Models/DatabaseModels/DashboardDomain.ts +658 -0
  6. package/Models/DatabaseModels/Index.ts +2 -0
  7. package/Models/DatabaseModels/StatusPage.ts +41 -0
  8. package/Server/API/DashboardAPI.ts +408 -0
  9. package/Server/API/DashboardDomainAPI.ts +235 -0
  10. package/Server/API/StatusPageAPI.ts +36 -2
  11. package/Server/API/TelemetryAPI.ts +393 -0
  12. package/Server/EnvironmentConfig.ts +12 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.ts +97 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.ts +17 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.ts +50 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.ts +59 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  18. package/Server/Middleware/UserAuthorization.ts +96 -1
  19. package/Server/Services/DashboardDomainService.ts +647 -0
  20. package/Server/Services/DashboardService.ts +174 -3
  21. package/Server/Services/IncidentService.ts +295 -50
  22. package/Server/Services/IncidentStateTimelineService.ts +1 -0
  23. package/Server/Services/Index.ts +6 -0
  24. package/Server/Services/MonitorService.ts +5 -0
  25. package/Server/Services/ProfileAggregationService.ts +559 -0
  26. package/Server/Services/ProfileSampleService.ts +11 -0
  27. package/Server/Services/ProfileService.ts +11 -0
  28. package/Server/Services/TelemetryUsageBillingService.ts +77 -3
  29. package/Server/Services/WorkspaceNotificationSummaryService.ts +15 -1
  30. package/Server/Types/Billing/MeteredPlan/AllMeteredPlans.ts +9 -0
  31. package/Server/Utils/Cookie.ts +48 -0
  32. package/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.ts +34 -0
  33. package/Server/Utils/Monitor/DataToProcess.ts +3 -1
  34. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +299 -0
  35. package/Server/Utils/Profile/PprofEncoder.ts +225 -0
  36. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +53 -16
  37. package/Server/Utils/Workspace/Slack/Slack.ts +26 -6
  38. package/ServiceRoute.ts +2 -0
  39. package/Types/AnalyticsDatabase/AnalyticsTableName.ts +2 -0
  40. package/Types/CookieName.ts +1 -0
  41. package/Types/Dashboard/Chart/ChartType.ts +5 -0
  42. package/Types/Dashboard/DashboardComponentType.ts +4 -0
  43. package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +10 -0
  44. package/Types/Dashboard/DashboardComponents/DashboardChartComponent.ts +1 -2
  45. package/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.ts +17 -0
  46. package/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.ts +15 -0
  47. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.ts +14 -0
  48. package/Types/Dashboard/DashboardComponents/DashboardTextComponent.ts +1 -0
  49. package/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.ts +13 -0
  50. package/Types/Dashboard/DashboardComponents/DashboardValueComponent.ts +2 -0
  51. package/Types/Dashboard/DashboardTemplates.ts +964 -0
  52. package/Types/Dashboard/DashboardVariable.ts +23 -0
  53. package/Types/Dashboard/DashboardViewConfig.ts +59 -0
  54. package/Types/Dashboard/MasterPassword.ts +10 -0
  55. package/Types/Icon/IconProp.ts +1 -0
  56. package/Types/Incident/IncidentMetricType.ts +3 -0
  57. package/Types/MeteredPlan/ProductType.ts +1 -0
  58. package/Types/Metrics/MetricQueryConfigData.ts +3 -0
  59. package/Types/Monitor/CriteriaFilter.ts +3 -0
  60. package/Types/Monitor/KubernetesAlertTemplates.ts +78 -7
  61. package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +20 -0
  62. package/Types/Monitor/MonitorStep.ts +25 -0
  63. package/Types/Monitor/MonitorStepProfileMonitor.ts +96 -0
  64. package/Types/Monitor/MonitorType.ts +11 -0
  65. package/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.ts +12 -0
  66. package/Types/Permission.ts +87 -0
  67. package/Types/Telemetry/TelemetryType.ts +1 -0
  68. package/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.ts +1 -0
  69. package/UI/Components/Button/Button.tsx +1 -1
  70. package/UI/Components/Card/Card.tsx +8 -4
  71. package/UI/Components/Charts/Area/AreaChart.tsx +4 -0
  72. package/UI/Components/Charts/Bar/BarChart.tsx +4 -0
  73. package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +26 -0
  74. package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +26 -0
  75. package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +26 -0
  76. package/UI/Components/Charts/Line/LineChart.tsx +4 -0
  77. package/UI/Components/Charts/Types/ReferenceLineProps.ts +6 -0
  78. package/UI/Components/Icon/Icon.tsx +33 -0
  79. package/UI/Components/ModelTable/BaseModelTable.tsx +13 -10
  80. package/UI/Components/MoreMenu/MoreMenu.tsx +15 -2
  81. package/UI/Components/MoreMenu/MoreMenuItem.tsx +4 -4
  82. package/UI/Components/Workflow/Component.tsx +450 -209
  83. package/UI/Components/Workflow/ComponentPortViewer.tsx +57 -20
  84. package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +65 -25
  85. package/UI/Components/Workflow/ComponentSettingsModal.tsx +202 -37
  86. package/UI/Components/Workflow/ComponentsModal.tsx +180 -93
  87. package/UI/Components/Workflow/Workflow.tsx +105 -9
  88. package/UI/Config.ts +9 -0
  89. package/Utils/Dashboard/Components/DashboardChartComponent.ts +53 -22
  90. package/Utils/Dashboard/Components/DashboardGaugeComponent.ts +124 -0
  91. package/Utils/Dashboard/Components/DashboardLogStreamComponent.ts +110 -0
  92. package/Utils/Dashboard/Components/DashboardTableComponent.ts +86 -0
  93. package/Utils/Dashboard/Components/DashboardTextComponent.ts +32 -7
  94. package/Utils/Dashboard/Components/DashboardTraceListComponent.ts +86 -0
  95. package/Utils/Dashboard/Components/DashboardValueComponent.ts +39 -3
  96. package/Utils/Dashboard/Components/Index.ts +28 -0
  97. package/Utils/ValueFormatter.ts +170 -0
  98. package/build/dist/Models/AnalyticsModels/Index.js +4 -0
  99. package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
  100. package/build/dist/Models/AnalyticsModels/Profile.js +621 -0
  101. package/build/dist/Models/AnalyticsModels/Profile.js.map +1 -0
  102. package/build/dist/Models/AnalyticsModels/ProfileSample.js +497 -0
  103. package/build/dist/Models/AnalyticsModels/ProfileSample.js.map +1 -0
  104. package/build/dist/Models/DatabaseModels/Dashboard.js +365 -0
  105. package/build/dist/Models/DatabaseModels/Dashboard.js.map +1 -1
  106. package/build/dist/Models/DatabaseModels/DashboardDomain.js +691 -0
  107. package/build/dist/Models/DatabaseModels/DashboardDomain.js.map +1 -0
  108. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  109. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  110. package/build/dist/Models/DatabaseModels/StatusPage.js +42 -0
  111. package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
  112. package/build/dist/Server/API/DashboardAPI.js +293 -0
  113. package/build/dist/Server/API/DashboardAPI.js.map +1 -0
  114. package/build/dist/Server/API/DashboardDomainAPI.js +124 -0
  115. package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -0
  116. package/build/dist/Server/API/StatusPageAPI.js +26 -2
  117. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  118. package/build/dist/Server/API/TelemetryAPI.js +222 -0
  119. package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
  120. package/build/dist/Server/EnvironmentConfig.js +4 -0
  121. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  122. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.js +40 -0
  123. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.js.map +1 -0
  124. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.js +12 -0
  125. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.js.map +1 -0
  126. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.js +23 -0
  127. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.js.map +1 -0
  128. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.js +26 -0
  129. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.js.map +1 -0
  130. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  131. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  132. package/build/dist/Server/Middleware/UserAuthorization.js +41 -0
  133. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  134. package/build/dist/Server/Services/DashboardDomainService.js +595 -0
  135. package/build/dist/Server/Services/DashboardDomainService.js.map +1 -0
  136. package/build/dist/Server/Services/DashboardService.js +117 -3
  137. package/build/dist/Server/Services/DashboardService.js.map +1 -1
  138. package/build/dist/Server/Services/IncidentService.js +231 -55
  139. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  140. package/build/dist/Server/Services/IncidentStateTimelineService.js +1 -1
  141. package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
  142. package/build/dist/Server/Services/Index.js +6 -0
  143. package/build/dist/Server/Services/Index.js.map +1 -1
  144. package/build/dist/Server/Services/MonitorService.js +5 -2
  145. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  146. package/build/dist/Server/Services/ProfileAggregationService.js +356 -0
  147. package/build/dist/Server/Services/ProfileAggregationService.js.map +1 -0
  148. package/build/dist/Server/Services/ProfileSampleService.js +9 -0
  149. package/build/dist/Server/Services/ProfileSampleService.js.map +1 -0
  150. package/build/dist/Server/Services/ProfileService.js +9 -0
  151. package/build/dist/Server/Services/ProfileService.js.map +1 -0
  152. package/build/dist/Server/Services/TelemetryUsageBillingService.js +61 -4
  153. package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
  154. package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js +13 -1
  155. package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js.map +1 -1
  156. package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js +8 -0
  157. package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js.map +1 -1
  158. package/build/dist/Server/Utils/Cookie.js +36 -0
  159. package/build/dist/Server/Utils/Cookie.js.map +1 -1
  160. package/build/dist/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.js +34 -0
  161. package/build/dist/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.js.map +1 -0
  162. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +173 -0
  163. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  164. package/build/dist/Server/Utils/Profile/PprofEncoder.js +129 -0
  165. package/build/dist/Server/Utils/Profile/PprofEncoder.js.map +1 -0
  166. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +36 -14
  167. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  168. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +23 -6
  169. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  170. package/build/dist/ServiceRoute.js +1 -0
  171. package/build/dist/ServiceRoute.js.map +1 -1
  172. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +2 -0
  173. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
  174. package/build/dist/Types/CookieName.js +1 -0
  175. package/build/dist/Types/CookieName.js.map +1 -1
  176. package/build/dist/Types/Dashboard/Chart/ChartType.js +5 -0
  177. package/build/dist/Types/Dashboard/Chart/ChartType.js.map +1 -1
  178. package/build/dist/Types/Dashboard/DashboardComponentType.js +4 -0
  179. package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
  180. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
  181. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
  182. package/build/dist/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.js +2 -0
  183. package/build/dist/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.js.map +1 -0
  184. package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.js +2 -0
  185. package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.js.map +1 -0
  186. package/build/dist/Types/Dashboard/DashboardComponents/DashboardTableComponent.js +2 -0
  187. package/build/dist/Types/Dashboard/DashboardComponents/DashboardTableComponent.js.map +1 -0
  188. package/build/dist/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.js +2 -0
  189. package/build/dist/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.js.map +1 -0
  190. package/build/dist/Types/Dashboard/DashboardTemplates.js +853 -0
  191. package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -0
  192. package/build/dist/Types/Dashboard/DashboardVariable.js +7 -0
  193. package/build/dist/Types/Dashboard/DashboardVariable.js.map +1 -0
  194. package/build/dist/Types/Dashboard/DashboardViewConfig.js +50 -1
  195. package/build/dist/Types/Dashboard/DashboardViewConfig.js.map +1 -1
  196. package/build/dist/Types/Dashboard/MasterPassword.js +5 -0
  197. package/build/dist/Types/Dashboard/MasterPassword.js.map +1 -0
  198. package/build/dist/Types/Icon/IconProp.js +1 -0
  199. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  200. package/build/dist/Types/Incident/IncidentMetricType.js +3 -0
  201. package/build/dist/Types/Incident/IncidentMetricType.js.map +1 -1
  202. package/build/dist/Types/MeteredPlan/ProductType.js +1 -0
  203. package/build/dist/Types/MeteredPlan/ProductType.js.map +1 -1
  204. package/build/dist/Types/Metrics/MetricQueryConfigData.js +1 -0
  205. package/build/dist/Types/Metrics/MetricQueryConfigData.js.map +1 -1
  206. package/build/dist/Types/Monitor/CriteriaFilter.js +2 -0
  207. package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
  208. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +58 -7
  209. package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
  210. package/build/dist/Types/Monitor/MonitorStep.js +15 -0
  211. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  212. package/build/dist/Types/Monitor/MonitorStepProfileMonitor.js +59 -0
  213. package/build/dist/Types/Monitor/MonitorStepProfileMonitor.js.map +1 -0
  214. package/build/dist/Types/Monitor/MonitorType.js +10 -0
  215. package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
  216. package/build/dist/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.js +2 -0
  217. package/build/dist/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.js.map +1 -0
  218. package/build/dist/Types/Permission.js +75 -0
  219. package/build/dist/Types/Permission.js.map +1 -1
  220. package/build/dist/Types/Telemetry/TelemetryType.js +1 -0
  221. package/build/dist/Types/Telemetry/TelemetryType.js.map +1 -1
  222. package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.js +1 -0
  223. package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.js.map +1 -1
  224. package/build/dist/UI/Components/Button/Button.js +1 -1
  225. package/build/dist/UI/Components/Button/Button.js.map +1 -1
  226. package/build/dist/UI/Components/Card/Card.js +4 -4
  227. package/build/dist/UI/Components/Card/Card.js.map +1 -1
  228. package/build/dist/UI/Components/Charts/Area/AreaChart.js +1 -1
  229. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  230. package/build/dist/UI/Components/Charts/Bar/BarChart.js +1 -1
  231. package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
  232. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +5 -2
  233. package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
  234. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +5 -2
  235. package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
  236. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +6 -3
  237. package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
  238. package/build/dist/UI/Components/Charts/Line/LineChart.js +1 -1
  239. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  240. package/build/dist/UI/Components/Charts/Types/ReferenceLineProps.js +2 -0
  241. package/build/dist/UI/Components/Charts/Types/ReferenceLineProps.js.map +1 -0
  242. package/build/dist/UI/Components/Icon/Icon.js +11 -0
  243. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  244. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +12 -9
  245. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  246. package/build/dist/UI/Components/MoreMenu/MoreMenu.js +8 -2
  247. package/build/dist/UI/Components/MoreMenu/MoreMenu.js.map +1 -1
  248. package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js +4 -4
  249. package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js.map +1 -1
  250. package/build/dist/UI/Components/Workflow/Component.js +311 -143
  251. package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
  252. package/build/dist/UI/Components/Workflow/ComponentPortViewer.js +44 -18
  253. package/build/dist/UI/Components/Workflow/ComponentPortViewer.js.map +1 -1
  254. package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +48 -22
  255. package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
  256. package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js +127 -21
  257. package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js.map +1 -1
  258. package/build/dist/UI/Components/Workflow/ComponentsModal.js +107 -52
  259. package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
  260. package/build/dist/UI/Components/Workflow/Workflow.js +87 -12
  261. package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
  262. package/build/dist/UI/Config.js +3 -1
  263. package/build/dist/UI/Config.js.map +1 -1
  264. package/build/dist/Utils/Dashboard/Components/DashboardChartComponent.js +50 -21
  265. package/build/dist/Utils/Dashboard/Components/DashboardChartComponent.js.map +1 -1
  266. package/build/dist/Utils/Dashboard/Components/DashboardGaugeComponent.js +104 -0
  267. package/build/dist/Utils/Dashboard/Components/DashboardGaugeComponent.js.map +1 -0
  268. package/build/dist/Utils/Dashboard/Components/DashboardLogStreamComponent.js +91 -0
  269. package/build/dist/Utils/Dashboard/Components/DashboardLogStreamComponent.js.map +1 -0
  270. package/build/dist/Utils/Dashboard/Components/DashboardTableComponent.js +70 -0
  271. package/build/dist/Utils/Dashboard/Components/DashboardTableComponent.js.map +1 -0
  272. package/build/dist/Utils/Dashboard/Components/DashboardTextComponent.js +28 -7
  273. package/build/dist/Utils/Dashboard/Components/DashboardTextComponent.js.map +1 -1
  274. package/build/dist/Utils/Dashboard/Components/DashboardTraceListComponent.js +70 -0
  275. package/build/dist/Utils/Dashboard/Components/DashboardTraceListComponent.js.map +1 -0
  276. package/build/dist/Utils/Dashboard/Components/DashboardValueComponent.js +34 -3
  277. package/build/dist/Utils/Dashboard/Components/DashboardValueComponent.js.map +1 -1
  278. package/build/dist/Utils/Dashboard/Components/Index.js +16 -0
  279. package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
  280. package/build/dist/Utils/ValueFormatter.js +132 -0
  281. package/build/dist/Utils/ValueFormatter.js.map +1 -0
  282. package/package.json +1 -1
@@ -0,0 +1,964 @@
1
+ import DashboardViewConfig from "./DashboardViewConfig";
2
+ import { ObjectType } from "../JSON";
3
+ import DashboardSize from "./DashboardSize";
4
+ import DashboardComponentType from "./DashboardComponentType";
5
+ import DashboardChartType from "./Chart/ChartType";
6
+ import ObjectID from "../ObjectID";
7
+ import DashboardBaseComponent from "./DashboardComponents/DashboardBaseComponent";
8
+ import IconProp from "../Icon/IconProp";
9
+ import MetricsAggregationType from "../Metrics/MetricsAggregationType";
10
+ import IncidentMetricType from "../Incident/IncidentMetricType";
11
+ import MonitorMetricType from "../Monitor/MonitorMetricType";
12
+
13
+ export enum DashboardTemplateType {
14
+ Blank = "Blank",
15
+ Monitor = "Monitor",
16
+ Incident = "Incident",
17
+ Kubernetes = "Kubernetes",
18
+ }
19
+
20
+ export interface DashboardTemplate {
21
+ type: DashboardTemplateType;
22
+ name: string;
23
+ description: string;
24
+ icon: IconProp;
25
+ }
26
+
27
+ export const DashboardTemplates: Array<DashboardTemplate> = [
28
+ {
29
+ type: DashboardTemplateType.Blank,
30
+ name: "Blank Dashboard",
31
+ description: "Start from scratch with an empty dashboard.",
32
+ icon: IconProp.Add,
33
+ },
34
+ {
35
+ type: DashboardTemplateType.Monitor,
36
+ name: "Monitor Dashboard",
37
+ description:
38
+ "Response time, uptime, error rate, throughput charts, health gauges, and logs.",
39
+ icon: IconProp.Heartbeat,
40
+ },
41
+ {
42
+ type: DashboardTemplateType.Incident,
43
+ name: "Incident Dashboard",
44
+ description:
45
+ "MTTR/MTTA gauges, incident trends, severity breakdown, duration tables, logs, and traces.",
46
+ icon: IconProp.Alert,
47
+ },
48
+ {
49
+ type: DashboardTemplateType.Kubernetes,
50
+ name: "Kubernetes Dashboard",
51
+ description:
52
+ "CPU/memory gauges, pod and node metrics, network I/O, restart trends, and cluster logs.",
53
+ icon: IconProp.Kubernetes,
54
+ },
55
+ ];
56
+
57
+ // -- Metric query config helpers --
58
+
59
+ interface MetricConfig {
60
+ metricName: string;
61
+ aggregationType: MetricsAggregationType;
62
+ legend?: string;
63
+ legendUnit?: string;
64
+ }
65
+
66
+ function buildMetricQueryConfig(config: MetricConfig): Record<string, unknown> {
67
+ return {
68
+ metricAliasData: {
69
+ metricVariable: "a",
70
+ title: undefined,
71
+ description: undefined,
72
+ legend: config.legend ?? undefined,
73
+ legendUnit: config.legendUnit ?? undefined,
74
+ },
75
+ metricQueryData: {
76
+ filterData: {
77
+ metricName: config.metricName,
78
+ aggegationType: config.aggregationType,
79
+ },
80
+ groupBy: undefined,
81
+ },
82
+ };
83
+ }
84
+
85
+ function buildMetricQueryData(config: MetricConfig): Record<string, unknown> {
86
+ return {
87
+ metricQueryData: {
88
+ filterData: {
89
+ metricName: config.metricName,
90
+ aggegationType: config.aggregationType,
91
+ },
92
+ groupBy: undefined,
93
+ },
94
+ };
95
+ }
96
+
97
+ // -- Component factory helpers --
98
+
99
+ function createTextComponent(data: {
100
+ text: string;
101
+ top: number;
102
+ left: number;
103
+ width: number;
104
+ height: number;
105
+ isBold?: boolean;
106
+ }): DashboardBaseComponent {
107
+ return {
108
+ _type: ObjectType.DashboardComponent,
109
+ componentType: DashboardComponentType.Text,
110
+ componentId: ObjectID.generate(),
111
+ topInDashboardUnits: data.top,
112
+ leftInDashboardUnits: data.left,
113
+ widthInDashboardUnits: data.width,
114
+ heightInDashboardUnits: data.height,
115
+ minHeightInDashboardUnits: 1,
116
+ minWidthInDashboardUnits: 3,
117
+ arguments: {
118
+ text: data.text,
119
+ isBold: data.isBold ?? false,
120
+ isItalic: false,
121
+ isUnderline: false,
122
+ isMarkdown: false,
123
+ },
124
+ };
125
+ }
126
+
127
+ function createValueComponent(data: {
128
+ title: string;
129
+ top: number;
130
+ left: number;
131
+ width: number;
132
+ metricConfig?: MetricConfig;
133
+ }): DashboardBaseComponent {
134
+ return {
135
+ _type: ObjectType.DashboardComponent,
136
+ componentType: DashboardComponentType.Value,
137
+ componentId: ObjectID.generate(),
138
+ topInDashboardUnits: data.top,
139
+ leftInDashboardUnits: data.left,
140
+ widthInDashboardUnits: data.width,
141
+ heightInDashboardUnits: 1,
142
+ minHeightInDashboardUnits: 1,
143
+ minWidthInDashboardUnits: 1,
144
+ arguments: {
145
+ title: data.title,
146
+ metricQueryConfig: data.metricConfig
147
+ ? buildMetricQueryData(data.metricConfig)
148
+ : {
149
+ metricQueryData: {
150
+ filterData: {},
151
+ groupBy: undefined,
152
+ },
153
+ },
154
+ },
155
+ };
156
+ }
157
+
158
+ function createChartComponent(data: {
159
+ title: string;
160
+ chartType: DashboardChartType;
161
+ top: number;
162
+ left: number;
163
+ width: number;
164
+ height: number;
165
+ metricConfig?: MetricConfig;
166
+ }): DashboardBaseComponent {
167
+ return {
168
+ _type: ObjectType.DashboardComponent,
169
+ componentType: DashboardComponentType.Chart,
170
+ componentId: ObjectID.generate(),
171
+ topInDashboardUnits: data.top,
172
+ leftInDashboardUnits: data.left,
173
+ widthInDashboardUnits: data.width,
174
+ heightInDashboardUnits: data.height,
175
+ minHeightInDashboardUnits: 3,
176
+ minWidthInDashboardUnits: 6,
177
+ arguments: {
178
+ chartTitle: data.title,
179
+ chartType: data.chartType,
180
+ metricQueryConfig: data.metricConfig
181
+ ? buildMetricQueryConfig(data.metricConfig)
182
+ : {
183
+ metricAliasData: {
184
+ metricVariable: "a",
185
+ title: undefined,
186
+ description: undefined,
187
+ legend: undefined,
188
+ legendUnit: undefined,
189
+ },
190
+ metricQueryData: {
191
+ filterData: {},
192
+ groupBy: undefined,
193
+ },
194
+ },
195
+ },
196
+ };
197
+ }
198
+
199
+ function createLogStreamComponent(data: {
200
+ title: string;
201
+ top: number;
202
+ left: number;
203
+ width: number;
204
+ height: number;
205
+ }): DashboardBaseComponent {
206
+ return {
207
+ _type: ObjectType.DashboardComponent,
208
+ componentType: DashboardComponentType.LogStream,
209
+ componentId: ObjectID.generate(),
210
+ topInDashboardUnits: data.top,
211
+ leftInDashboardUnits: data.left,
212
+ widthInDashboardUnits: data.width,
213
+ heightInDashboardUnits: data.height,
214
+ minHeightInDashboardUnits: 3,
215
+ minWidthInDashboardUnits: 6,
216
+ arguments: {
217
+ title: data.title,
218
+ maxRows: 50,
219
+ },
220
+ };
221
+ }
222
+
223
+ function createGaugeComponent(data: {
224
+ title: string;
225
+ top: number;
226
+ left: number;
227
+ width: number;
228
+ height: number;
229
+ minValue?: number;
230
+ maxValue?: number;
231
+ warningThreshold?: number;
232
+ criticalThreshold?: number;
233
+ metricConfig?: MetricConfig;
234
+ }): DashboardBaseComponent {
235
+ return {
236
+ _type: ObjectType.DashboardComponent,
237
+ componentType: DashboardComponentType.Gauge,
238
+ componentId: ObjectID.generate(),
239
+ topInDashboardUnits: data.top,
240
+ leftInDashboardUnits: data.left,
241
+ widthInDashboardUnits: data.width,
242
+ heightInDashboardUnits: data.height,
243
+ minHeightInDashboardUnits: 3,
244
+ minWidthInDashboardUnits: 3,
245
+ arguments: {
246
+ gaugeTitle: data.title,
247
+ minValue: data.minValue ?? 0,
248
+ maxValue: data.maxValue ?? 100,
249
+ warningThreshold: data.warningThreshold,
250
+ criticalThreshold: data.criticalThreshold,
251
+ metricQueryConfig: data.metricConfig
252
+ ? buildMetricQueryData(data.metricConfig)
253
+ : {
254
+ metricQueryData: {
255
+ filterData: {},
256
+ groupBy: undefined,
257
+ },
258
+ },
259
+ },
260
+ };
261
+ }
262
+
263
+ function createTableComponent(data: {
264
+ title: string;
265
+ top: number;
266
+ left: number;
267
+ width: number;
268
+ height: number;
269
+ maxRows?: number;
270
+ metricConfig?: MetricConfig;
271
+ }): DashboardBaseComponent {
272
+ return {
273
+ _type: ObjectType.DashboardComponent,
274
+ componentType: DashboardComponentType.Table,
275
+ componentId: ObjectID.generate(),
276
+ topInDashboardUnits: data.top,
277
+ leftInDashboardUnits: data.left,
278
+ widthInDashboardUnits: data.width,
279
+ heightInDashboardUnits: data.height,
280
+ minHeightInDashboardUnits: 3,
281
+ minWidthInDashboardUnits: 6,
282
+ arguments: {
283
+ tableTitle: data.title,
284
+ maxRows: data.maxRows ?? 20,
285
+ metricQueryConfig: data.metricConfig
286
+ ? buildMetricQueryData(data.metricConfig)
287
+ : {
288
+ metricQueryData: {
289
+ filterData: {},
290
+ groupBy: undefined,
291
+ },
292
+ },
293
+ },
294
+ };
295
+ }
296
+
297
+ function createTraceListComponent(data: {
298
+ title: string;
299
+ top: number;
300
+ left: number;
301
+ width: number;
302
+ height: number;
303
+ maxRows?: number;
304
+ }): DashboardBaseComponent {
305
+ return {
306
+ _type: ObjectType.DashboardComponent,
307
+ componentType: DashboardComponentType.TraceList,
308
+ componentId: ObjectID.generate(),
309
+ topInDashboardUnits: data.top,
310
+ leftInDashboardUnits: data.left,
311
+ widthInDashboardUnits: data.width,
312
+ heightInDashboardUnits: data.height,
313
+ minHeightInDashboardUnits: 3,
314
+ minWidthInDashboardUnits: 6,
315
+ arguments: {
316
+ title: data.title,
317
+ maxRows: data.maxRows ?? 20,
318
+ },
319
+ };
320
+ }
321
+
322
+ // -- Dashboard configs --
323
+
324
+ function createMonitorDashboardConfig(): DashboardViewConfig {
325
+ const components: Array<DashboardBaseComponent> = [
326
+ // Row 0: Title
327
+ createTextComponent({
328
+ text: "Monitor Dashboard",
329
+ top: 0,
330
+ left: 0,
331
+ width: 12,
332
+ height: 1,
333
+ isBold: true,
334
+ }),
335
+
336
+ // Row 1: Key metric values
337
+ createValueComponent({
338
+ title: "Response Time",
339
+ top: 1,
340
+ left: 0,
341
+ width: 3,
342
+ metricConfig: {
343
+ metricName: MonitorMetricType.ResponseTime,
344
+ aggregationType: MetricsAggregationType.Avg,
345
+ legendUnit: "ms",
346
+ },
347
+ }),
348
+ createValueComponent({
349
+ title: "Uptime %",
350
+ top: 1,
351
+ left: 3,
352
+ width: 3,
353
+ metricConfig: {
354
+ metricName: MonitorMetricType.IsOnline,
355
+ aggregationType: MetricsAggregationType.Avg,
356
+ legendUnit: "%",
357
+ },
358
+ }),
359
+ createValueComponent({
360
+ title: "Error Rate",
361
+ top: 1,
362
+ left: 6,
363
+ width: 3,
364
+ metricConfig: {
365
+ metricName: MonitorMetricType.ResponseStatusCode,
366
+ aggregationType: MetricsAggregationType.Count,
367
+ },
368
+ }),
369
+ createValueComponent({
370
+ title: "Execution Time",
371
+ top: 1,
372
+ left: 9,
373
+ width: 3,
374
+ metricConfig: {
375
+ metricName: MonitorMetricType.ExecutionTime,
376
+ aggregationType: MetricsAggregationType.Avg,
377
+ legendUnit: "ms",
378
+ },
379
+ }),
380
+
381
+ // Row 2-4: Charts
382
+ createChartComponent({
383
+ title: "Response Time Over Time",
384
+ chartType: DashboardChartType.Line,
385
+ top: 2,
386
+ left: 0,
387
+ width: 6,
388
+ height: 3,
389
+ metricConfig: {
390
+ metricName: MonitorMetricType.ResponseTime,
391
+ aggregationType: MetricsAggregationType.Avg,
392
+ legend: "Avg Response Time",
393
+ legendUnit: "ms",
394
+ },
395
+ }),
396
+ createChartComponent({
397
+ title: "Uptime Over Time",
398
+ chartType: DashboardChartType.Area,
399
+ top: 2,
400
+ left: 6,
401
+ width: 6,
402
+ height: 3,
403
+ metricConfig: {
404
+ metricName: MonitorMetricType.IsOnline,
405
+ aggregationType: MetricsAggregationType.Avg,
406
+ legend: "Online Status",
407
+ legendUnit: "%",
408
+ },
409
+ }),
410
+
411
+ // Row 5: Section header
412
+ createTextComponent({
413
+ text: "Health & Errors",
414
+ top: 5,
415
+ left: 0,
416
+ width: 12,
417
+ height: 1,
418
+ isBold: true,
419
+ }),
420
+
421
+ // Row 6-8: Gauges and error chart
422
+ createGaugeComponent({
423
+ title: "CPU Usage",
424
+ top: 6,
425
+ left: 0,
426
+ width: 3,
427
+ height: 3,
428
+ minValue: 0,
429
+ maxValue: 100,
430
+ warningThreshold: 70,
431
+ criticalThreshold: 90,
432
+ metricConfig: {
433
+ metricName: MonitorMetricType.CPUUsagePercent,
434
+ aggregationType: MetricsAggregationType.Avg,
435
+ },
436
+ }),
437
+ createGaugeComponent({
438
+ title: "Memory Usage",
439
+ top: 6,
440
+ left: 3,
441
+ width: 3,
442
+ height: 3,
443
+ minValue: 0,
444
+ maxValue: 100,
445
+ warningThreshold: 70,
446
+ criticalThreshold: 90,
447
+ metricConfig: {
448
+ metricName: MonitorMetricType.MemoryUsagePercent,
449
+ aggregationType: MetricsAggregationType.Avg,
450
+ },
451
+ }),
452
+ createChartComponent({
453
+ title: "Status Code Over Time",
454
+ chartType: DashboardChartType.Bar,
455
+ top: 6,
456
+ left: 6,
457
+ width: 6,
458
+ height: 3,
459
+ metricConfig: {
460
+ metricName: MonitorMetricType.ResponseStatusCode,
461
+ aggregationType: MetricsAggregationType.Count,
462
+ legend: "Status Codes",
463
+ },
464
+ }),
465
+
466
+ // Row 9: Section header
467
+ createTextComponent({
468
+ text: "Details",
469
+ top: 9,
470
+ left: 0,
471
+ width: 12,
472
+ height: 1,
473
+ isBold: true,
474
+ }),
475
+
476
+ // Row 10-12: Table and logs
477
+ createTableComponent({
478
+ title: "Response Time Breakdown",
479
+ top: 10,
480
+ left: 0,
481
+ width: 6,
482
+ height: 3,
483
+ metricConfig: {
484
+ metricName: MonitorMetricType.ResponseTime,
485
+ aggregationType: MetricsAggregationType.Avg,
486
+ },
487
+ }),
488
+ createLogStreamComponent({
489
+ title: "Recent Logs",
490
+ top: 10,
491
+ left: 6,
492
+ width: 6,
493
+ height: 3,
494
+ }),
495
+ ];
496
+
497
+ return {
498
+ _type: ObjectType.DashboardViewConfig,
499
+ components,
500
+ heightInDashboardUnits: Math.max(DashboardSize.heightInDashboardUnits, 13),
501
+ };
502
+ }
503
+
504
+ function createIncidentDashboardConfig(): DashboardViewConfig {
505
+ const components: Array<DashboardBaseComponent> = [
506
+ // Row 0: Title
507
+ createTextComponent({
508
+ text: "Incident Dashboard",
509
+ top: 0,
510
+ left: 0,
511
+ width: 12,
512
+ height: 1,
513
+ isBold: true,
514
+ }),
515
+
516
+ // Row 1: Key incident metrics
517
+ createValueComponent({
518
+ title: "Incident Count",
519
+ top: 1,
520
+ left: 0,
521
+ width: 3,
522
+ metricConfig: {
523
+ metricName: IncidentMetricType.IncidentCount,
524
+ aggregationType: MetricsAggregationType.Sum,
525
+ },
526
+ }),
527
+ createValueComponent({
528
+ title: "MTTR",
529
+ top: 1,
530
+ left: 3,
531
+ width: 3,
532
+ metricConfig: {
533
+ metricName: IncidentMetricType.TimeToResolve,
534
+ aggregationType: MetricsAggregationType.Avg,
535
+ legendUnit: "min",
536
+ },
537
+ }),
538
+ createValueComponent({
539
+ title: "MTTA",
540
+ top: 1,
541
+ left: 6,
542
+ width: 3,
543
+ metricConfig: {
544
+ metricName: IncidentMetricType.TimeToAcknowledge,
545
+ aggregationType: MetricsAggregationType.Avg,
546
+ legendUnit: "min",
547
+ },
548
+ }),
549
+ createValueComponent({
550
+ title: "Avg Duration",
551
+ top: 1,
552
+ left: 9,
553
+ width: 3,
554
+ metricConfig: {
555
+ metricName: IncidentMetricType.IncidentDuration,
556
+ aggregationType: MetricsAggregationType.Avg,
557
+ legendUnit: "min",
558
+ },
559
+ }),
560
+
561
+ // Row 2-4: Incident trends
562
+ createChartComponent({
563
+ title: "Incidents Over Time",
564
+ chartType: DashboardChartType.Bar,
565
+ top: 2,
566
+ left: 0,
567
+ width: 6,
568
+ height: 3,
569
+ metricConfig: {
570
+ metricName: IncidentMetricType.IncidentCount,
571
+ aggregationType: MetricsAggregationType.Sum,
572
+ legend: "Incidents",
573
+ },
574
+ }),
575
+ createChartComponent({
576
+ title: "Incident Duration Over Time",
577
+ chartType: DashboardChartType.Line,
578
+ top: 2,
579
+ left: 6,
580
+ width: 6,
581
+ height: 3,
582
+ metricConfig: {
583
+ metricName: IncidentMetricType.IncidentDuration,
584
+ aggregationType: MetricsAggregationType.Avg,
585
+ legend: "Avg Duration",
586
+ legendUnit: "min",
587
+ },
588
+ }),
589
+
590
+ // Row 5: Section header
591
+ createTextComponent({
592
+ text: "Response Performance",
593
+ top: 5,
594
+ left: 0,
595
+ width: 12,
596
+ height: 1,
597
+ isBold: true,
598
+ }),
599
+
600
+ // Row 6-8: Gauges for MTTR/MTTA and resolution chart
601
+ createGaugeComponent({
602
+ title: "MTTR (minutes)",
603
+ top: 6,
604
+ left: 0,
605
+ width: 3,
606
+ height: 3,
607
+ minValue: 0,
608
+ maxValue: 120,
609
+ warningThreshold: 60,
610
+ criticalThreshold: 90,
611
+ metricConfig: {
612
+ metricName: IncidentMetricType.TimeToResolve,
613
+ aggregationType: MetricsAggregationType.Avg,
614
+ },
615
+ }),
616
+ createGaugeComponent({
617
+ title: "MTTA (minutes)",
618
+ top: 6,
619
+ left: 3,
620
+ width: 3,
621
+ height: 3,
622
+ minValue: 0,
623
+ maxValue: 60,
624
+ warningThreshold: 15,
625
+ criticalThreshold: 30,
626
+ metricConfig: {
627
+ metricName: IncidentMetricType.TimeToAcknowledge,
628
+ aggregationType: MetricsAggregationType.Avg,
629
+ },
630
+ }),
631
+ createChartComponent({
632
+ title: "MTTR and MTTA Over Time",
633
+ chartType: DashboardChartType.Area,
634
+ top: 6,
635
+ left: 6,
636
+ width: 6,
637
+ height: 3,
638
+ metricConfig: {
639
+ metricName: IncidentMetricType.TimeToResolve,
640
+ aggregationType: MetricsAggregationType.Avg,
641
+ legend: "MTTR",
642
+ legendUnit: "min",
643
+ },
644
+ }),
645
+
646
+ // Row 9: Section header
647
+ createTextComponent({
648
+ text: "Breakdown & Analysis",
649
+ top: 9,
650
+ left: 0,
651
+ width: 12,
652
+ height: 1,
653
+ isBold: true,
654
+ }),
655
+
656
+ // Row 10-12: Severity breakdown and time in state
657
+ createChartComponent({
658
+ title: "Severity Changes Over Time",
659
+ chartType: DashboardChartType.Pie,
660
+ top: 10,
661
+ left: 0,
662
+ width: 6,
663
+ height: 3,
664
+ metricConfig: {
665
+ metricName: IncidentMetricType.SeverityChange,
666
+ aggregationType: MetricsAggregationType.Count,
667
+ legend: "Severity Changes",
668
+ },
669
+ }),
670
+ createChartComponent({
671
+ title: "Time in State",
672
+ chartType: DashboardChartType.StackedArea,
673
+ top: 10,
674
+ left: 6,
675
+ width: 6,
676
+ height: 3,
677
+ metricConfig: {
678
+ metricName: IncidentMetricType.TimeInState,
679
+ aggregationType: MetricsAggregationType.Avg,
680
+ legend: "Time in State",
681
+ legendUnit: "min",
682
+ },
683
+ }),
684
+
685
+ // Row 13: Section header
686
+ createTextComponent({
687
+ text: "Incident Details",
688
+ top: 13,
689
+ left: 0,
690
+ width: 12,
691
+ height: 1,
692
+ isBold: true,
693
+ }),
694
+
695
+ // Row 14-16: Tables
696
+ createTableComponent({
697
+ title: "Incidents by Duration",
698
+ top: 14,
699
+ left: 0,
700
+ width: 6,
701
+ height: 3,
702
+ metricConfig: {
703
+ metricName: IncidentMetricType.IncidentDuration,
704
+ aggregationType: MetricsAggregationType.Max,
705
+ },
706
+ }),
707
+ createTableComponent({
708
+ title: "Postmortem Completion Time",
709
+ top: 14,
710
+ left: 6,
711
+ width: 6,
712
+ height: 3,
713
+ metricConfig: {
714
+ metricName: IncidentMetricType.PostmortemCompletionTime,
715
+ aggregationType: MetricsAggregationType.Avg,
716
+ },
717
+ }),
718
+
719
+ // Row 17-19: Logs and traces
720
+ createLogStreamComponent({
721
+ title: "Recent Incident Logs",
722
+ top: 17,
723
+ left: 0,
724
+ width: 6,
725
+ height: 3,
726
+ }),
727
+ createTraceListComponent({
728
+ title: "Recent Traces",
729
+ top: 17,
730
+ left: 6,
731
+ width: 6,
732
+ height: 3,
733
+ }),
734
+ ];
735
+
736
+ return {
737
+ _type: ObjectType.DashboardViewConfig,
738
+ components,
739
+ heightInDashboardUnits: Math.max(DashboardSize.heightInDashboardUnits, 20),
740
+ };
741
+ }
742
+
743
+ function createKubernetesDashboardConfig(): DashboardViewConfig {
744
+ const components: Array<DashboardBaseComponent> = [
745
+ // Row 0: Title
746
+ createTextComponent({
747
+ text: "Kubernetes Dashboard",
748
+ top: 0,
749
+ left: 0,
750
+ width: 12,
751
+ height: 1,
752
+ isBold: true,
753
+ }),
754
+
755
+ // Row 1: Key cluster metrics
756
+ createValueComponent({
757
+ title: "CPU Usage",
758
+ top: 1,
759
+ left: 0,
760
+ width: 3,
761
+ metricConfig: {
762
+ metricName: "k8s.pod.cpu.utilization",
763
+ aggregationType: MetricsAggregationType.Avg,
764
+ legendUnit: "%",
765
+ },
766
+ }),
767
+ createValueComponent({
768
+ title: "Memory Usage",
769
+ top: 1,
770
+ left: 3,
771
+ width: 3,
772
+ metricConfig: {
773
+ metricName: "k8s.pod.memory.usage",
774
+ aggregationType: MetricsAggregationType.Avg,
775
+ legendUnit: "bytes",
776
+ },
777
+ }),
778
+ createValueComponent({
779
+ title: "Pod Count",
780
+ top: 1,
781
+ left: 6,
782
+ width: 3,
783
+ metricConfig: {
784
+ metricName: "k8s.pod.phase",
785
+ aggregationType: MetricsAggregationType.Sum,
786
+ },
787
+ }),
788
+ createValueComponent({
789
+ title: "Node Ready",
790
+ top: 1,
791
+ left: 9,
792
+ width: 3,
793
+ metricConfig: {
794
+ metricName: "k8s.node.condition_ready",
795
+ aggregationType: MetricsAggregationType.Sum,
796
+ },
797
+ }),
798
+
799
+ // Row 2-4: Resource usage charts
800
+ createChartComponent({
801
+ title: "CPU Usage Over Time",
802
+ chartType: DashboardChartType.Line,
803
+ top: 2,
804
+ left: 0,
805
+ width: 6,
806
+ height: 3,
807
+ metricConfig: {
808
+ metricName: "k8s.pod.cpu.utilization",
809
+ aggregationType: MetricsAggregationType.Avg,
810
+ legend: "CPU Utilization",
811
+ legendUnit: "%",
812
+ },
813
+ }),
814
+ createChartComponent({
815
+ title: "Memory Usage Over Time",
816
+ chartType: DashboardChartType.Area,
817
+ top: 2,
818
+ left: 6,
819
+ width: 6,
820
+ height: 3,
821
+ metricConfig: {
822
+ metricName: "k8s.pod.memory.usage",
823
+ aggregationType: MetricsAggregationType.Avg,
824
+ legend: "Memory Usage",
825
+ legendUnit: "bytes",
826
+ },
827
+ }),
828
+
829
+ // Row 5: Section header
830
+ createTextComponent({
831
+ text: "Resource Health",
832
+ top: 5,
833
+ left: 0,
834
+ width: 12,
835
+ height: 1,
836
+ isBold: true,
837
+ }),
838
+
839
+ // Row 6-8: Gauges and pod chart
840
+ createGaugeComponent({
841
+ title: "CPU Utilization",
842
+ top: 6,
843
+ left: 0,
844
+ width: 3,
845
+ height: 3,
846
+ minValue: 0,
847
+ maxValue: 100,
848
+ warningThreshold: 70,
849
+ criticalThreshold: 90,
850
+ metricConfig: {
851
+ metricName: "k8s.node.cpu.utilization",
852
+ aggregationType: MetricsAggregationType.Avg,
853
+ },
854
+ }),
855
+ createGaugeComponent({
856
+ title: "Memory Utilization",
857
+ top: 6,
858
+ left: 3,
859
+ width: 3,
860
+ height: 3,
861
+ minValue: 0,
862
+ maxValue: 100,
863
+ warningThreshold: 70,
864
+ criticalThreshold: 90,
865
+ metricConfig: {
866
+ metricName: "k8s.node.memory.usage",
867
+ aggregationType: MetricsAggregationType.Avg,
868
+ },
869
+ }),
870
+ createChartComponent({
871
+ title: "Pod Count Over Time",
872
+ chartType: DashboardChartType.StackedArea,
873
+ top: 6,
874
+ left: 6,
875
+ width: 6,
876
+ height: 3,
877
+ metricConfig: {
878
+ metricName: "k8s.pod.phase",
879
+ aggregationType: MetricsAggregationType.Sum,
880
+ legend: "Pods",
881
+ },
882
+ }),
883
+
884
+ // Row 9: Section header
885
+ createTextComponent({
886
+ text: "Workload Details",
887
+ top: 9,
888
+ left: 0,
889
+ width: 12,
890
+ height: 1,
891
+ isBold: true,
892
+ }),
893
+
894
+ // Row 10-12: Network, restarts
895
+ createChartComponent({
896
+ title: "Network I/O",
897
+ chartType: DashboardChartType.Area,
898
+ top: 10,
899
+ left: 0,
900
+ width: 6,
901
+ height: 3,
902
+ metricConfig: {
903
+ metricName: "k8s.pod.network.io",
904
+ aggregationType: MetricsAggregationType.Sum,
905
+ legend: "Network I/O",
906
+ legendUnit: "bytes",
907
+ },
908
+ }),
909
+ createChartComponent({
910
+ title: "Container Restarts Over Time",
911
+ chartType: DashboardChartType.Bar,
912
+ top: 10,
913
+ left: 6,
914
+ width: 6,
915
+ height: 3,
916
+ metricConfig: {
917
+ metricName: "k8s.container.restarts",
918
+ aggregationType: MetricsAggregationType.Max,
919
+ legend: "Restarts",
920
+ },
921
+ }),
922
+
923
+ // Row 13-15: Table and logs
924
+ createTableComponent({
925
+ title: "Deployment Replicas",
926
+ top: 13,
927
+ left: 0,
928
+ width: 6,
929
+ height: 3,
930
+ metricConfig: {
931
+ metricName: "k8s.deployment.available_replicas",
932
+ aggregationType: MetricsAggregationType.Min,
933
+ },
934
+ }),
935
+ createLogStreamComponent({
936
+ title: "Cluster Logs",
937
+ top: 13,
938
+ left: 6,
939
+ width: 6,
940
+ height: 3,
941
+ }),
942
+ ];
943
+
944
+ return {
945
+ _type: ObjectType.DashboardViewConfig,
946
+ components,
947
+ heightInDashboardUnits: Math.max(DashboardSize.heightInDashboardUnits, 16),
948
+ };
949
+ }
950
+
951
+ export function getTemplateConfig(
952
+ type: DashboardTemplateType,
953
+ ): DashboardViewConfig | null {
954
+ switch (type) {
955
+ case DashboardTemplateType.Monitor:
956
+ return createMonitorDashboardConfig();
957
+ case DashboardTemplateType.Incident:
958
+ return createIncidentDashboardConfig();
959
+ case DashboardTemplateType.Kubernetes:
960
+ return createKubernetesDashboardConfig();
961
+ case DashboardTemplateType.Blank:
962
+ return null;
963
+ }
964
+ }