@oneuptime/common 10.0.43 → 10.0.45

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 (120) hide show
  1. package/Models/DatabaseModels/Workflow.ts +29 -0
  2. package/Server/API/StatusPageAPI.ts +48 -0
  3. package/Server/EnvironmentConfig.ts +5 -8
  4. package/Server/Infrastructure/Postgres/SchemaMigrations/1774559064920-MigrationName.ts +22 -0
  5. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
  6. package/Server/Services/AlertService.ts +45 -0
  7. package/Server/Services/IncidentService.ts +81 -13
  8. package/Server/Services/LogAggregationService.ts +1 -0
  9. package/Server/Services/WorkflowService.ts +28 -1
  10. package/Server/Types/Workflow/Components/Webhook.ts +28 -5
  11. package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +29 -13
  12. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +163 -26
  13. package/Server/Utils/Monitor/MonitorMetricUtil.ts +92 -0
  14. package/Server/Utils/Profiling.ts +101 -0
  15. package/Server/Utils/VM/VMRunner.ts +88 -0
  16. package/Types/Dashboard/DashboardTemplates.ts +1149 -0
  17. package/Types/Exception/ExceptionMetricType.ts +15 -0
  18. package/Types/IsolatedVM/ReturnResult.ts +3 -0
  19. package/Types/Metrics/MetricDashboardMetricType.ts +28 -0
  20. package/Types/Metrics/MetricsQuery.ts +2 -1
  21. package/Types/Monitor/CustomCodeMonitor/CapturedMetric.ts +7 -0
  22. package/Types/Monitor/CustomCodeMonitor/CustomCodeMonitorResponse.ts +2 -0
  23. package/Types/Monitor/UptimeBarTooltipIncident.ts +21 -0
  24. package/Types/Profile/ProfileMetricType.ts +16 -0
  25. package/Types/Span/SpanMetricType.ts +17 -0
  26. package/UI/Components/Charts/Area/AreaChart.tsx +40 -33
  27. package/UI/Components/Charts/Bar/BarChart.tsx +37 -30
  28. package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +196 -51
  29. package/UI/Components/Charts/ChartGroup/NoDataMessage.tsx +13 -0
  30. package/UI/Components/Charts/Line/LineChart.tsx +39 -32
  31. package/UI/Components/Forms/BasicForm.tsx +1 -1
  32. package/UI/Components/Graphs/DayUptimeGraph.tsx +88 -35
  33. package/UI/Components/Graphs/UptimeBarTooltip.tsx +547 -0
  34. package/UI/Components/MonitorGraphs/Uptime.tsx +7 -0
  35. package/UI/Components/MonitorGraphs/UptimeBarDayModal.tsx +225 -0
  36. package/UI/Components/RadioButtons/GroupRadioButtons.tsx +1 -0
  37. package/UI/Components/Tooltip/Tooltip.tsx +29 -4
  38. package/UI/Components/Workflow/ComponentSettingsModal.tsx +2 -0
  39. package/UI/Components/Workflow/DocumentationViewer.tsx +5 -0
  40. package/UI/Components/Workflow/Workflow.tsx +2 -0
  41. package/Utils/Alerts/AlertMetricType.ts +98 -0
  42. package/Utils/Incident/IncidentMetricType.ts +130 -0
  43. package/build/dist/Models/DatabaseModels/Workflow.js +30 -0
  44. package/build/dist/Models/DatabaseModels/Workflow.js.map +1 -1
  45. package/build/dist/Server/API/StatusPageAPI.js +42 -0
  46. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  47. package/build/dist/Server/EnvironmentConfig.js +2 -2
  48. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  49. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064920-MigrationName.js +14 -0
  50. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064920-MigrationName.js.map +1 -0
  51. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
  52. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  53. package/build/dist/Server/Services/AlertService.js +34 -0
  54. package/build/dist/Server/Services/AlertService.js.map +1 -1
  55. package/build/dist/Server/Services/IncidentService.js +52 -9
  56. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  57. package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
  58. package/build/dist/Server/Services/WorkflowService.js +25 -0
  59. package/build/dist/Server/Services/WorkflowService.js.map +1 -1
  60. package/build/dist/Server/Types/Workflow/Components/Webhook.js +23 -5
  61. package/build/dist/Server/Types/Workflow/Components/Webhook.js.map +1 -1
  62. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +21 -7
  63. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
  64. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +120 -21
  65. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  66. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js +68 -1
  67. package/build/dist/Server/Utils/Monitor/MonitorMetricUtil.js.map +1 -1
  68. package/build/dist/Server/Utils/Profiling.js +80 -0
  69. package/build/dist/Server/Utils/Profiling.js.map +1 -0
  70. package/build/dist/Server/Utils/VM/VMRunner.js +68 -0
  71. package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
  72. package/build/dist/Types/Dashboard/DashboardTemplates.js +1095 -0
  73. package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
  74. package/build/dist/Types/Exception/ExceptionMetricType.js +16 -0
  75. package/build/dist/Types/Exception/ExceptionMetricType.js.map +1 -0
  76. package/build/dist/Types/Metrics/MetricDashboardMetricType.js +26 -0
  77. package/build/dist/Types/Metrics/MetricDashboardMetricType.js.map +1 -0
  78. package/build/dist/Types/Monitor/CustomCodeMonitor/CapturedMetric.js +2 -0
  79. package/build/dist/Types/Monitor/CustomCodeMonitor/CapturedMetric.js.map +1 -0
  80. package/build/dist/Types/Monitor/UptimeBarTooltipIncident.js +2 -0
  81. package/build/dist/Types/Monitor/UptimeBarTooltipIncident.js.map +1 -0
  82. package/build/dist/Types/Profile/ProfileMetricType.js +17 -0
  83. package/build/dist/Types/Profile/ProfileMetricType.js.map +1 -0
  84. package/build/dist/Types/Span/SpanMetricType.js +18 -0
  85. package/build/dist/Types/Span/SpanMetricType.js.map +1 -0
  86. package/build/dist/UI/Components/Charts/Area/AreaChart.js +21 -16
  87. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  88. package/build/dist/UI/Components/Charts/Bar/BarChart.js +20 -15
  89. package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
  90. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +73 -15
  91. package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
  92. package/build/dist/UI/Components/Charts/ChartGroup/NoDataMessage.js +7 -0
  93. package/build/dist/UI/Components/Charts/ChartGroup/NoDataMessage.js.map +1 -0
  94. package/build/dist/UI/Components/Charts/Line/LineChart.js +20 -15
  95. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  96. package/build/dist/UI/Components/Forms/BasicForm.js +1 -1
  97. package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
  98. package/build/dist/UI/Components/Graphs/DayUptimeGraph.js +46 -20
  99. package/build/dist/UI/Components/Graphs/DayUptimeGraph.js.map +1 -1
  100. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js +303 -0
  101. package/build/dist/UI/Components/Graphs/UptimeBarTooltip.js.map +1 -0
  102. package/build/dist/UI/Components/MonitorGraphs/Uptime.js +1 -1
  103. package/build/dist/UI/Components/MonitorGraphs/Uptime.js.map +1 -1
  104. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js +118 -0
  105. package/build/dist/UI/Components/MonitorGraphs/UptimeBarDayModal.js.map +1 -0
  106. package/build/dist/UI/Components/RadioButtons/GroupRadioButtons.js +1 -1
  107. package/build/dist/UI/Components/RadioButtons/GroupRadioButtons.js.map +1 -1
  108. package/build/dist/UI/Components/Tooltip/Tooltip.js +13 -3
  109. package/build/dist/UI/Components/Tooltip/Tooltip.js.map +1 -1
  110. package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js +1 -1
  111. package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js.map +1 -1
  112. package/build/dist/UI/Components/Workflow/DocumentationViewer.js +1 -0
  113. package/build/dist/UI/Components/Workflow/DocumentationViewer.js.map +1 -1
  114. package/build/dist/UI/Components/Workflow/Workflow.js +1 -1
  115. package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
  116. package/build/dist/Utils/Alerts/AlertMetricType.js +84 -0
  117. package/build/dist/Utils/Alerts/AlertMetricType.js.map +1 -0
  118. package/build/dist/Utils/Incident/IncidentMetricType.js +114 -0
  119. package/build/dist/Utils/Incident/IncidentMetricType.js.map +1 -0
  120. package/package.json +3 -2
@@ -9,12 +9,20 @@ import IconProp from "../Icon/IconProp";
9
9
  import MetricsAggregationType from "../Metrics/MetricsAggregationType";
10
10
  import IncidentMetricType from "../Incident/IncidentMetricType";
11
11
  import MonitorMetricType from "../Monitor/MonitorMetricType";
12
+ import SpanMetricType from "../Span/SpanMetricType";
13
+ import ExceptionMetricType from "../Exception/ExceptionMetricType";
14
+ import ProfileMetricType from "../Profile/ProfileMetricType";
15
+ import MetricDashboardMetricType from "../Metrics/MetricDashboardMetricType";
12
16
 
13
17
  export enum DashboardTemplateType {
14
18
  Blank = "Blank",
15
19
  Monitor = "Monitor",
16
20
  Incident = "Incident",
17
21
  Kubernetes = "Kubernetes",
22
+ Metrics = "Metrics",
23
+ Trace = "Trace",
24
+ Exception = "Exception",
25
+ Profiles = "Profiles",
18
26
  }
19
27
 
20
28
  export interface DashboardTemplate {
@@ -52,6 +60,34 @@ export const DashboardTemplates: Array<DashboardTemplate> = [
52
60
  "CPU/memory gauges, pod and node metrics, network I/O, restart trends, and cluster logs.",
53
61
  icon: IconProp.Kubernetes,
54
62
  },
63
+ {
64
+ type: DashboardTemplateType.Metrics,
65
+ name: "Metrics Dashboard",
66
+ description:
67
+ "HTTP request rates, latency percentiles, error rates, system resource usage, and custom application metrics.",
68
+ icon: IconProp.ChartBar,
69
+ },
70
+ {
71
+ type: DashboardTemplateType.Trace,
72
+ name: "Trace Dashboard",
73
+ description:
74
+ "Span throughput, latency percentiles, error rates, service health, status breakdown, and recent traces.",
75
+ icon: IconProp.Activity,
76
+ },
77
+ {
78
+ type: DashboardTemplateType.Exception,
79
+ name: "Exception Dashboard",
80
+ description:
81
+ "Exception counts, error rates, top exception types, resolution status, affected services, and logs.",
82
+ icon: IconProp.Bug,
83
+ },
84
+ {
85
+ type: DashboardTemplateType.Profiles,
86
+ name: "Profiles Dashboard",
87
+ description:
88
+ "CPU profiles, memory allocations, heap usage, thread counts, top functions by CPU time, and flamegraph data.",
89
+ icon: IconProp.Fire,
90
+ },
55
91
  ];
56
92
 
57
93
  // -- Metric query config helpers --
@@ -948,6 +984,1111 @@ function createKubernetesDashboardConfig(): DashboardViewConfig {
948
984
  };
949
985
  }
950
986
 
987
+ function createMetricsDashboardConfig(): DashboardViewConfig {
988
+ const components: Array<DashboardBaseComponent> = [
989
+ // Row 0: Title
990
+ createTextComponent({
991
+ text: "Metrics Dashboard",
992
+ top: 0,
993
+ left: 0,
994
+ width: 12,
995
+ height: 1,
996
+ isBold: true,
997
+ }),
998
+
999
+ // Row 1: Key HTTP metrics
1000
+ createValueComponent({
1001
+ title: "Request Rate",
1002
+ top: 1,
1003
+ left: 0,
1004
+ width: 3,
1005
+ metricConfig: {
1006
+ metricName: MetricDashboardMetricType.HttpRequestCount,
1007
+ aggregationType: MetricsAggregationType.Sum,
1008
+ legendUnit: "req/s",
1009
+ },
1010
+ }),
1011
+ createValueComponent({
1012
+ title: "Avg Latency",
1013
+ top: 1,
1014
+ left: 3,
1015
+ width: 3,
1016
+ metricConfig: {
1017
+ metricName: MetricDashboardMetricType.HttpRequestDuration,
1018
+ aggregationType: MetricsAggregationType.Avg,
1019
+ legendUnit: "ms",
1020
+ },
1021
+ }),
1022
+ createValueComponent({
1023
+ title: "Error Rate",
1024
+ top: 1,
1025
+ left: 6,
1026
+ width: 3,
1027
+ metricConfig: {
1028
+ metricName: MetricDashboardMetricType.HttpRequestErrorRate,
1029
+ aggregationType: MetricsAggregationType.Avg,
1030
+ legendUnit: "%",
1031
+ },
1032
+ }),
1033
+ createValueComponent({
1034
+ title: "Active Requests",
1035
+ top: 1,
1036
+ left: 9,
1037
+ width: 3,
1038
+ metricConfig: {
1039
+ metricName: MetricDashboardMetricType.HttpActiveRequests,
1040
+ aggregationType: MetricsAggregationType.Avg,
1041
+ },
1042
+ }),
1043
+
1044
+ // Row 2-4: HTTP request charts
1045
+ createChartComponent({
1046
+ title: "Request Rate Over Time",
1047
+ chartType: DashboardChartType.Bar,
1048
+ top: 2,
1049
+ left: 0,
1050
+ width: 6,
1051
+ height: 3,
1052
+ metricConfig: {
1053
+ metricName: MetricDashboardMetricType.HttpRequestCount,
1054
+ aggregationType: MetricsAggregationType.Sum,
1055
+ legend: "Requests",
1056
+ legendUnit: "req/s",
1057
+ },
1058
+ }),
1059
+ createChartComponent({
1060
+ title: "Request Latency Over Time",
1061
+ chartType: DashboardChartType.Line,
1062
+ top: 2,
1063
+ left: 6,
1064
+ width: 6,
1065
+ height: 3,
1066
+ metricConfig: {
1067
+ metricName: MetricDashboardMetricType.HttpRequestDuration,
1068
+ aggregationType: MetricsAggregationType.Avg,
1069
+ legend: "Avg Latency",
1070
+ legendUnit: "ms",
1071
+ },
1072
+ }),
1073
+
1074
+ // Row 5: Section header
1075
+ createTextComponent({
1076
+ text: "Error Analysis",
1077
+ top: 5,
1078
+ left: 0,
1079
+ width: 12,
1080
+ height: 1,
1081
+ isBold: true,
1082
+ }),
1083
+
1084
+ // Row 6-8: Error charts and response sizes
1085
+ createChartComponent({
1086
+ title: "Error Rate Over Time",
1087
+ chartType: DashboardChartType.Area,
1088
+ top: 6,
1089
+ left: 0,
1090
+ width: 6,
1091
+ height: 3,
1092
+ metricConfig: {
1093
+ metricName: MetricDashboardMetricType.HttpRequestErrorRate,
1094
+ aggregationType: MetricsAggregationType.Avg,
1095
+ legend: "Error Rate",
1096
+ legendUnit: "%",
1097
+ },
1098
+ }),
1099
+ createChartComponent({
1100
+ title: "Response Size Over Time",
1101
+ chartType: DashboardChartType.Line,
1102
+ top: 6,
1103
+ left: 6,
1104
+ width: 6,
1105
+ height: 3,
1106
+ metricConfig: {
1107
+ metricName: MetricDashboardMetricType.HttpResponseSize,
1108
+ aggregationType: MetricsAggregationType.Avg,
1109
+ legend: "Response Size",
1110
+ legendUnit: "bytes",
1111
+ },
1112
+ }),
1113
+
1114
+ // Row 9: Section header
1115
+ createTextComponent({
1116
+ text: "System Resources",
1117
+ top: 9,
1118
+ left: 0,
1119
+ width: 12,
1120
+ height: 1,
1121
+ isBold: true,
1122
+ }),
1123
+
1124
+ // Row 10-12: System resource gauges and charts
1125
+ createGaugeComponent({
1126
+ title: "CPU Utilization",
1127
+ top: 10,
1128
+ left: 0,
1129
+ width: 3,
1130
+ height: 3,
1131
+ minValue: 0,
1132
+ maxValue: 100,
1133
+ warningThreshold: 70,
1134
+ criticalThreshold: 90,
1135
+ metricConfig: {
1136
+ metricName: MetricDashboardMetricType.SystemCpuUtilization,
1137
+ aggregationType: MetricsAggregationType.Avg,
1138
+ },
1139
+ }),
1140
+ createGaugeComponent({
1141
+ title: "Memory Usage",
1142
+ top: 10,
1143
+ left: 3,
1144
+ width: 3,
1145
+ height: 3,
1146
+ minValue: 0,
1147
+ maxValue: 100,
1148
+ warningThreshold: 70,
1149
+ criticalThreshold: 90,
1150
+ metricConfig: {
1151
+ metricName: MetricDashboardMetricType.SystemMemoryUsage,
1152
+ aggregationType: MetricsAggregationType.Avg,
1153
+ },
1154
+ }),
1155
+ createChartComponent({
1156
+ title: "CPU Usage Over Time",
1157
+ chartType: DashboardChartType.Area,
1158
+ top: 10,
1159
+ left: 6,
1160
+ width: 6,
1161
+ height: 3,
1162
+ metricConfig: {
1163
+ metricName: MetricDashboardMetricType.SystemCpuUtilization,
1164
+ aggregationType: MetricsAggregationType.Avg,
1165
+ legend: "CPU %",
1166
+ legendUnit: "%",
1167
+ },
1168
+ }),
1169
+
1170
+ // Row 13: Section header
1171
+ createTextComponent({
1172
+ text: "I/O & Network",
1173
+ top: 13,
1174
+ left: 0,
1175
+ width: 12,
1176
+ height: 1,
1177
+ isBold: true,
1178
+ }),
1179
+
1180
+ // Row 14-16: Disk and network I/O
1181
+ createChartComponent({
1182
+ title: "Disk I/O Over Time",
1183
+ chartType: DashboardChartType.StackedArea,
1184
+ top: 14,
1185
+ left: 0,
1186
+ width: 6,
1187
+ height: 3,
1188
+ metricConfig: {
1189
+ metricName: MetricDashboardMetricType.SystemDiskIo,
1190
+ aggregationType: MetricsAggregationType.Sum,
1191
+ legend: "Disk I/O",
1192
+ legendUnit: "bytes",
1193
+ },
1194
+ }),
1195
+ createChartComponent({
1196
+ title: "Network I/O Over Time",
1197
+ chartType: DashboardChartType.StackedArea,
1198
+ top: 14,
1199
+ left: 6,
1200
+ width: 6,
1201
+ height: 3,
1202
+ metricConfig: {
1203
+ metricName: MetricDashboardMetricType.SystemNetworkIo,
1204
+ aggregationType: MetricsAggregationType.Sum,
1205
+ legend: "Network I/O",
1206
+ legendUnit: "bytes",
1207
+ },
1208
+ }),
1209
+
1210
+ // Row 17: Section header
1211
+ createTextComponent({
1212
+ text: "Runtime & Application",
1213
+ top: 17,
1214
+ left: 0,
1215
+ width: 12,
1216
+ height: 1,
1217
+ isBold: true,
1218
+ }),
1219
+
1220
+ // Row 18-20: Runtime metrics
1221
+ createChartComponent({
1222
+ title: "Process CPU Over Time",
1223
+ chartType: DashboardChartType.Line,
1224
+ top: 18,
1225
+ left: 0,
1226
+ width: 6,
1227
+ height: 3,
1228
+ metricConfig: {
1229
+ metricName: MetricDashboardMetricType.ProcessCpuUtilization,
1230
+ aggregationType: MetricsAggregationType.Avg,
1231
+ legend: "Process CPU",
1232
+ legendUnit: "%",
1233
+ },
1234
+ }),
1235
+ createChartComponent({
1236
+ title: "GC Duration Over Time",
1237
+ chartType: DashboardChartType.Bar,
1238
+ top: 18,
1239
+ left: 6,
1240
+ width: 6,
1241
+ height: 3,
1242
+ metricConfig: {
1243
+ metricName: MetricDashboardMetricType.GcDuration,
1244
+ aggregationType: MetricsAggregationType.Avg,
1245
+ legend: "GC Duration",
1246
+ legendUnit: "ms",
1247
+ },
1248
+ }),
1249
+
1250
+ // Row 21-23: Table and logs
1251
+ createTableComponent({
1252
+ title: "Top Metrics by Value",
1253
+ top: 21,
1254
+ left: 0,
1255
+ width: 6,
1256
+ height: 3,
1257
+ metricConfig: {
1258
+ metricName: MetricDashboardMetricType.HttpRequestDuration,
1259
+ aggregationType: MetricsAggregationType.Max,
1260
+ },
1261
+ }),
1262
+ createLogStreamComponent({
1263
+ title: "Recent Logs",
1264
+ top: 21,
1265
+ left: 6,
1266
+ width: 6,
1267
+ height: 3,
1268
+ }),
1269
+ ];
1270
+
1271
+ return {
1272
+ _type: ObjectType.DashboardViewConfig,
1273
+ components,
1274
+ heightInDashboardUnits: Math.max(DashboardSize.heightInDashboardUnits, 24),
1275
+ };
1276
+ }
1277
+
1278
+ function createTraceDashboardConfig(): DashboardViewConfig {
1279
+ const components: Array<DashboardBaseComponent> = [
1280
+ // Row 0: Title
1281
+ createTextComponent({
1282
+ text: "Trace Dashboard",
1283
+ top: 0,
1284
+ left: 0,
1285
+ width: 12,
1286
+ height: 1,
1287
+ isBold: true,
1288
+ }),
1289
+
1290
+ // Row 1: Key trace metrics
1291
+ createValueComponent({
1292
+ title: "Span Count",
1293
+ top: 1,
1294
+ left: 0,
1295
+ width: 3,
1296
+ metricConfig: {
1297
+ metricName: SpanMetricType.SpanCount,
1298
+ aggregationType: MetricsAggregationType.Sum,
1299
+ },
1300
+ }),
1301
+ createValueComponent({
1302
+ title: "Avg Duration",
1303
+ top: 1,
1304
+ left: 3,
1305
+ width: 3,
1306
+ metricConfig: {
1307
+ metricName: SpanMetricType.SpanDuration,
1308
+ aggregationType: MetricsAggregationType.Avg,
1309
+ legendUnit: "ms",
1310
+ },
1311
+ }),
1312
+ createValueComponent({
1313
+ title: "Error Rate",
1314
+ top: 1,
1315
+ left: 6,
1316
+ width: 3,
1317
+ metricConfig: {
1318
+ metricName: SpanMetricType.SpanErrorRate,
1319
+ aggregationType: MetricsAggregationType.Avg,
1320
+ legendUnit: "%",
1321
+ },
1322
+ }),
1323
+ createValueComponent({
1324
+ title: "Throughput",
1325
+ top: 1,
1326
+ left: 9,
1327
+ width: 3,
1328
+ metricConfig: {
1329
+ metricName: SpanMetricType.SpanThroughput,
1330
+ aggregationType: MetricsAggregationType.Sum,
1331
+ legendUnit: "req/s",
1332
+ },
1333
+ }),
1334
+
1335
+ // Row 2-4: Throughput and duration charts
1336
+ createChartComponent({
1337
+ title: "Span Throughput Over Time",
1338
+ chartType: DashboardChartType.Bar,
1339
+ top: 2,
1340
+ left: 0,
1341
+ width: 6,
1342
+ height: 3,
1343
+ metricConfig: {
1344
+ metricName: SpanMetricType.SpanCount,
1345
+ aggregationType: MetricsAggregationType.Sum,
1346
+ legend: "Spans",
1347
+ },
1348
+ }),
1349
+ createChartComponent({
1350
+ title: "Avg Span Duration Over Time",
1351
+ chartType: DashboardChartType.Line,
1352
+ top: 2,
1353
+ left: 6,
1354
+ width: 6,
1355
+ height: 3,
1356
+ metricConfig: {
1357
+ metricName: SpanMetricType.SpanDuration,
1358
+ aggregationType: MetricsAggregationType.Avg,
1359
+ legend: "Avg Duration",
1360
+ legendUnit: "ms",
1361
+ },
1362
+ }),
1363
+
1364
+ // Row 5: Section header
1365
+ createTextComponent({
1366
+ text: "Latency Percentiles",
1367
+ top: 5,
1368
+ left: 0,
1369
+ width: 12,
1370
+ height: 1,
1371
+ isBold: true,
1372
+ }),
1373
+
1374
+ // Row 6: Latency percentile values
1375
+ createValueComponent({
1376
+ title: "P50 Latency",
1377
+ top: 6,
1378
+ left: 0,
1379
+ width: 3,
1380
+ metricConfig: {
1381
+ metricName: SpanMetricType.SpanP50Duration,
1382
+ aggregationType: MetricsAggregationType.Avg,
1383
+ legendUnit: "ms",
1384
+ },
1385
+ }),
1386
+ createValueComponent({
1387
+ title: "P90 Latency",
1388
+ top: 6,
1389
+ left: 3,
1390
+ width: 3,
1391
+ metricConfig: {
1392
+ metricName: SpanMetricType.SpanP90Duration,
1393
+ aggregationType: MetricsAggregationType.Avg,
1394
+ legendUnit: "ms",
1395
+ },
1396
+ }),
1397
+ createValueComponent({
1398
+ title: "P95 Latency",
1399
+ top: 6,
1400
+ left: 6,
1401
+ width: 3,
1402
+ metricConfig: {
1403
+ metricName: SpanMetricType.SpanP95Duration,
1404
+ aggregationType: MetricsAggregationType.Avg,
1405
+ legendUnit: "ms",
1406
+ },
1407
+ }),
1408
+ createValueComponent({
1409
+ title: "P99 Latency",
1410
+ top: 6,
1411
+ left: 9,
1412
+ width: 3,
1413
+ metricConfig: {
1414
+ metricName: SpanMetricType.SpanP99Duration,
1415
+ aggregationType: MetricsAggregationType.Avg,
1416
+ legendUnit: "ms",
1417
+ },
1418
+ }),
1419
+
1420
+ // Row 7-9: Latency percentile charts
1421
+ createChartComponent({
1422
+ title: "Latency Percentiles Over Time",
1423
+ chartType: DashboardChartType.Line,
1424
+ top: 7,
1425
+ left: 0,
1426
+ width: 6,
1427
+ height: 3,
1428
+ metricConfig: {
1429
+ metricName: SpanMetricType.SpanP95Duration,
1430
+ aggregationType: MetricsAggregationType.Avg,
1431
+ legend: "P95 Latency",
1432
+ legendUnit: "ms",
1433
+ },
1434
+ }),
1435
+ createChartComponent({
1436
+ title: "Latency Distribution",
1437
+ chartType: DashboardChartType.Histogram,
1438
+ top: 7,
1439
+ left: 6,
1440
+ width: 6,
1441
+ height: 3,
1442
+ metricConfig: {
1443
+ metricName: SpanMetricType.SpanDuration,
1444
+ aggregationType: MetricsAggregationType.Count,
1445
+ legend: "Latency Distribution",
1446
+ legendUnit: "ms",
1447
+ },
1448
+ }),
1449
+
1450
+ // Row 10: Section header
1451
+ createTextComponent({
1452
+ text: "Error Analysis",
1453
+ top: 10,
1454
+ left: 0,
1455
+ width: 12,
1456
+ height: 1,
1457
+ isBold: true,
1458
+ }),
1459
+
1460
+ // Row 11-13: Error charts and status breakdown
1461
+ createGaugeComponent({
1462
+ title: "Error Rate",
1463
+ top: 11,
1464
+ left: 0,
1465
+ width: 3,
1466
+ height: 3,
1467
+ minValue: 0,
1468
+ maxValue: 100,
1469
+ warningThreshold: 5,
1470
+ criticalThreshold: 15,
1471
+ metricConfig: {
1472
+ metricName: SpanMetricType.SpanErrorRate,
1473
+ aggregationType: MetricsAggregationType.Avg,
1474
+ },
1475
+ }),
1476
+ createChartComponent({
1477
+ title: "Errors Over Time",
1478
+ chartType: DashboardChartType.Area,
1479
+ top: 11,
1480
+ left: 3,
1481
+ width: 6,
1482
+ height: 3,
1483
+ metricConfig: {
1484
+ metricName: SpanMetricType.SpanErrorCount,
1485
+ aggregationType: MetricsAggregationType.Sum,
1486
+ legend: "Errors",
1487
+ },
1488
+ }),
1489
+ createChartComponent({
1490
+ title: "Span Status Breakdown",
1491
+ chartType: DashboardChartType.Pie,
1492
+ top: 11,
1493
+ left: 9,
1494
+ width: 3,
1495
+ height: 3,
1496
+ metricConfig: {
1497
+ metricName: SpanMetricType.SpanStatusOk,
1498
+ aggregationType: MetricsAggregationType.Count,
1499
+ legend: "Status",
1500
+ },
1501
+ }),
1502
+
1503
+ // Row 14: Section header
1504
+ createTextComponent({
1505
+ text: "Trace Details",
1506
+ top: 14,
1507
+ left: 0,
1508
+ width: 12,
1509
+ height: 1,
1510
+ isBold: true,
1511
+ }),
1512
+
1513
+ // Row 15-17: Table of slowest spans and request rate
1514
+ createTableComponent({
1515
+ title: "Slowest Spans",
1516
+ top: 15,
1517
+ left: 0,
1518
+ width: 6,
1519
+ height: 3,
1520
+ metricConfig: {
1521
+ metricName: SpanMetricType.SpanDuration,
1522
+ aggregationType: MetricsAggregationType.Max,
1523
+ },
1524
+ }),
1525
+ createChartComponent({
1526
+ title: "Request Rate Over Time",
1527
+ chartType: DashboardChartType.StackedArea,
1528
+ top: 15,
1529
+ left: 6,
1530
+ width: 6,
1531
+ height: 3,
1532
+ metricConfig: {
1533
+ metricName: SpanMetricType.SpanRequestRate,
1534
+ aggregationType: MetricsAggregationType.Sum,
1535
+ legend: "Request Rate",
1536
+ legendUnit: "req/s",
1537
+ },
1538
+ }),
1539
+
1540
+ // Row 18-20: Recent traces and logs
1541
+ createTraceListComponent({
1542
+ title: "Recent Traces",
1543
+ top: 18,
1544
+ left: 0,
1545
+ width: 6,
1546
+ height: 3,
1547
+ }),
1548
+ createLogStreamComponent({
1549
+ title: "Related Logs",
1550
+ top: 18,
1551
+ left: 6,
1552
+ width: 6,
1553
+ height: 3,
1554
+ }),
1555
+ ];
1556
+
1557
+ return {
1558
+ _type: ObjectType.DashboardViewConfig,
1559
+ components,
1560
+ heightInDashboardUnits: Math.max(DashboardSize.heightInDashboardUnits, 21),
1561
+ };
1562
+ }
1563
+
1564
+ function createExceptionDashboardConfig(): DashboardViewConfig {
1565
+ const components: Array<DashboardBaseComponent> = [
1566
+ // Row 0: Title
1567
+ createTextComponent({
1568
+ text: "Exception Dashboard",
1569
+ top: 0,
1570
+ left: 0,
1571
+ width: 12,
1572
+ height: 1,
1573
+ isBold: true,
1574
+ }),
1575
+
1576
+ // Row 1: Key exception metrics
1577
+ createValueComponent({
1578
+ title: "Total Exceptions",
1579
+ top: 1,
1580
+ left: 0,
1581
+ width: 3,
1582
+ metricConfig: {
1583
+ metricName: ExceptionMetricType.ExceptionCount,
1584
+ aggregationType: MetricsAggregationType.Sum,
1585
+ },
1586
+ }),
1587
+ createValueComponent({
1588
+ title: "Exception Rate",
1589
+ top: 1,
1590
+ left: 3,
1591
+ width: 3,
1592
+ metricConfig: {
1593
+ metricName: ExceptionMetricType.ExceptionRate,
1594
+ aggregationType: MetricsAggregationType.Avg,
1595
+ legendUnit: "/min",
1596
+ },
1597
+ }),
1598
+ createValueComponent({
1599
+ title: "Unresolved",
1600
+ top: 1,
1601
+ left: 6,
1602
+ width: 3,
1603
+ metricConfig: {
1604
+ metricName: ExceptionMetricType.UnresolvedExceptionCount,
1605
+ aggregationType: MetricsAggregationType.Sum,
1606
+ },
1607
+ }),
1608
+ createValueComponent({
1609
+ title: "Affected Services",
1610
+ top: 1,
1611
+ left: 9,
1612
+ width: 3,
1613
+ metricConfig: {
1614
+ metricName: ExceptionMetricType.ExceptionAffectedServiceCount,
1615
+ aggregationType: MetricsAggregationType.Sum,
1616
+ },
1617
+ }),
1618
+
1619
+ // Row 2-4: Exception trends
1620
+ createChartComponent({
1621
+ title: "Exceptions Over Time",
1622
+ chartType: DashboardChartType.Bar,
1623
+ top: 2,
1624
+ left: 0,
1625
+ width: 6,
1626
+ height: 3,
1627
+ metricConfig: {
1628
+ metricName: ExceptionMetricType.ExceptionCount,
1629
+ aggregationType: MetricsAggregationType.Sum,
1630
+ legend: "Exceptions",
1631
+ },
1632
+ }),
1633
+ createChartComponent({
1634
+ title: "Exception Rate Over Time",
1635
+ chartType: DashboardChartType.Line,
1636
+ top: 2,
1637
+ left: 6,
1638
+ width: 6,
1639
+ height: 3,
1640
+ metricConfig: {
1641
+ metricName: ExceptionMetricType.ExceptionRate,
1642
+ aggregationType: MetricsAggregationType.Avg,
1643
+ legend: "Exception Rate",
1644
+ legendUnit: "/min",
1645
+ },
1646
+ }),
1647
+
1648
+ // Row 5: Section header
1649
+ createTextComponent({
1650
+ text: "Exception Breakdown",
1651
+ top: 5,
1652
+ left: 0,
1653
+ width: 12,
1654
+ height: 1,
1655
+ isBold: true,
1656
+ }),
1657
+
1658
+ // Row 6-8: Exception type and service breakdown
1659
+ createChartComponent({
1660
+ title: "Exceptions by Type",
1661
+ chartType: DashboardChartType.Pie,
1662
+ top: 6,
1663
+ left: 0,
1664
+ width: 6,
1665
+ height: 3,
1666
+ metricConfig: {
1667
+ metricName: ExceptionMetricType.ExceptionCountByType,
1668
+ aggregationType: MetricsAggregationType.Count,
1669
+ legend: "Exception Type",
1670
+ },
1671
+ }),
1672
+ createChartComponent({
1673
+ title: "Exceptions by Service",
1674
+ chartType: DashboardChartType.Bar,
1675
+ top: 6,
1676
+ left: 6,
1677
+ width: 6,
1678
+ height: 3,
1679
+ metricConfig: {
1680
+ metricName: ExceptionMetricType.ExceptionCountByService,
1681
+ aggregationType: MetricsAggregationType.Count,
1682
+ legend: "Service",
1683
+ },
1684
+ }),
1685
+
1686
+ // Row 9: Section header
1687
+ createTextComponent({
1688
+ text: "Resolution Status",
1689
+ top: 9,
1690
+ left: 0,
1691
+ width: 12,
1692
+ height: 1,
1693
+ isBold: true,
1694
+ }),
1695
+
1696
+ // Row 10-12: Resolution gauges and resolution trends
1697
+ createGaugeComponent({
1698
+ title: "Unresolved Exceptions",
1699
+ top: 10,
1700
+ left: 0,
1701
+ width: 3,
1702
+ height: 3,
1703
+ minValue: 0,
1704
+ maxValue: 100,
1705
+ warningThreshold: 25,
1706
+ criticalThreshold: 50,
1707
+ metricConfig: {
1708
+ metricName: ExceptionMetricType.UnresolvedExceptionCount,
1709
+ aggregationType: MetricsAggregationType.Sum,
1710
+ },
1711
+ }),
1712
+ createGaugeComponent({
1713
+ title: "Muted Exceptions",
1714
+ top: 10,
1715
+ left: 3,
1716
+ width: 3,
1717
+ height: 3,
1718
+ minValue: 0,
1719
+ maxValue: 100,
1720
+ metricConfig: {
1721
+ metricName: ExceptionMetricType.MutedExceptionCount,
1722
+ aggregationType: MetricsAggregationType.Sum,
1723
+ },
1724
+ }),
1725
+ createChartComponent({
1726
+ title: "Resolution Status Over Time",
1727
+ chartType: DashboardChartType.StackedArea,
1728
+ top: 10,
1729
+ left: 6,
1730
+ width: 6,
1731
+ height: 3,
1732
+ metricConfig: {
1733
+ metricName: ExceptionMetricType.ResolvedExceptionCount,
1734
+ aggregationType: MetricsAggregationType.Sum,
1735
+ legend: "Resolved",
1736
+ },
1737
+ }),
1738
+
1739
+ // Row 13: Section header
1740
+ createTextComponent({
1741
+ text: "Exception Recurrence",
1742
+ top: 13,
1743
+ left: 0,
1744
+ width: 12,
1745
+ height: 1,
1746
+ isBold: true,
1747
+ }),
1748
+
1749
+ // Row 14-16: Occurrence trends and top exceptions table
1750
+ createChartComponent({
1751
+ title: "Exception Occurrences Over Time",
1752
+ chartType: DashboardChartType.Heatmap,
1753
+ top: 14,
1754
+ left: 0,
1755
+ width: 6,
1756
+ height: 3,
1757
+ metricConfig: {
1758
+ metricName: ExceptionMetricType.ExceptionOccurrenceCount,
1759
+ aggregationType: MetricsAggregationType.Sum,
1760
+ legend: "Occurrences",
1761
+ },
1762
+ }),
1763
+ createTableComponent({
1764
+ title: "Top Exceptions by Occurrence",
1765
+ top: 14,
1766
+ left: 6,
1767
+ width: 6,
1768
+ height: 3,
1769
+ metricConfig: {
1770
+ metricName: ExceptionMetricType.ExceptionOccurrenceCount,
1771
+ aggregationType: MetricsAggregationType.Max,
1772
+ },
1773
+ }),
1774
+
1775
+ // Row 17: Section header
1776
+ createTextComponent({
1777
+ text: "Exception Details",
1778
+ top: 17,
1779
+ left: 0,
1780
+ width: 12,
1781
+ height: 1,
1782
+ isBold: true,
1783
+ }),
1784
+
1785
+ // Row 18-20: Logs and traces
1786
+ createLogStreamComponent({
1787
+ title: "Exception Logs",
1788
+ top: 18,
1789
+ left: 0,
1790
+ width: 6,
1791
+ height: 3,
1792
+ }),
1793
+ createTraceListComponent({
1794
+ title: "Related Traces",
1795
+ top: 18,
1796
+ left: 6,
1797
+ width: 6,
1798
+ height: 3,
1799
+ }),
1800
+ ];
1801
+
1802
+ return {
1803
+ _type: ObjectType.DashboardViewConfig,
1804
+ components,
1805
+ heightInDashboardUnits: Math.max(DashboardSize.heightInDashboardUnits, 21),
1806
+ };
1807
+ }
1808
+
1809
+ function createProfilesDashboardConfig(): DashboardViewConfig {
1810
+ const components: Array<DashboardBaseComponent> = [
1811
+ // Row 0: Title
1812
+ createTextComponent({
1813
+ text: "Profiles Dashboard",
1814
+ top: 0,
1815
+ left: 0,
1816
+ width: 12,
1817
+ height: 1,
1818
+ isBold: true,
1819
+ }),
1820
+
1821
+ // Row 1: Key profile metrics
1822
+ createValueComponent({
1823
+ title: "Profile Count",
1824
+ top: 1,
1825
+ left: 0,
1826
+ width: 3,
1827
+ metricConfig: {
1828
+ metricName: ProfileMetricType.ProfileCount,
1829
+ aggregationType: MetricsAggregationType.Sum,
1830
+ },
1831
+ }),
1832
+ createValueComponent({
1833
+ title: "CPU Profile Duration",
1834
+ top: 1,
1835
+ left: 3,
1836
+ width: 3,
1837
+ metricConfig: {
1838
+ metricName: ProfileMetricType.CpuProfileDuration,
1839
+ aggregationType: MetricsAggregationType.Sum,
1840
+ legendUnit: "ms",
1841
+ },
1842
+ }),
1843
+ createValueComponent({
1844
+ title: "Memory Allocations",
1845
+ top: 1,
1846
+ left: 6,
1847
+ width: 3,
1848
+ metricConfig: {
1849
+ metricName: ProfileMetricType.MemoryAllocationCount,
1850
+ aggregationType: MetricsAggregationType.Sum,
1851
+ },
1852
+ }),
1853
+ createValueComponent({
1854
+ title: "Thread Count",
1855
+ top: 1,
1856
+ left: 9,
1857
+ width: 3,
1858
+ metricConfig: {
1859
+ metricName: ProfileMetricType.ThreadCount,
1860
+ aggregationType: MetricsAggregationType.Avg,
1861
+ },
1862
+ }),
1863
+
1864
+ // Row 2-4: CPU profile charts
1865
+ createChartComponent({
1866
+ title: "CPU Profile Duration Over Time",
1867
+ chartType: DashboardChartType.Line,
1868
+ top: 2,
1869
+ left: 0,
1870
+ width: 6,
1871
+ height: 3,
1872
+ metricConfig: {
1873
+ metricName: ProfileMetricType.CpuProfileDuration,
1874
+ aggregationType: MetricsAggregationType.Avg,
1875
+ legend: "CPU Duration",
1876
+ legendUnit: "ms",
1877
+ },
1878
+ }),
1879
+ createChartComponent({
1880
+ title: "CPU Sample Count Over Time",
1881
+ chartType: DashboardChartType.Bar,
1882
+ top: 2,
1883
+ left: 6,
1884
+ width: 6,
1885
+ height: 3,
1886
+ metricConfig: {
1887
+ metricName: ProfileMetricType.CpuProfileSampleCount,
1888
+ aggregationType: MetricsAggregationType.Sum,
1889
+ legend: "CPU Samples",
1890
+ },
1891
+ }),
1892
+
1893
+ // Row 5: Section header
1894
+ createTextComponent({
1895
+ text: "Memory Profiling",
1896
+ top: 5,
1897
+ left: 0,
1898
+ width: 12,
1899
+ height: 1,
1900
+ isBold: true,
1901
+ }),
1902
+
1903
+ // Row 6-8: Memory gauges and allocation charts
1904
+ createGaugeComponent({
1905
+ title: "Heap Usage",
1906
+ top: 6,
1907
+ left: 0,
1908
+ width: 3,
1909
+ height: 3,
1910
+ minValue: 0,
1911
+ maxValue: 100,
1912
+ warningThreshold: 70,
1913
+ criticalThreshold: 90,
1914
+ metricConfig: {
1915
+ metricName: ProfileMetricType.HeapUsage,
1916
+ aggregationType: MetricsAggregationType.Avg,
1917
+ },
1918
+ }),
1919
+ createChartComponent({
1920
+ title: "Memory Allocation Size Over Time",
1921
+ chartType: DashboardChartType.Area,
1922
+ top: 6,
1923
+ left: 3,
1924
+ width: 6,
1925
+ height: 3,
1926
+ metricConfig: {
1927
+ metricName: ProfileMetricType.MemoryAllocationSize,
1928
+ aggregationType: MetricsAggregationType.Sum,
1929
+ legend: "Allocation Size",
1930
+ legendUnit: "bytes",
1931
+ },
1932
+ }),
1933
+ createGaugeComponent({
1934
+ title: "Thread Count",
1935
+ top: 6,
1936
+ left: 9,
1937
+ width: 3,
1938
+ height: 3,
1939
+ minValue: 0,
1940
+ maxValue: 500,
1941
+ warningThreshold: 200,
1942
+ criticalThreshold: 400,
1943
+ metricConfig: {
1944
+ metricName: ProfileMetricType.ThreadCount,
1945
+ aggregationType: MetricsAggregationType.Avg,
1946
+ },
1947
+ }),
1948
+
1949
+ // Row 9: Section header
1950
+ createTextComponent({
1951
+ text: "Allocation Trends",
1952
+ top: 9,
1953
+ left: 0,
1954
+ width: 12,
1955
+ height: 1,
1956
+ isBold: true,
1957
+ }),
1958
+
1959
+ // Row 10-12: Allocation count trends and heap trends
1960
+ createChartComponent({
1961
+ title: "Memory Allocation Count Over Time",
1962
+ chartType: DashboardChartType.Bar,
1963
+ top: 10,
1964
+ left: 0,
1965
+ width: 6,
1966
+ height: 3,
1967
+ metricConfig: {
1968
+ metricName: ProfileMetricType.MemoryAllocationCount,
1969
+ aggregationType: MetricsAggregationType.Sum,
1970
+ legend: "Allocations",
1971
+ },
1972
+ }),
1973
+ createChartComponent({
1974
+ title: "Heap Usage Over Time",
1975
+ chartType: DashboardChartType.Area,
1976
+ top: 10,
1977
+ left: 6,
1978
+ width: 6,
1979
+ height: 3,
1980
+ metricConfig: {
1981
+ metricName: ProfileMetricType.HeapUsage,
1982
+ aggregationType: MetricsAggregationType.Avg,
1983
+ legend: "Heap",
1984
+ legendUnit: "bytes",
1985
+ },
1986
+ }),
1987
+
1988
+ // Row 13: Section header
1989
+ createTextComponent({
1990
+ text: "Runtime & Concurrency",
1991
+ top: 13,
1992
+ left: 0,
1993
+ width: 12,
1994
+ height: 1,
1995
+ isBold: true,
1996
+ }),
1997
+
1998
+ // Row 14-16: Wall clock, goroutines/threads, sample rate
1999
+ createChartComponent({
2000
+ title: "Wall Clock Duration Over Time",
2001
+ chartType: DashboardChartType.Line,
2002
+ top: 14,
2003
+ left: 0,
2004
+ width: 6,
2005
+ height: 3,
2006
+ metricConfig: {
2007
+ metricName: ProfileMetricType.WallClockDuration,
2008
+ aggregationType: MetricsAggregationType.Avg,
2009
+ legend: "Wall Clock",
2010
+ legendUnit: "ms",
2011
+ },
2012
+ }),
2013
+ createChartComponent({
2014
+ title: "Goroutine / Thread Count Over Time",
2015
+ chartType: DashboardChartType.StackedArea,
2016
+ top: 14,
2017
+ left: 6,
2018
+ width: 6,
2019
+ height: 3,
2020
+ metricConfig: {
2021
+ metricName: ProfileMetricType.GoroutineCount,
2022
+ aggregationType: MetricsAggregationType.Avg,
2023
+ legend: "Goroutines / Threads",
2024
+ },
2025
+ }),
2026
+
2027
+ // Row 17: Section header
2028
+ createTextComponent({
2029
+ text: "Hot Functions",
2030
+ top: 17,
2031
+ left: 0,
2032
+ width: 12,
2033
+ height: 1,
2034
+ isBold: true,
2035
+ }),
2036
+
2037
+ // Row 18-20: Top functions tables
2038
+ createTableComponent({
2039
+ title: "Top Functions by CPU Time",
2040
+ top: 18,
2041
+ left: 0,
2042
+ width: 6,
2043
+ height: 3,
2044
+ metricConfig: {
2045
+ metricName: ProfileMetricType.TopFunctionCpuTime,
2046
+ aggregationType: MetricsAggregationType.Max,
2047
+ },
2048
+ }),
2049
+ createTableComponent({
2050
+ title: "Top Functions by Allocations",
2051
+ top: 18,
2052
+ left: 6,
2053
+ width: 6,
2054
+ height: 3,
2055
+ metricConfig: {
2056
+ metricName: ProfileMetricType.TopFunctionAllocations,
2057
+ aggregationType: MetricsAggregationType.Max,
2058
+ },
2059
+ }),
2060
+
2061
+ // Row 21-23: Profile sample rate and logs
2062
+ createChartComponent({
2063
+ title: "Profile Sample Rate Over Time",
2064
+ chartType: DashboardChartType.Line,
2065
+ top: 21,
2066
+ left: 0,
2067
+ width: 6,
2068
+ height: 3,
2069
+ metricConfig: {
2070
+ metricName: ProfileMetricType.ProfileSampleRate,
2071
+ aggregationType: MetricsAggregationType.Avg,
2072
+ legend: "Sample Rate",
2073
+ legendUnit: "samples/s",
2074
+ },
2075
+ }),
2076
+ createLogStreamComponent({
2077
+ title: "Related Logs",
2078
+ top: 21,
2079
+ left: 6,
2080
+ width: 6,
2081
+ height: 3,
2082
+ }),
2083
+ ];
2084
+
2085
+ return {
2086
+ _type: ObjectType.DashboardViewConfig,
2087
+ components,
2088
+ heightInDashboardUnits: Math.max(DashboardSize.heightInDashboardUnits, 24),
2089
+ };
2090
+ }
2091
+
951
2092
  export function getTemplateConfig(
952
2093
  type: DashboardTemplateType,
953
2094
  ): DashboardViewConfig | null {
@@ -958,6 +2099,14 @@ export function getTemplateConfig(
958
2099
  return createIncidentDashboardConfig();
959
2100
  case DashboardTemplateType.Kubernetes:
960
2101
  return createKubernetesDashboardConfig();
2102
+ case DashboardTemplateType.Metrics:
2103
+ return createMetricsDashboardConfig();
2104
+ case DashboardTemplateType.Trace:
2105
+ return createTraceDashboardConfig();
2106
+ case DashboardTemplateType.Exception:
2107
+ return createExceptionDashboardConfig();
2108
+ case DashboardTemplateType.Profiles:
2109
+ return createProfilesDashboardConfig();
961
2110
  case DashboardTemplateType.Blank:
962
2111
  return null;
963
2112
  }