@oneuptime/common 10.0.38 → 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.
- package/Models/AnalyticsModels/Index.ts +4 -0
- package/Models/AnalyticsModels/Profile.ts +687 -0
- package/Models/AnalyticsModels/ProfileSample.ts +547 -0
- package/Models/DatabaseModels/Dashboard.ts +357 -0
- package/Models/DatabaseModels/DashboardDomain.ts +658 -0
- package/Models/DatabaseModels/Index.ts +2 -0
- package/Models/DatabaseModels/StatusPage.ts +41 -0
- package/Server/API/DashboardAPI.ts +408 -0
- package/Server/API/DashboardDomainAPI.ts +235 -0
- package/Server/API/StatusPageAPI.ts +36 -2
- package/Server/API/TelemetryAPI.ts +393 -0
- package/Server/EnvironmentConfig.ts +12 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.ts +97 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.ts +17 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.ts +50 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.ts +59 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Middleware/UserAuthorization.ts +96 -1
- package/Server/Services/DashboardDomainService.ts +647 -0
- package/Server/Services/DashboardService.ts +174 -3
- package/Server/Services/IncidentService.ts +295 -50
- package/Server/Services/IncidentStateTimelineService.ts +1 -0
- package/Server/Services/Index.ts +6 -0
- package/Server/Services/MonitorService.ts +5 -0
- package/Server/Services/ProfileAggregationService.ts +559 -0
- package/Server/Services/ProfileSampleService.ts +11 -0
- package/Server/Services/ProfileService.ts +11 -0
- package/Server/Services/TelemetryUsageBillingService.ts +77 -3
- package/Server/Services/WorkspaceNotificationSummaryService.ts +15 -1
- package/Server/Types/Billing/MeteredPlan/AllMeteredPlans.ts +9 -0
- package/Server/Types/Workflow/Components/Conditions/IfElse.ts +68 -21
- package/Server/Utils/Cookie.ts +48 -0
- package/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.ts +34 -0
- package/Server/Utils/Monitor/DataToProcess.ts +3 -1
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +299 -0
- package/Server/Utils/Profile/PprofEncoder.ts +225 -0
- package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +53 -16
- package/Server/Utils/Workspace/Slack/Slack.ts +26 -6
- package/ServiceRoute.ts +2 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.ts +2 -0
- package/Types/CookieName.ts +1 -0
- package/Types/Dashboard/Chart/ChartType.ts +5 -0
- package/Types/Dashboard/DashboardComponentType.ts +4 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +10 -0
- package/Types/Dashboard/DashboardComponents/DashboardChartComponent.ts +1 -2
- package/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.ts +17 -0
- package/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.ts +15 -0
- package/Types/Dashboard/DashboardComponents/DashboardTableComponent.ts +14 -0
- package/Types/Dashboard/DashboardComponents/DashboardTextComponent.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.ts +13 -0
- package/Types/Dashboard/DashboardComponents/DashboardValueComponent.ts +2 -0
- package/Types/Dashboard/DashboardTemplates.ts +964 -0
- package/Types/Dashboard/DashboardVariable.ts +23 -0
- package/Types/Dashboard/DashboardViewConfig.ts +59 -0
- package/Types/Dashboard/MasterPassword.ts +10 -0
- package/Types/Icon/IconProp.ts +1 -0
- package/Types/Incident/IncidentMetricType.ts +3 -0
- package/Types/MeteredPlan/ProductType.ts +1 -0
- package/Types/Metrics/MetricQueryConfigData.ts +3 -0
- package/Types/Monitor/CriteriaFilter.ts +3 -0
- package/Types/Monitor/KubernetesAlertTemplates.ts +78 -7
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +20 -0
- package/Types/Monitor/MonitorStep.ts +25 -0
- package/Types/Monitor/MonitorStepProfileMonitor.ts +96 -0
- package/Types/Monitor/MonitorType.ts +11 -0
- package/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.ts +12 -0
- package/Types/Permission.ts +87 -0
- package/Types/Telemetry/TelemetryType.ts +1 -0
- package/Types/Workflow/Component.ts +1 -0
- package/Types/Workflow/Components/Condition.ts +24 -0
- package/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.ts +1 -0
- package/UI/Components/Button/Button.tsx +1 -1
- package/UI/Components/Card/Card.tsx +8 -4
- package/UI/Components/Charts/Area/AreaChart.tsx +4 -0
- package/UI/Components/Charts/Bar/BarChart.tsx +4 -0
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +26 -0
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +26 -0
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +26 -0
- package/UI/Components/Charts/Line/LineChart.tsx +4 -0
- package/UI/Components/Charts/Types/ReferenceLineProps.ts +6 -0
- package/UI/Components/Icon/Icon.tsx +33 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +13 -10
- package/UI/Components/MoreMenu/MoreMenu.tsx +15 -2
- package/UI/Components/MoreMenu/MoreMenuItem.tsx +4 -4
- package/UI/Components/Workflow/Component.tsx +450 -209
- package/UI/Components/Workflow/ComponentPortViewer.tsx +57 -20
- package/UI/Components/Workflow/ComponentReturnValueViewer.tsx +65 -25
- package/UI/Components/Workflow/ComponentSettingsModal.tsx +202 -37
- package/UI/Components/Workflow/ComponentsModal.tsx +180 -93
- package/UI/Components/Workflow/Utils.ts +32 -1
- package/UI/Components/Workflow/Workflow.tsx +105 -9
- package/UI/Config.ts +9 -0
- package/Utils/Dashboard/Components/DashboardChartComponent.ts +53 -22
- package/Utils/Dashboard/Components/DashboardGaugeComponent.ts +124 -0
- package/Utils/Dashboard/Components/DashboardLogStreamComponent.ts +110 -0
- package/Utils/Dashboard/Components/DashboardTableComponent.ts +86 -0
- package/Utils/Dashboard/Components/DashboardTextComponent.ts +32 -7
- package/Utils/Dashboard/Components/DashboardTraceListComponent.ts +86 -0
- package/Utils/Dashboard/Components/DashboardValueComponent.ts +39 -3
- package/Utils/Dashboard/Components/Index.ts +28 -0
- package/Utils/ValueFormatter.ts +170 -0
- package/build/dist/Models/AnalyticsModels/Index.js +4 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Profile.js +621 -0
- package/build/dist/Models/AnalyticsModels/Profile.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/ProfileSample.js +497 -0
- package/build/dist/Models/AnalyticsModels/ProfileSample.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Dashboard.js +365 -0
- package/build/dist/Models/DatabaseModels/Dashboard.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DashboardDomain.js +691 -0
- package/build/dist/Models/DatabaseModels/DashboardDomain.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +42 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Server/API/DashboardAPI.js +293 -0
- package/build/dist/Server/API/DashboardAPI.js.map +1 -0
- package/build/dist/Server/API/DashboardDomainAPI.js +124 -0
- package/build/dist/Server/API/DashboardDomainAPI.js.map +1 -0
- package/build/dist/Server/API/StatusPageAPI.js +26 -2
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryAPI.js +222 -0
- package/build/dist/Server/API/TelemetryAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +4 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.js +40 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742177-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742178-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.js +23 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774524742179-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.js +26 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774559064919-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/UserAuthorization.js +41 -0
- package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
- package/build/dist/Server/Services/DashboardDomainService.js +595 -0
- package/build/dist/Server/Services/DashboardDomainService.js.map +1 -0
- package/build/dist/Server/Services/DashboardService.js +117 -3
- package/build/dist/Server/Services/DashboardService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +231 -55
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +6 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +5 -2
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/ProfileAggregationService.js +356 -0
- package/build/dist/Server/Services/ProfileAggregationService.js.map +1 -0
- package/build/dist/Server/Services/ProfileSampleService.js +9 -0
- package/build/dist/Server/Services/ProfileSampleService.js.map +1 -0
- package/build/dist/Server/Services/ProfileService.js +9 -0
- package/build/dist/Server/Services/ProfileService.js.map +1 -0
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +61 -4
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js +13 -1
- package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js.map +1 -1
- package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js +8 -0
- package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js +49 -19
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js.map +1 -1
- package/build/dist/Server/Utils/Cookie.js +36 -0
- package/build/dist/Server/Utils/Cookie.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.js +34 -0
- package/build/dist/Server/Utils/Monitor/Criteria/ProfileMonitorCriteria.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +173 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Profile/PprofEncoder.js +129 -0
- package/build/dist/Server/Utils/Profile/PprofEncoder.js.map +1 -0
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +36 -14
- package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js +23 -6
- package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
- package/build/dist/ServiceRoute.js +1 -0
- package/build/dist/ServiceRoute.js.map +1 -1
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +2 -0
- package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
- package/build/dist/Types/CookieName.js +1 -0
- package/build/dist/Types/CookieName.js.map +1 -1
- package/build/dist/Types/Dashboard/Chart/ChartType.js +5 -0
- package/build/dist/Types/Dashboard/Chart/ChartType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponentType.js +4 -0
- package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardGaugeComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardLogStreamComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardTableComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardTableComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.js +2 -0
- package/build/dist/Types/Dashboard/DashboardComponents/DashboardTraceListComponent.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js +853 -0
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardVariable.js +7 -0
- package/build/dist/Types/Dashboard/DashboardVariable.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardViewConfig.js +50 -1
- package/build/dist/Types/Dashboard/DashboardViewConfig.js.map +1 -1
- package/build/dist/Types/Dashboard/MasterPassword.js +5 -0
- package/build/dist/Types/Dashboard/MasterPassword.js.map +1 -0
- package/build/dist/Types/Icon/IconProp.js +1 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/Incident/IncidentMetricType.js +3 -0
- package/build/dist/Types/Incident/IncidentMetricType.js.map +1 -1
- package/build/dist/Types/MeteredPlan/ProductType.js +1 -0
- package/build/dist/Types/MeteredPlan/ProductType.js.map +1 -1
- package/build/dist/Types/Metrics/MetricQueryConfigData.js +1 -0
- package/build/dist/Types/Metrics/MetricQueryConfigData.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +2 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +58 -7
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +15 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepProfileMonitor.js +59 -0
- package/build/dist/Types/Monitor/MonitorStepProfileMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorType.js +10 -0
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.js +2 -0
- package/build/dist/Types/Monitor/ProfileMonitor/ProfileMonitorResponse.js.map +1 -0
- package/build/dist/Types/Permission.js +75 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Telemetry/TelemetryType.js +1 -0
- package/build/dist/Types/Telemetry/TelemetryType.js.map +1 -1
- package/build/dist/Types/Workflow/Component.js +1 -0
- package/build/dist/Types/Workflow/Component.js.map +1 -1
- package/build/dist/Types/Workflow/Components/Condition.js +24 -0
- package/build/dist/Types/Workflow/Components/Condition.js.map +1 -1
- package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.js +1 -0
- package/build/dist/Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryItem.js.map +1 -1
- package/build/dist/UI/Components/Button/Button.js +1 -1
- package/build/dist/UI/Components/Button/Button.js.map +1 -1
- package/build/dist/UI/Components/Card/Card.js +4 -4
- package/build/dist/UI/Components/Card/Card.js.map +1 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +1 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +5 -2
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +5 -2
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +6 -3
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/ReferenceLineProps.js +2 -0
- package/build/dist/UI/Components/Charts/Types/ReferenceLineProps.js.map +1 -0
- package/build/dist/UI/Components/Icon/Icon.js +11 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +12 -9
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/MoreMenu/MoreMenu.js +8 -2
- package/build/dist/UI/Components/MoreMenu/MoreMenu.js.map +1 -1
- package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js +4 -4
- package/build/dist/UI/Components/MoreMenu/MoreMenuItem.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Component.js +311 -143
- package/build/dist/UI/Components/Workflow/Component.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentPortViewer.js +44 -18
- package/build/dist/UI/Components/Workflow/ComponentPortViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js +48 -22
- package/build/dist/UI/Components/Workflow/ComponentReturnValueViewer.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js +127 -21
- package/build/dist/UI/Components/Workflow/ComponentSettingsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentsModal.js +107 -52
- package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Utils.js +28 -1
- package/build/dist/UI/Components/Workflow/Utils.js.map +1 -1
- package/build/dist/UI/Components/Workflow/Workflow.js +87 -12
- package/build/dist/UI/Components/Workflow/Workflow.js.map +1 -1
- package/build/dist/UI/Config.js +3 -1
- package/build/dist/UI/Config.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardChartComponent.js +50 -21
- package/build/dist/Utils/Dashboard/Components/DashboardChartComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardGaugeComponent.js +104 -0
- package/build/dist/Utils/Dashboard/Components/DashboardGaugeComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardLogStreamComponent.js +91 -0
- package/build/dist/Utils/Dashboard/Components/DashboardLogStreamComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardTableComponent.js +70 -0
- package/build/dist/Utils/Dashboard/Components/DashboardTableComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardTextComponent.js +28 -7
- package/build/dist/Utils/Dashboard/Components/DashboardTextComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/DashboardTraceListComponent.js +70 -0
- package/build/dist/Utils/Dashboard/Components/DashboardTraceListComponent.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardValueComponent.js +34 -3
- package/build/dist/Utils/Dashboard/Components/DashboardValueComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/Components/Index.js +16 -0
- package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
- package/build/dist/Utils/ValueFormatter.js +132 -0
- package/build/dist/Utils/ValueFormatter.js.map +1 -0
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ import LogMonitorCriteria from "./Criteria/LogMonitorCriteria";
|
|
|
11
11
|
import MetricMonitorCriteria from "./Criteria/MetricMonitorCriteria";
|
|
12
12
|
import TraceMonitorCriteria from "./Criteria/TraceMonitorCriteria";
|
|
13
13
|
import ExceptionMonitorCriteria from "./Criteria/ExceptionMonitorCriteria";
|
|
14
|
+
import ProfileMonitorCriteria from "./Criteria/ProfileMonitorCriteria";
|
|
14
15
|
import SnmpMonitorCriteria from "./Criteria/SnmpMonitorCriteria";
|
|
15
16
|
import DnsMonitorCriteria from "./Criteria/DnsMonitorCriteria";
|
|
16
17
|
import DomainMonitorCriteria from "./Criteria/DomainMonitorCriteria";
|
|
@@ -43,6 +44,10 @@ import URL from "../../../Types/API/URL";
|
|
|
43
44
|
import IP from "../../../Types/IP/IP";
|
|
44
45
|
import Hostname from "../../../Types/API/Hostname";
|
|
45
46
|
import Port from "../../../Types/Port";
|
|
47
|
+
import MetricMonitorResponse, {
|
|
48
|
+
KubernetesAffectedResource,
|
|
49
|
+
KubernetesResourceBreakdown,
|
|
50
|
+
} from "../../../Types/Monitor/MetricMonitor/MetricMonitorResponse";
|
|
46
51
|
|
|
47
52
|
export default class MonitorCriteriaEvaluator {
|
|
48
53
|
public static async processMonitorStep(input: {
|
|
@@ -487,6 +492,18 @@ ${contextBlock}
|
|
|
487
492
|
}
|
|
488
493
|
}
|
|
489
494
|
|
|
495
|
+
if (input.monitor.monitorType === MonitorType.Profiles) {
|
|
496
|
+
const profileMonitorResult: string | null =
|
|
497
|
+
await ProfileMonitorCriteria.isMonitorInstanceCriteriaFilterMet({
|
|
498
|
+
dataToProcess: input.dataToProcess,
|
|
499
|
+
criteriaFilter: input.criteriaFilter,
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
if (profileMonitorResult) {
|
|
503
|
+
return profileMonitorResult;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
490
507
|
if (input.monitor.monitorType === MonitorType.SNMP) {
|
|
491
508
|
const snmpMonitorResult: string | null =
|
|
492
509
|
await SnmpMonitorCriteria.isMonitorInstanceCriteriaFilterMet({
|
|
@@ -545,6 +562,11 @@ ${contextBlock}
|
|
|
545
562
|
monitorStep: MonitorStep;
|
|
546
563
|
monitor: Monitor;
|
|
547
564
|
}): string | null {
|
|
565
|
+
// Handle Kubernetes monitors with rich resource context
|
|
566
|
+
if (input.monitor.monitorType === MonitorType.Kubernetes) {
|
|
567
|
+
return MonitorCriteriaEvaluator.buildKubernetesRootCauseContext(input);
|
|
568
|
+
}
|
|
569
|
+
|
|
548
570
|
const requestDetails: Array<string> = [];
|
|
549
571
|
const responseDetails: Array<string> = [];
|
|
550
572
|
const failureDetails: Array<string> = [];
|
|
@@ -653,6 +675,283 @@ ${contextBlock}
|
|
|
653
675
|
return sections.join("\n");
|
|
654
676
|
}
|
|
655
677
|
|
|
678
|
+
private static buildKubernetesRootCauseContext(input: {
|
|
679
|
+
dataToProcess: DataToProcess;
|
|
680
|
+
monitorStep: MonitorStep;
|
|
681
|
+
monitor: Monitor;
|
|
682
|
+
}): string | null {
|
|
683
|
+
const metricResponse: MetricMonitorResponse =
|
|
684
|
+
input.dataToProcess as MetricMonitorResponse;
|
|
685
|
+
|
|
686
|
+
const breakdown: KubernetesResourceBreakdown | undefined =
|
|
687
|
+
metricResponse.kubernetesResourceBreakdown;
|
|
688
|
+
|
|
689
|
+
if (!breakdown) {
|
|
690
|
+
return null;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
const sections: Array<string> = [];
|
|
694
|
+
|
|
695
|
+
// Cluster context
|
|
696
|
+
const clusterDetails: Array<string> = [];
|
|
697
|
+
clusterDetails.push(`- Cluster: ${breakdown.clusterName}`);
|
|
698
|
+
clusterDetails.push(
|
|
699
|
+
`- Metric: ${breakdown.metricFriendlyName} (\`${breakdown.metricName}\`)`,
|
|
700
|
+
);
|
|
701
|
+
|
|
702
|
+
if (breakdown.attributes["k8s.namespace.name"]) {
|
|
703
|
+
clusterDetails.push(
|
|
704
|
+
`- Namespace: ${breakdown.attributes["k8s.namespace.name"]}`,
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
sections.push(
|
|
709
|
+
`**Kubernetes Cluster Details**\n${clusterDetails.join("\n")}`,
|
|
710
|
+
);
|
|
711
|
+
|
|
712
|
+
// Affected resources
|
|
713
|
+
if (breakdown.affectedResources && breakdown.affectedResources.length > 0) {
|
|
714
|
+
const resourceLines: Array<string> = [];
|
|
715
|
+
|
|
716
|
+
// Sort by metric value descending (worst first)
|
|
717
|
+
const sortedResources: Array<KubernetesAffectedResource> = [
|
|
718
|
+
...breakdown.affectedResources,
|
|
719
|
+
].sort((a: KubernetesAffectedResource, b: KubernetesAffectedResource) => {
|
|
720
|
+
return b.metricValue - a.metricValue;
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// Show top 10 affected resources
|
|
724
|
+
const resourcesToShow: Array<KubernetesAffectedResource> =
|
|
725
|
+
sortedResources.slice(0, 10);
|
|
726
|
+
|
|
727
|
+
for (const resource of resourcesToShow) {
|
|
728
|
+
const details: Array<string> = [];
|
|
729
|
+
|
|
730
|
+
if (resource.namespace) {
|
|
731
|
+
details.push(`Namespace: \`${resource.namespace}\``);
|
|
732
|
+
}
|
|
733
|
+
if (resource.workloadType && resource.workloadName) {
|
|
734
|
+
details.push(
|
|
735
|
+
`${resource.workloadType}: \`${resource.workloadName}\``,
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
if (resource.podName) {
|
|
739
|
+
details.push(`Pod: \`${resource.podName}\``);
|
|
740
|
+
}
|
|
741
|
+
if (resource.containerName) {
|
|
742
|
+
details.push(`Container: \`${resource.containerName}\``);
|
|
743
|
+
}
|
|
744
|
+
if (resource.nodeName) {
|
|
745
|
+
details.push(`Node: \`${resource.nodeName}\``);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
details.push(`Value: **${resource.metricValue}**`);
|
|
749
|
+
|
|
750
|
+
resourceLines.push(`- ${details.join(" | ")}`);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
if (sortedResources.length > 10) {
|
|
754
|
+
resourceLines.push(
|
|
755
|
+
`- ... and ${sortedResources.length - 10} more affected resources`,
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
sections.push(
|
|
760
|
+
`\n\n**Affected Resources** (${sortedResources.length} total)\n${resourceLines.join("\n")}`,
|
|
761
|
+
);
|
|
762
|
+
|
|
763
|
+
// Add root cause analysis based on metric type
|
|
764
|
+
const analysis: string | null =
|
|
765
|
+
MonitorCriteriaEvaluator.buildKubernetesRootCauseAnalysis({
|
|
766
|
+
breakdown: breakdown,
|
|
767
|
+
topResource: resourcesToShow[0]!,
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
if (analysis) {
|
|
771
|
+
sections.push(`\n\n**Root Cause Analysis**\n${analysis}`);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
return sections.join("\n");
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
private static buildKubernetesRootCauseAnalysis(input: {
|
|
779
|
+
breakdown: KubernetesResourceBreakdown;
|
|
780
|
+
topResource: KubernetesAffectedResource;
|
|
781
|
+
}): string | null {
|
|
782
|
+
const { breakdown, topResource } = input;
|
|
783
|
+
const metricName: string = breakdown.metricName;
|
|
784
|
+
const lines: Array<string> = [];
|
|
785
|
+
|
|
786
|
+
if (
|
|
787
|
+
metricName === "k8s.container.restarts" ||
|
|
788
|
+
metricName.includes("restart")
|
|
789
|
+
) {
|
|
790
|
+
lines.push(
|
|
791
|
+
`Container restart count is elevated, indicating a potential CrashLoopBackOff condition.`,
|
|
792
|
+
);
|
|
793
|
+
if (topResource.containerName) {
|
|
794
|
+
lines.push(
|
|
795
|
+
`The container \`${topResource.containerName}\` in pod \`${topResource.podName || "unknown"}\` has restarted **${topResource.metricValue}** times.`,
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
lines.push(
|
|
799
|
+
`Common causes: application crash on startup, misconfigured environment variables, missing dependencies, OOM (Out of Memory) kills, failed health checks, or missing config maps/secrets.`,
|
|
800
|
+
);
|
|
801
|
+
lines.push(
|
|
802
|
+
`Recommended actions: Check container logs with \`kubectl logs ${topResource.podName || "<pod-name>"} -c ${topResource.containerName || "<container>"} --previous\` and inspect events with \`kubectl describe pod ${topResource.podName || "<pod-name>"}\`.`,
|
|
803
|
+
);
|
|
804
|
+
} else if (
|
|
805
|
+
metricName === "k8s.pod.phase" &&
|
|
806
|
+
breakdown.attributes["k8s.pod.phase"] === "Pending"
|
|
807
|
+
) {
|
|
808
|
+
lines.push(`Pods are stuck in Pending phase and unable to be scheduled.`);
|
|
809
|
+
lines.push(
|
|
810
|
+
`Common causes: insufficient CPU/memory resources on nodes, node affinity/taint restrictions preventing scheduling, PersistentVolumeClaim pending, or resource quota exceeded.`,
|
|
811
|
+
);
|
|
812
|
+
if (topResource.podName) {
|
|
813
|
+
lines.push(
|
|
814
|
+
`Recommended actions: Check scheduling events with \`kubectl describe pod ${topResource.podName}\` and verify node resources with \`kubectl describe nodes\`.`,
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
} else if (
|
|
818
|
+
metricName === "k8s.node.condition_ready" ||
|
|
819
|
+
(metricName.includes("node") && metricName.includes("condition"))
|
|
820
|
+
) {
|
|
821
|
+
lines.push(`One or more nodes have transitioned to a NotReady state.`);
|
|
822
|
+
if (topResource.nodeName) {
|
|
823
|
+
lines.push(
|
|
824
|
+
`Node \`${topResource.nodeName}\` is reporting NotReady (value: ${topResource.metricValue}).`,
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
lines.push(
|
|
828
|
+
`Common causes: kubelet process failure, node resource exhaustion (disk pressure, memory pressure, PID pressure), network connectivity issues, or underlying VM/hardware failure.`,
|
|
829
|
+
);
|
|
830
|
+
lines.push(
|
|
831
|
+
`Recommended actions: Check node conditions with \`kubectl describe node ${topResource.nodeName || "<node-name>"}\` and verify kubelet status on the node.`,
|
|
832
|
+
);
|
|
833
|
+
} else if (
|
|
834
|
+
metricName === "k8s.node.cpu.utilization" ||
|
|
835
|
+
(metricName.includes("cpu") && metricName.includes("utilization"))
|
|
836
|
+
) {
|
|
837
|
+
lines.push(`Node CPU utilization has exceeded the configured threshold.`);
|
|
838
|
+
if (topResource.nodeName) {
|
|
839
|
+
lines.push(
|
|
840
|
+
`Node \`${topResource.nodeName}\` is at **${topResource.metricValue.toFixed(1)}%** CPU utilization.`,
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
lines.push(
|
|
844
|
+
`Common causes: resource-intensive workloads, insufficient resource limits on pods, noisy neighbor pods consuming excessive CPU, or insufficient cluster capacity.`,
|
|
845
|
+
);
|
|
846
|
+
lines.push(
|
|
847
|
+
`Recommended actions: Identify top CPU consumers with \`kubectl top pods --all-namespaces --sort-by=cpu\` and consider scaling the cluster or adjusting pod resource limits.`,
|
|
848
|
+
);
|
|
849
|
+
} else if (
|
|
850
|
+
metricName === "k8s.node.memory.usage" ||
|
|
851
|
+
(metricName.includes("memory") && metricName.includes("usage"))
|
|
852
|
+
) {
|
|
853
|
+
lines.push(
|
|
854
|
+
`Node memory utilization has exceeded the configured threshold.`,
|
|
855
|
+
);
|
|
856
|
+
if (topResource.nodeName) {
|
|
857
|
+
lines.push(
|
|
858
|
+
`Node \`${topResource.nodeName}\` memory usage is at **${topResource.metricValue.toFixed(1)}%**.`,
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
lines.push(
|
|
862
|
+
`Common causes: memory leaks in applications, insufficient memory limits on pods, too many pods scheduled on the node, or growing dataset sizes.`,
|
|
863
|
+
);
|
|
864
|
+
lines.push(
|
|
865
|
+
`Recommended actions: Check memory consumers with \`kubectl top pods --all-namespaces --sort-by=memory\` and review pod memory limits. Consider scaling the cluster or adding nodes with more memory.`,
|
|
866
|
+
);
|
|
867
|
+
} else if (
|
|
868
|
+
metricName === "k8s.deployment.unavailable_replicas" ||
|
|
869
|
+
metricName.includes("unavailable")
|
|
870
|
+
) {
|
|
871
|
+
lines.push(
|
|
872
|
+
`Deployment has unavailable replicas, indicating a mismatch between desired and available replicas.`,
|
|
873
|
+
);
|
|
874
|
+
if (topResource.workloadName) {
|
|
875
|
+
lines.push(
|
|
876
|
+
`${topResource.workloadType || "Deployment"} \`${topResource.workloadName}\` has **${topResource.metricValue}** unavailable replica(s).`,
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
lines.push(
|
|
880
|
+
`Common causes: failed rolling update, image pull errors (wrong image tag or missing registry credentials), pod crash loops, insufficient cluster resources to schedule new pods, or PodDisruptionBudget blocking updates.`,
|
|
881
|
+
);
|
|
882
|
+
lines.push(
|
|
883
|
+
`Recommended actions: Check deployment rollout status with \`kubectl rollout status deployment/${topResource.workloadName || "<deployment>"}\` and inspect pod events.`,
|
|
884
|
+
);
|
|
885
|
+
} else if (
|
|
886
|
+
metricName === "k8s.job.failed_pods" ||
|
|
887
|
+
(metricName.includes("job") && metricName.includes("fail"))
|
|
888
|
+
) {
|
|
889
|
+
lines.push(`Kubernetes Job has failed pods.`);
|
|
890
|
+
if (topResource.workloadName) {
|
|
891
|
+
lines.push(
|
|
892
|
+
`Job \`${topResource.workloadName}\` has **${topResource.metricValue}** failed pod(s).`,
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
lines.push(
|
|
896
|
+
`Common causes: application error or non-zero exit code, resource limits exceeded (OOMKilled), misconfigured command or arguments, missing environment variables, or timeout exceeded.`,
|
|
897
|
+
);
|
|
898
|
+
lines.push(
|
|
899
|
+
`Recommended actions: Check job status with \`kubectl describe job ${topResource.workloadName || "<job-name>"}\` and review pod logs for the failed pod(s).`,
|
|
900
|
+
);
|
|
901
|
+
} else if (
|
|
902
|
+
metricName === "k8s.node.filesystem.usage" ||
|
|
903
|
+
metricName.includes("disk") ||
|
|
904
|
+
metricName.includes("filesystem")
|
|
905
|
+
) {
|
|
906
|
+
lines.push(
|
|
907
|
+
`Node disk/filesystem usage has exceeded the configured threshold.`,
|
|
908
|
+
);
|
|
909
|
+
if (topResource.nodeName) {
|
|
910
|
+
lines.push(
|
|
911
|
+
`Node \`${topResource.nodeName}\` filesystem usage is at **${topResource.metricValue.toFixed(1)}%**.`,
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
lines.push(
|
|
915
|
+
`Common causes: container image layers consuming disk space, excessive logging, large emptyDir volumes, or accumulation of unused container images.`,
|
|
916
|
+
);
|
|
917
|
+
lines.push(
|
|
918
|
+
`Recommended actions: Clean up unused images with \`docker system prune\` or \`crictl rmi --prune\`, check for large log files, and review PersistentVolumeClaim usage.`,
|
|
919
|
+
);
|
|
920
|
+
} else if (
|
|
921
|
+
metricName === "k8s.daemonset.misscheduled_nodes" ||
|
|
922
|
+
metricName.includes("daemonset")
|
|
923
|
+
) {
|
|
924
|
+
lines.push(`DaemonSet has misscheduled or unavailable nodes.`);
|
|
925
|
+
if (topResource.workloadName) {
|
|
926
|
+
lines.push(
|
|
927
|
+
`DaemonSet \`${topResource.workloadName}\` has **${topResource.metricValue}** misscheduled node(s).`,
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
lines.push(
|
|
931
|
+
`Common causes: node taints preventing scheduling, incorrect node selectors, or node affinity rules excluding certain nodes.`,
|
|
932
|
+
);
|
|
933
|
+
lines.push(
|
|
934
|
+
`Recommended actions: Check DaemonSet status with \`kubectl describe daemonset ${topResource.workloadName || "<daemonset>"}\` and verify node labels and taints.`,
|
|
935
|
+
);
|
|
936
|
+
} else {
|
|
937
|
+
// Generic Kubernetes context
|
|
938
|
+
lines.push(
|
|
939
|
+
`Kubernetes metric \`${metricName}\` (${breakdown.metricFriendlyName}) has breached the configured threshold.`,
|
|
940
|
+
);
|
|
941
|
+
if (topResource.podName) {
|
|
942
|
+
lines.push(`Most affected pod: \`${topResource.podName}\``);
|
|
943
|
+
}
|
|
944
|
+
if (topResource.nodeName) {
|
|
945
|
+
lines.push(`Most affected node: \`${topResource.nodeName}\``);
|
|
946
|
+
}
|
|
947
|
+
lines.push(
|
|
948
|
+
`Recommended actions: Investigate the affected resources using \`kubectl describe\` and \`kubectl logs\` commands.`,
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
return lines.join("\n");
|
|
953
|
+
}
|
|
954
|
+
|
|
656
955
|
private static getMonitorDestinationString(input: {
|
|
657
956
|
monitorStep: MonitorStep;
|
|
658
957
|
probeResponse: ProbeMonitorResponse | null;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { JSONObject } from "../../../Types/JSON";
|
|
2
|
+
import zlib from "zlib";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Encodes profile data into a simplified pprof-compatible JSON format.
|
|
6
|
+
* This produces a gzipped JSON representation that captures the essential
|
|
7
|
+
* profile information (stacktraces, values, metadata) in a format that
|
|
8
|
+
* can be consumed by tools that support pprof JSON.
|
|
9
|
+
*
|
|
10
|
+
* For full protobuf pprof support, a protobuf serializer (e.g., protobufjs
|
|
11
|
+
* with the pprof proto) would be needed. This implementation provides a
|
|
12
|
+
* practical export format.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export interface PprofSample {
|
|
16
|
+
stacktrace: Array<string>;
|
|
17
|
+
value: number;
|
|
18
|
+
labels: JSONObject | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface PprofProfile {
|
|
22
|
+
profileId: string;
|
|
23
|
+
profileType: string;
|
|
24
|
+
unit: string;
|
|
25
|
+
periodType: string;
|
|
26
|
+
period: number;
|
|
27
|
+
startTimeNanos: number;
|
|
28
|
+
endTimeNanos: number;
|
|
29
|
+
durationNanos: number;
|
|
30
|
+
samples: Array<PprofSample>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PprofFunction {
|
|
34
|
+
id: number;
|
|
35
|
+
name: number; // string table index
|
|
36
|
+
filename: number; // string table index
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface PprofLocation {
|
|
40
|
+
id: number;
|
|
41
|
+
line: Array<{
|
|
42
|
+
functionId: number;
|
|
43
|
+
line: number;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface PprofProto {
|
|
48
|
+
stringTable: Array<string>;
|
|
49
|
+
functions: Array<PprofFunction>;
|
|
50
|
+
locations: Array<PprofLocation>;
|
|
51
|
+
samples: Array<{
|
|
52
|
+
locationId: Array<number>;
|
|
53
|
+
value: Array<number>;
|
|
54
|
+
label: Array<{ key: number; str: number }>;
|
|
55
|
+
}>;
|
|
56
|
+
sampleType: Array<{ type: number; unit: number }>;
|
|
57
|
+
periodType: { type: number; unit: number };
|
|
58
|
+
period: number;
|
|
59
|
+
timeNanos: number;
|
|
60
|
+
durationNanos: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default class PprofEncoder {
|
|
64
|
+
/**
|
|
65
|
+
* Build a pprof-like JSON structure from denormalized profile data.
|
|
66
|
+
* The output is a JSON object that mirrors the pprof proto structure,
|
|
67
|
+
* using string table indirection for compact representation.
|
|
68
|
+
*/
|
|
69
|
+
public static encode(profile: PprofProfile): PprofProto {
|
|
70
|
+
const stringTable: Array<string> = [""];
|
|
71
|
+
const stringIndex: Map<string, number> = new Map([["", 0]]);
|
|
72
|
+
|
|
73
|
+
const getStringIndex: (s: string) => number = (s: string): number => {
|
|
74
|
+
const existing: number | undefined = stringIndex.get(s);
|
|
75
|
+
if (existing !== undefined) {
|
|
76
|
+
return existing;
|
|
77
|
+
}
|
|
78
|
+
const idx: number = stringTable.length;
|
|
79
|
+
stringTable.push(s);
|
|
80
|
+
stringIndex.set(s, idx);
|
|
81
|
+
return idx;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const functions: Array<PprofFunction> = [];
|
|
85
|
+
const functionIndex: Map<string, number> = new Map();
|
|
86
|
+
const locations: Array<PprofLocation> = [];
|
|
87
|
+
const locationIndex: Map<string, number> = new Map();
|
|
88
|
+
|
|
89
|
+
const getOrCreateFunction: (name: string, fileName: string) => number = (
|
|
90
|
+
name: string,
|
|
91
|
+
fileName: string,
|
|
92
|
+
): number => {
|
|
93
|
+
const key: string = `${name}@${fileName}`;
|
|
94
|
+
const existing: number | undefined = functionIndex.get(key);
|
|
95
|
+
if (existing !== undefined) {
|
|
96
|
+
return existing;
|
|
97
|
+
}
|
|
98
|
+
const id: number = functions.length + 1;
|
|
99
|
+
functions.push({
|
|
100
|
+
id,
|
|
101
|
+
name: getStringIndex(name),
|
|
102
|
+
filename: getStringIndex(fileName),
|
|
103
|
+
});
|
|
104
|
+
functionIndex.set(key, id);
|
|
105
|
+
return id;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const getOrCreateLocation: (
|
|
109
|
+
functionName: string,
|
|
110
|
+
fileName: string,
|
|
111
|
+
lineNumber: number,
|
|
112
|
+
) => number = (
|
|
113
|
+
functionName: string,
|
|
114
|
+
fileName: string,
|
|
115
|
+
lineNumber: number,
|
|
116
|
+
): number => {
|
|
117
|
+
const key: string = `${functionName}@${fileName}:${lineNumber}`;
|
|
118
|
+
const existing: number | undefined = locationIndex.get(key);
|
|
119
|
+
if (existing !== undefined) {
|
|
120
|
+
return existing;
|
|
121
|
+
}
|
|
122
|
+
const funcId: number = getOrCreateFunction(functionName, fileName);
|
|
123
|
+
const id: number = locations.length + 1;
|
|
124
|
+
locations.push({
|
|
125
|
+
id,
|
|
126
|
+
line: [{ functionId: funcId, line: lineNumber }],
|
|
127
|
+
});
|
|
128
|
+
locationIndex.set(key, id);
|
|
129
|
+
return id;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Build samples
|
|
133
|
+
const pprofSamples: Array<{
|
|
134
|
+
locationId: Array<number>;
|
|
135
|
+
value: Array<number>;
|
|
136
|
+
label: Array<{ key: number; str: number }>;
|
|
137
|
+
}> = [];
|
|
138
|
+
|
|
139
|
+
for (const sample of profile.samples) {
|
|
140
|
+
const locationIds: Array<number> = [];
|
|
141
|
+
|
|
142
|
+
// Parse each frame in the stacktrace
|
|
143
|
+
for (const frame of sample.stacktrace) {
|
|
144
|
+
const atIndex: number = frame.indexOf("@");
|
|
145
|
+
let functionName: string = frame;
|
|
146
|
+
let fileName: string = "";
|
|
147
|
+
let lineNumber: number = 0;
|
|
148
|
+
|
|
149
|
+
if (atIndex !== -1) {
|
|
150
|
+
functionName = frame.substring(0, atIndex);
|
|
151
|
+
const rest: string = frame.substring(atIndex + 1);
|
|
152
|
+
const lastColon: number = rest.lastIndexOf(":");
|
|
153
|
+
if (lastColon !== -1) {
|
|
154
|
+
fileName = rest.substring(0, lastColon);
|
|
155
|
+
lineNumber = parseInt(rest.substring(lastColon + 1), 10) || 0;
|
|
156
|
+
} else {
|
|
157
|
+
fileName = rest;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
locationIds.push(
|
|
162
|
+
getOrCreateLocation(functionName, fileName, lineNumber),
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Build labels
|
|
167
|
+
const labels: Array<{ key: number; str: number }> = [];
|
|
168
|
+
if (sample.labels) {
|
|
169
|
+
for (const [key, value] of Object.entries(sample.labels)) {
|
|
170
|
+
labels.push({
|
|
171
|
+
key: getStringIndex(key),
|
|
172
|
+
str: getStringIndex(String(value)),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
pprofSamples.push({
|
|
178
|
+
locationId: locationIds,
|
|
179
|
+
value: [sample.value],
|
|
180
|
+
label: labels,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Build sample type
|
|
185
|
+
const typeIdx: number = getStringIndex(profile.profileType);
|
|
186
|
+
const unitIdx: number = getStringIndex(profile.unit || "count");
|
|
187
|
+
const periodTypeIdx: number = getStringIndex(
|
|
188
|
+
profile.periodType || profile.profileType,
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
stringTable,
|
|
193
|
+
functions,
|
|
194
|
+
locations,
|
|
195
|
+
samples: pprofSamples,
|
|
196
|
+
sampleType: [{ type: typeIdx, unit: unitIdx }],
|
|
197
|
+
periodType: { type: periodTypeIdx, unit: unitIdx },
|
|
198
|
+
period: profile.period,
|
|
199
|
+
timeNanos: profile.startTimeNanos,
|
|
200
|
+
durationNanos: profile.durationNanos,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Encode and gzip the pprof JSON for download.
|
|
206
|
+
*/
|
|
207
|
+
public static async encodeAndCompress(
|
|
208
|
+
profile: PprofProfile,
|
|
209
|
+
): Promise<Buffer> {
|
|
210
|
+
const pprofData: PprofProto = PprofEncoder.encode(profile);
|
|
211
|
+
const jsonString: string = JSON.stringify(pprofData);
|
|
212
|
+
|
|
213
|
+
return new Promise<Buffer>(
|
|
214
|
+
(resolve: (value: Buffer) => void, reject: (reason: Error) => void) => {
|
|
215
|
+
zlib.gzip(jsonString, (err: Error | null, result: Buffer) => {
|
|
216
|
+
if (err) {
|
|
217
|
+
reject(err);
|
|
218
|
+
} else {
|
|
219
|
+
resolve(result);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -1023,12 +1023,43 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
|
|
|
1023
1023
|
logger.debug("Sending message to Microsoft Teams with data:");
|
|
1024
1024
|
logger.debug(data);
|
|
1025
1025
|
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1026
|
+
/*
|
|
1027
|
+
* Teams adaptive cards have a ~28KB payload limit.
|
|
1028
|
+
* Split message blocks into chunks of 40 to avoid hitting the limit.
|
|
1029
|
+
*/
|
|
1030
|
+
const maxBlocksPerCard: number = 40;
|
|
1031
|
+
const allMessageBlocks: Array<WorkspaceMessageBlock> =
|
|
1032
|
+
data.workspaceMessagePayload.messageBlocks;
|
|
1029
1033
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1034
|
+
const adaptiveCards: Array<JSONObject> = [];
|
|
1035
|
+
|
|
1036
|
+
if (allMessageBlocks.length <= maxBlocksPerCard) {
|
|
1037
|
+
adaptiveCards.push(
|
|
1038
|
+
this.buildAdaptiveCardFromMessageBlocks({
|
|
1039
|
+
messageBlocks: allMessageBlocks,
|
|
1040
|
+
}),
|
|
1041
|
+
);
|
|
1042
|
+
} else {
|
|
1043
|
+
for (
|
|
1044
|
+
let i: number = 0;
|
|
1045
|
+
i < allMessageBlocks.length;
|
|
1046
|
+
i += maxBlocksPerCard
|
|
1047
|
+
) {
|
|
1048
|
+
const chunk: Array<WorkspaceMessageBlock> = allMessageBlocks.slice(
|
|
1049
|
+
i,
|
|
1050
|
+
i + maxBlocksPerCard,
|
|
1051
|
+
);
|
|
1052
|
+
adaptiveCards.push(
|
|
1053
|
+
this.buildAdaptiveCardFromMessageBlocks({
|
|
1054
|
+
messageBlocks: chunk,
|
|
1055
|
+
}),
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
logger.debug(
|
|
1061
|
+
`Built ${adaptiveCards.length} adaptive card(s) from ${allMessageBlocks.length} message blocks`,
|
|
1062
|
+
);
|
|
1032
1063
|
|
|
1033
1064
|
const workspaceChannelsToPostTo: Array<WorkspaceChannel> = [];
|
|
1034
1065
|
|
|
@@ -1122,18 +1153,24 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
|
|
|
1122
1153
|
);
|
|
1123
1154
|
}
|
|
1124
1155
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1156
|
+
// Send each adaptive card chunk to the channel
|
|
1157
|
+
let lastThread: WorkspaceThread | undefined;
|
|
1158
|
+
for (const adaptiveCard of adaptiveCards) {
|
|
1159
|
+
lastThread = await this.sendAdaptiveCardToChannel({
|
|
1160
|
+
authToken: data.authToken,
|
|
1161
|
+
teamId: data.workspaceMessagePayload.teamId!,
|
|
1162
|
+
workspaceChannel: channel,
|
|
1163
|
+
adaptiveCard: adaptiveCard,
|
|
1164
|
+
projectId: data.projectId,
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1132
1167
|
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1168
|
+
if (lastThread) {
|
|
1169
|
+
logger.debug(
|
|
1170
|
+
`Message sent successfully to channel ${channel.name}, thread: ${JSON.stringify(lastThread)}`,
|
|
1171
|
+
);
|
|
1172
|
+
workspaceMessageResponse.threads.push(lastThread);
|
|
1173
|
+
}
|
|
1137
1174
|
} catch (e) {
|
|
1138
1175
|
logger.error(`Error sending message to channel ID ${channel.id}:`);
|
|
1139
1176
|
logger.error(e);
|
|
@@ -1129,13 +1129,33 @@ export default class SlackUtil extends WorkspaceBase {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
blocks: blocks,
|
|
1136
|
-
});
|
|
1132
|
+
// Slack has a limit of 50 blocks per message. Split into batches if needed.
|
|
1133
|
+
const maxBlocksPerMessage: number = 50;
|
|
1134
|
+
let lastThread: WorkspaceThread | undefined;
|
|
1137
1135
|
|
|
1138
|
-
|
|
1136
|
+
if (blocks.length <= maxBlocksPerMessage) {
|
|
1137
|
+
lastThread = await this.sendPayloadBlocksToChannel({
|
|
1138
|
+
authToken: data.authToken,
|
|
1139
|
+
workspaceChannel: channel,
|
|
1140
|
+
blocks: blocks,
|
|
1141
|
+
});
|
|
1142
|
+
} else {
|
|
1143
|
+
for (let i: number = 0; i < blocks.length; i += maxBlocksPerMessage) {
|
|
1144
|
+
const chunk: Array<JSONObject> = blocks.slice(
|
|
1145
|
+
i,
|
|
1146
|
+
i + maxBlocksPerMessage,
|
|
1147
|
+
);
|
|
1148
|
+
lastThread = await this.sendPayloadBlocksToChannel({
|
|
1149
|
+
authToken: data.authToken,
|
|
1150
|
+
workspaceChannel: channel,
|
|
1151
|
+
blocks: chunk,
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
if (lastThread) {
|
|
1157
|
+
workspaspaceMessageResponse.threads.push(lastThread);
|
|
1158
|
+
}
|
|
1139
1159
|
|
|
1140
1160
|
logger.debug(`Message sent to channel ID ${channel.id} successfully.`);
|
|
1141
1161
|
} catch (e) {
|
package/ServiceRoute.ts
CHANGED
|
@@ -35,3 +35,5 @@ export const RealtimeRoute: Route = new Route("/realtime/socket");
|
|
|
35
35
|
export const DocsRoute: Route = new Route("/docs");
|
|
36
36
|
|
|
37
37
|
export const StatusPageApiRoute: Route = new Route("/status-page-api");
|
|
38
|
+
|
|
39
|
+
export const PublicDashboardRoute: Route = new Route("/public-dashboard");
|