@oneuptime/common 14.0.2 → 14.0.5
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/DatabaseModels/Alert.ts +55 -0
- package/Models/DatabaseModels/AlertFeed.ts +2 -0
- package/Models/DatabaseModels/DatabaseServer.ts +1650 -0
- package/Models/DatabaseModels/DatabaseServerEndpoint.ts +540 -0
- package/Models/DatabaseModels/DatabaseServerFeed.ts +625 -0
- package/Models/DatabaseModels/DatabaseServerLabelRule.ts +514 -0
- package/Models/DatabaseModels/DatabaseServerOwnerRule.ts +596 -0
- package/Models/DatabaseModels/DatabaseServerOwnerTeam.ts +491 -0
- package/Models/DatabaseModels/DatabaseServerOwnerUser.ts +490 -0
- package/Models/DatabaseModels/Incident.ts +55 -0
- package/Models/DatabaseModels/IncidentAlert.ts +540 -0
- package/Models/DatabaseModels/IncidentFeed.ts +2 -0
- package/Models/DatabaseModels/Index.ts +18 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +26 -0
- package/Models/DatabaseModels/Project.ts +60 -0
- package/Models/DatabaseModels/RumApplication.ts +52 -1
- package/Models/DatabaseModels/ScheduledMaintenance.ts +55 -0
- package/Models/DatabaseModels/TelemetryException.ts +2 -0
- package/Models/DatabaseModels/UserProjectSsoConsent.ts +146 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1794800000000-AddSessionReplaySameOriginTracePropagation.ts +28 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1794900000000-AddIncidentAlert.ts +89 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795000000000-AddDatabaseServerTables.ts +673 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1795100000000-AddUserProjectSsoConsent.ts +51 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Middleware/MultipartFormData.ts +1 -1
- package/Server/Middleware/TelemetryIngest.ts +15 -8
- package/Server/Services/AlertReminderRuleService.ts +100 -24
- package/Server/Services/DatabaseServerEndpointService.ts +895 -0
- package/Server/Services/DatabaseServerFeedService.ts +128 -0
- package/Server/Services/DatabaseServerLabelRuleEngineService.ts +340 -0
- package/Server/Services/DatabaseServerLabelRuleService.ts +14 -0
- package/Server/Services/DatabaseServerOwnerRuleEngineService.ts +425 -0
- package/Server/Services/DatabaseServerOwnerRuleService.ts +14 -0
- package/Server/Services/DatabaseServerOwnerTeamService.ts +180 -0
- package/Server/Services/DatabaseServerOwnerUserService.ts +173 -0
- package/Server/Services/DatabaseServerService.ts +4546 -0
- package/Server/Services/DatabaseService.ts +14 -8
- package/Server/Services/DockerResourceService.ts +43 -2
- package/Server/Services/IncidentAlertService.ts +1811 -0
- package/Server/Services/IncidentReminderRuleService.ts +103 -23
- package/Server/Services/IncidentService.ts +210 -10
- package/Server/Services/IncidentStateTimelineService.ts +24 -0
- package/Server/Services/Index.ts +18 -0
- package/Server/Services/InventoryItemService.ts +113 -5
- package/Server/Services/IoTDeviceService.ts +145 -37
- package/Server/Services/OpenTelemetryIngestService.ts +19 -0
- package/Server/Services/PodmanResourceService.ts +43 -2
- package/Server/Services/ScheduledMaintenanceReminderRuleService.ts +107 -23
- package/Server/Services/ServiceService.ts +1 -1
- package/Server/Services/TelemetryUsageBillingService.ts +29 -2
- package/Server/Services/UserProjectSsoConsentService.ts +74 -0
- package/Server/Services/UserService.ts +14 -1
- package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +18 -0
- package/Server/Types/Database/QueryHelper.ts +30 -1
- package/Server/Utils/AI/Toolbox/ResourceTools.ts +69 -1
- package/Server/Utils/Database/AffectedResourceRelations.ts +6 -0
- package/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.ts +188 -6
- package/Server/Utils/Monitor/MonitorAlert.ts +28 -1
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +2262 -755
- package/Server/Utils/Monitor/MonitorIncident.ts +28 -1
- package/Server/Utils/Monitor/MonitorMaintenanceSuppression.ts +268 -6
- package/Server/Utils/Monitor/MonitorResource.ts +47 -11
- package/Server/Utils/Monitor/MonitorResourceContext.ts +1 -0
- package/Server/Utils/Monitor/MonitorStepResourceIdentity.ts +239 -21
- package/Server/Utils/Monitor/PerSeriesResolutionRootCause.ts +43 -0
- package/Server/Utils/Monitor/SeriesResourceLabels.ts +291 -0
- package/Server/Utils/Monitor/SeriesResourceLinker.ts +111 -12
- package/Server/Utils/Rules/RuleRun/RuleRunRegistry.ts +25 -0
- package/Server/Utils/SessionReplay/SessionReplayGateCache.ts +24 -2
- package/Server/Utils/StartServer.ts +26 -6
- package/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.ts +2 -0
- package/Server/Utils/Telemetry/DatabaseEndpointDiscovery.ts +688 -0
- package/Server/Utils/Telemetry/EntityRegistry.ts +5 -1
- package/Server/Utils/Telemetry/LogExceptionExtractor.ts +18 -1
- package/Server/Utils/Telemetry/ResourceEntityFilter.ts +175 -12
- package/Server/Utils/Telemetry/ResourceFacetResolver.ts +12 -0
- package/Server/Utils/Telemetry/ServiceDependencyDiscovery.ts +606 -36
- package/Server/Utils/Telemetry/Telemetry.ts +16 -0
- package/Server/Utils/Telemetry/TelemetryEntity.ts +22 -22
- package/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.ts +16 -10
- package/Tests/App/Accounts/SignedInRedirect.test.tsx +241 -0
- package/Tests/App/AdminDashboard/AdminHeaderSmallScreens.test.tsx +221 -4
- package/Tests/App/Dashboard/AIInsightsResourcePageContext.test.ts +42 -0
- package/Tests/App/Dashboard/AffectedResourcesDisplay.test.tsx +100 -0
- package/Tests/App/Dashboard/AffectedResourcesPicker.test.tsx +86 -0
- package/Tests/App/Dashboard/AffectedResourcesPickerHiddenTypes.test.tsx +2 -0
- package/Tests/App/Dashboard/AffectedResourcesSummaryStep.test.tsx +19 -0
- package/Tests/App/Dashboard/BreadcrumbCoverage.test.tsx +14 -0
- package/Tests/App/Dashboard/BulkIncidentLinkActions.test.tsx +869 -0
- package/Tests/App/Dashboard/CephMetricTooltips.test.tsx +1777 -0
- package/Tests/App/Dashboard/CloudFleetSummary.test.ts +8 -0
- package/Tests/App/Dashboard/CloudMetricTooltips.test.tsx +887 -0
- package/Tests/App/Dashboard/ContainerHostMetricTooltips.test.tsx +1309 -0
- package/Tests/App/Dashboard/CorrelateFilterBuilder.test.tsx +26 -1
- package/Tests/App/Dashboard/DashboardAppSsoError.test.tsx +501 -0
- package/Tests/App/Dashboard/DashboardHeaderRequests.test.tsx +64 -1
- package/Tests/App/Dashboard/DashboardHeaderSmallScreens.test.tsx +178 -18
- package/Tests/App/Dashboard/DashboardMasterPageSsoRedirect.test.tsx +444 -0
- package/Tests/App/Dashboard/DashboardNavBarForeignHiddenRule.test.tsx +573 -0
- package/Tests/App/Dashboard/DatabaseChartAxes.test.tsx +431 -0
- package/Tests/App/Dashboard/DatabaseContainerDetailBadge.test.tsx +249 -0
- package/Tests/App/Dashboard/DatabaseDashboardE2EFixes.test.ts +681 -0
- package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +1801 -0
- package/Tests/App/Dashboard/DatabaseFleetSummaryRefresh.test.tsx +280 -0
- package/Tests/App/Dashboard/DatabaseFormHelpers.test.tsx +321 -0
- package/Tests/App/Dashboard/DatabaseMetricMonitorLink.test.tsx +795 -0
- package/Tests/App/Dashboard/DatabaseOverviewHeader.test.tsx +580 -0
- package/Tests/App/Dashboard/DatabaseRecommendationsEngineMetrics.test.ts +270 -0
- package/Tests/App/Dashboard/DatabaseServerComponents.test.tsx +1486 -0
- package/Tests/App/Dashboard/DatabaseServerEngineMetricsFilter.test.ts +223 -0
- package/Tests/App/Dashboard/DatabaseServerPresentation.test.ts +435 -0
- package/Tests/App/Dashboard/DatabaseServerSummary.test.ts +186 -0
- package/Tests/App/Dashboard/DatabaseServerTelemetryQueries.test.ts +1553 -0
- package/Tests/App/Dashboard/DatabaseTableTruncation.test.tsx +326 -0
- package/Tests/App/Dashboard/DatabaseTelemetryScope.test.ts +512 -0
- package/Tests/App/Dashboard/DatabaseTelemetryTabs.test.tsx +774 -0
- package/Tests/App/Dashboard/DatabaseViewLayout.test.tsx +233 -0
- package/Tests/App/Dashboard/DatabaseWorkloadBadge.test.tsx +972 -0
- package/Tests/App/Dashboard/DiscoveryReviewInventoryRefresh.test.tsx +5 -0
- package/Tests/App/Dashboard/DiscoveryReviewUnnamedHostHint.test.tsx +1061 -0
- package/Tests/App/Dashboard/DiscoveryScanLivePage.test.tsx +39 -0
- package/Tests/App/Dashboard/DockerSwarmClustersListTooltips.test.tsx +414 -0
- package/Tests/App/Dashboard/DockerSwarmMetricTooltips.test.ts +796 -0
- package/Tests/App/Dashboard/DockerSwarmOverviewTooltips.test.tsx +747 -0
- package/Tests/App/Dashboard/EventOverlayScope.test.ts +147 -0
- package/Tests/App/Dashboard/EventOverlayScopeHook.test.tsx +1 -0
- package/Tests/App/Dashboard/ExceptionMonitorEnvironmentFilter.test.tsx +38 -18
- package/Tests/App/Dashboard/HostDetailViewTooltips.test.tsx +725 -0
- package/Tests/App/Dashboard/HostListColumnTooltips.test.tsx +472 -0
- package/Tests/App/Dashboard/HostMetricTooltips.test.ts +709 -0
- package/Tests/App/Dashboard/HostOverviewTooltips.test.tsx +698 -0
- package/Tests/App/Dashboard/HostTooltipHarness.ts +124 -0
- package/Tests/App/Dashboard/HostsListTooltips.test.tsx +395 -0
- package/Tests/App/Dashboard/IncidentAlertLinkDialog.test.tsx +691 -0
- package/Tests/App/Dashboard/IncidentAlertLinkHelpers.test.ts +458 -0
- package/Tests/App/Dashboard/IncidentAlertLinkPages.test.tsx +828 -0
- package/Tests/App/Dashboard/IncidentAlertLinkSideMenus.test.tsx +231 -0
- package/Tests/App/Dashboard/IncidentCreateFromAlerts.test.tsx +689 -0
- package/Tests/App/Dashboard/IoTMetricTooltips.test.tsx +1123 -0
- package/Tests/App/Dashboard/KubernetesClusterMetricTooltips.test.ts +837 -0
- package/Tests/App/Dashboard/KubernetesClusterOverviewTooltips.test.tsx +699 -0
- package/Tests/App/Dashboard/KubernetesContainersTabTooltips.test.tsx +320 -0
- package/Tests/App/Dashboard/KubernetesCostTooltips.test.tsx +502 -0
- package/Tests/App/Dashboard/KubernetesInsightsTooltips.test.tsx +222 -0
- package/Tests/App/Dashboard/KubernetesResourceMetricTooltips.test.ts +561 -0
- package/Tests/App/Dashboard/KubernetesResourcePagesTooltips.test.tsx +1168 -0
- package/Tests/App/Dashboard/LinkIncidentAlertModal.test.tsx +154 -0
- package/Tests/App/Dashboard/LogsResourceFacetChips.test.tsx +1 -0
- package/Tests/App/Dashboard/MetricDescriptionRules.ts +170 -0
- package/Tests/App/Dashboard/MetricDescriptionsCatalog.test.ts +206 -0
- package/Tests/App/Dashboard/MetricDescriptionsConsistency.test.ts +275 -0
- package/Tests/App/Dashboard/MetricsViewerDrillDown.test.tsx +310 -0
- package/Tests/App/Dashboard/MetricsViewerEntityScopedRows.test.tsx +495 -0
- package/Tests/App/Dashboard/MonitorCreateFromMonitorBackedDevice.test.tsx +132 -1
- package/Tests/App/Dashboard/NavigationSearchKeywords.test.tsx +5 -0
- package/Tests/App/Dashboard/NetworkDeviceTooltips.test.tsx +852 -0
- package/Tests/App/Dashboard/NetworkDiagnosticsTooltips.test.tsx +556 -0
- package/Tests/App/Dashboard/NetworkMetricTooltips.test.ts +1348 -0
- package/Tests/App/Dashboard/NetworkSiteTooltips.test.tsx +679 -0
- package/Tests/App/Dashboard/ProductOrientation.test.tsx +4 -3
- package/Tests/App/Dashboard/ProxmoxMetricTooltips.test.ts +592 -0
- package/Tests/App/Dashboard/ProxmoxOverviewTooltips.test.tsx +1002 -0
- package/Tests/App/Dashboard/ProxmoxResourcePageTooltips.test.tsx +923 -0
- package/Tests/App/Dashboard/RecommendationsLoadedContext.test.tsx +349 -0
- package/Tests/App/Dashboard/ResourceArchiveSettings.test.tsx +62 -0
- package/Tests/App/Dashboard/ResourceFeedPageWiring.test.ts +8 -1
- package/Tests/App/Dashboard/ResourceFeedPagesFilterSort.test.tsx +14 -0
- package/Tests/App/Dashboard/ResourceOverviewTileTooltips.test.tsx +1066 -0
- package/Tests/App/Dashboard/RumOverviewPage.test.tsx +1195 -0
- package/Tests/App/Dashboard/ScheduledMaintenanceOverviewPage.test.tsx +2 -0
- package/Tests/App/Dashboard/ServerlessMetricTooltips.test.tsx +474 -0
- package/Tests/App/Dashboard/ServiceMapDatabaseLink.test.tsx +1085 -0
- package/Tests/App/Dashboard/ServiceMetricTooltips.test.tsx +772 -0
- package/Tests/App/Dashboard/SessionReplayAuditTable.test.tsx +56 -1
- package/Tests/App/Dashboard/TelemetryMetricsSignals.test.ts +1207 -0
- package/Tests/App/Dashboard/TelemetryResourceRetentionSettings.test.tsx +10 -0
- package/Tests/App/Dashboard/TelemetryResourceTabTooltips.test.tsx +437 -0
- package/Tests/App/Dashboard/TracesResourceFacets.test.tsx +2 -1
- package/Tests/App/Dashboard/VMwareMetricTooltips.test.ts +801 -0
- package/Tests/App/Dashboard/VMwareOverviewTooltips.test.tsx +601 -0
- package/Tests/App/Dashboard/VMwareResourcePagesTooltips.test.tsx +646 -0
- package/Tests/App/Dashboard/VMwareTooltipHarness.ts +145 -0
- package/Tests/App/StatusPage/StatusPageHeaderForeignHiddenRule.test.tsx +284 -0
- package/Tests/ClassStrings.ts +178 -0
- package/Tests/Fixtures/MobilePasskeyUser.json +1 -2
- package/Tests/ForeignHiddenRuleGuard.ts +2152 -0
- package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +2250 -0
- package/Tests/Models/DatabaseModels/IncidentAlertModel.test.ts +554 -0
- package/Tests/Models/DatabaseModels/ResourceFeedModels.test.ts +24 -5
- package/Tests/Models/DatabaseModels/SessionReplayModels.test.ts +117 -0
- package/Tests/Models/DatabaseModels/StaticRuleCriteriaInheritance.test.ts +4 -2
- package/Tests/RenderedMarkup.ts +518 -0
- package/Tests/ResponsiveVisibility.test.ts +490 -4
- package/Tests/ResponsiveVisibility.ts +505 -52
- package/Tests/Server/Infrastructure/Postgres/AddConfigurableRuleCriteriaMigration.test.ts +3 -0
- package/Tests/Server/Infrastructure/Postgres/AddDatabaseServerTablesMigration.test.ts +541 -0
- package/Tests/Server/Infrastructure/Postgres/AddIncidentAlertMigration.test.ts +341 -0
- package/Tests/Server/Infrastructure/Postgres/AddSessionReplaySameOriginTracePropagationMigration.test.ts +247 -0
- package/Tests/Server/Infrastructure/Postgres/AddUserProjectSsoConsentMigration.test.ts +234 -0
- package/Tests/Server/Services/ContainerSnapshotUpsertPostgres.test.ts +319 -0
- package/Tests/Server/Services/CrossProjectRelationWriteGuard.test.ts +13 -0
- package/Tests/Server/Services/DatabaseServerEndpointService.test.ts +2033 -0
- package/Tests/Server/Services/DatabaseServerFeedAndOwnerServices.test.ts +529 -0
- package/Tests/Server/Services/DatabaseServerLifecycle.test.ts +3302 -0
- package/Tests/Server/Services/DatabaseServerRegistries.test.ts +603 -0
- package/Tests/Server/Services/DatabaseServerRuleEngines.test.ts +754 -0
- package/Tests/Server/Services/DatabaseServerService.test.ts +3558 -0
- package/Tests/Server/Services/DatabaseServerSqlPostgres.test.ts +2045 -0
- package/Tests/Server/Services/DatabaseServiceUpdateColumnsIfUnlockedPostgres.test.ts +362 -0
- package/Tests/Server/Services/DatabaseServiceUpdateColumnsIfUnlockedReply.test.ts +210 -0
- package/Tests/Server/Services/HookFreeWriteLengthClamp.test.ts +18 -0
- package/Tests/Server/Services/IncidentAlertPostgres.test.ts +903 -0
- package/Tests/Server/Services/IncidentAlertRegistration.test.ts +96 -0
- package/Tests/Server/Services/IncidentAlertService.test.ts +2225 -0
- package/Tests/Server/Services/IncidentAlertSloLinkSurvivesEdit.test.ts +2 -0
- package/Tests/Server/Services/IncidentAlertStateCascade.test.ts +970 -0
- package/Tests/Server/Services/IncidentCreateFromAlerts.test.ts +1284 -0
- package/Tests/Server/Services/IncomingCallPolicyEscalationRuleTarget.test.ts +225 -0
- package/Tests/Server/Services/InventoryItemDisplayName.test.ts +280 -2
- package/Tests/Server/Services/InventoryUpsertSchemaParity.test.ts +8 -2
- package/Tests/Server/Services/IoTDeviceLatestMetricsPostgres.test.ts +689 -0
- package/Tests/Server/Services/IoTDeviceService.test.ts +379 -0
- package/Tests/Server/Services/LatestMetricsValuesShape.test.ts +360 -0
- package/Tests/Server/Services/LlmModelPriceService.test.ts +402 -0
- package/Tests/Server/Services/OpenTelemetryResourceRetentionMemo.test.ts +7 -1
- package/Tests/Server/Services/OwnerRowUniqueness.test.ts +61 -9
- package/Tests/Server/Services/ReminderRuleLookupPostgres.test.ts +2250 -0
- package/Tests/Server/Services/ReminderRuleRefreshOpenSubjectsPaging.test.ts +653 -0
- package/Tests/Server/Services/ResourceUpdateLastSeenLivenessFallback.test.ts +68 -20
- package/Tests/Server/Services/StaticRuleCriteriaRuntimeCoverage.test.ts +3 -3
- package/Tests/Server/Services/TelemetryResourceFacetCounting.test.ts +9 -0
- package/Tests/Server/Services/UserProjectSsoConsentPostgres.test.ts +153 -0
- package/Tests/Server/Services/UserProjectSsoConsentService.test.ts +192 -0
- package/Tests/Server/Services/UserServiceFirstMasterAdminElection.test.ts +71 -0
- package/Tests/Server/Services/UserSignupIdTakeoverPostgres.test.ts +238 -0
- package/Tests/Server/Services/WorkspaceNotificationSummaryHelpers.test.ts +592 -0
- package/Tests/Server/Types/Billing/PayAsYouGoMeteredAuthorization.test.ts +3 -0
- package/Tests/Server/Types/Database/EventOverlayScopePostgres.test.ts +1 -0
- package/Tests/Server/Types/Database/FeedEventTypeFilterQuery.test.ts +11 -0
- package/Tests/Server/Types/Database/Permissions/InfrastructureOwnershipScope.test.ts +8 -0
- package/Tests/Server/Types/Database/QueryHelperBooleanForCriteriaBackedRule.test.ts +1094 -0
- package/Tests/Server/Utils/AI/ResourceTools.test.ts +134 -0
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.ts +41 -0
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteriaAnomalyUnits.test.ts +279 -9
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteriaDisplayContext.test.ts +933 -0
- package/Tests/Server/Utils/Monitor/DatabaseMaintenanceSuppression.test.ts +582 -0
- package/Tests/Server/Utils/Monitor/DatabaseServerMonitorLinking.test.ts +753 -0
- package/Tests/Server/Utils/Monitor/MonitorActionTimestamps.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorAlertCriteriaReferences.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorAlertResourceLinking.test.ts +119 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +60 -25
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorAffectedResourceEdgeCases.test.ts +1719 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorKubernetesAffectedResources.test.ts +1447 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorKubernetesRatioEmail.test.ts +352 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorPlatformMetricUnits.test.ts +717 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorPlatformRawScan.test.ts +2125 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorPlatformSeriesAffectedResources.test.ts +1288 -0
- package/Tests/Server/Utils/Monitor/MonitorDependencySuppressionCreatorSkip.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorIncidentCriteriaReferences.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorIncidentMemberRoleMembership.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/MonitorIncidentResourceLinking.test.ts +88 -0
- package/Tests/Server/Utils/Monitor/MonitorMaintenanceSuppression.test.ts +205 -0
- package/Tests/Server/Utils/Monitor/MonitorResourceContext.test.ts +62 -0
- package/Tests/Server/Utils/Monitor/MonitorResourceDatabaseMaintenance.test.ts +803 -0
- package/Tests/Server/Utils/Monitor/MonitorStepResourceIdentity.test.ts +133 -3
- package/Tests/Server/Utils/Monitor/MonitorSummaryPersistence.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/PerSeriesRecoveryResolution.test.ts +472 -1
- package/Tests/Server/Utils/Monitor/PerSeriesSecondEntityAlerting.test.ts +1 -0
- package/Tests/Server/Utils/Monitor/SeriesResourceLinker.test.ts +236 -2
- package/Tests/Server/Utils/SeriesResourceLabels.test.ts +70 -0
- package/Tests/Server/Utils/SessionReplay/SessionReplayGateCachePolicy.test.ts +103 -0
- package/Tests/Server/Utils/StartServerProtobufContentType.test.ts +54 -0
- package/Tests/Server/Utils/Telemetry/DatabaseEndpointDiscovery.test.ts +1895 -0
- package/Tests/Server/Utils/Telemetry/EntityRegistry.test.ts +7 -0
- package/Tests/Server/Utils/Telemetry/LogExceptionExtractorSeverityGate.test.ts +90 -0
- package/Tests/Server/Utils/Telemetry/ResourceEntityFilter.test.ts +570 -0
- package/Tests/Server/Utils/Telemetry/ResourceFacetResolver.test.ts +97 -2
- package/Tests/Server/Utils/Telemetry/ServiceDependencyDiscovery.test.ts +1337 -0
- package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +295 -0
- package/Tests/Types/AI/AIResourceContext.test.ts +30 -0
- package/Tests/Types/DatabaseServer/DatabaseContainerClassifier.test.ts +3644 -0
- package/Tests/Types/DatabaseServer/DatabaseContainerCommand.test.ts +340 -0
- package/Tests/Types/DatabaseServer/DatabaseContainerCommandCorpus.ts +826 -0
- package/Tests/Types/DatabaseServer/DatabaseContainerCommandPostgres.test.ts +150 -0
- package/Tests/Types/DatabaseServer/DatabaseEndpoint.test.ts +2657 -0
- package/Tests/Types/DatabaseServer/DatabaseServerDiscoverySource.test.ts +64 -0
- package/Tests/Types/DatabaseServer/DatabaseServerEntityKeys.test.ts +952 -0
- package/Tests/Types/DatabaseServer/DatabaseServerMetricCatalog.test.ts +1161 -0
- package/Tests/Types/DatabaseServer/DatabaseSystem.test.ts +1514 -0
- package/Tests/Types/DatabaseServer/DatabaseTelemetryResolver.test.ts +1558 -0
- package/Tests/Types/Monitor/CephAlertTemplates.test.ts +255 -6
- package/Tests/Types/Monitor/DatabaseAlertTemplates.test.ts +2254 -0
- package/Tests/Types/Monitor/KubernetesAlertTemplates.test.ts +298 -0
- package/Tests/Types/Monitor/KubernetesMetricCatalog.test.ts +271 -0
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCatalog.test.ts +253 -9
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationCoverage.test.ts +13 -5
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationNotificationMode.test.ts +4 -2
- package/Tests/Types/Monitor/Recommendation/MonitorRecommendationUtil.test.ts +111 -2
- package/Tests/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.test.ts +61 -0
- package/Tests/Types/Monitor/SeriesContext/SeriesLabelDisplay.test.ts +114 -0
- package/Tests/Types/Monitor/Utils/KubernetesAgentEmittedMetrics.ts +181 -0
- package/Tests/Types/NetworkDevice/DiscoveredHostNamingStatus.test.ts +401 -0
- package/Tests/Types/Rum/WebVitals.test.ts +173 -0
- package/Tests/Types/Telemetry/ResourceEntityFacet.test.ts +4 -1
- package/Tests/Types/Telemetry/ResourceFacetCatalog.test.ts +24 -2
- package/Tests/UI/Components/Card.test.tsx +93 -2
- package/Tests/UI/Components/FeedOptions.test.ts +6 -0
- package/Tests/UI/Components/FeedOptionsButton.test.tsx +8 -1
- package/Tests/UI/Components/FieldLabelInfoCardTooltip.test.tsx +413 -0
- package/Tests/UI/Components/ForeignHiddenRuleResilience.test.tsx +1147 -0
- package/Tests/UI/Components/HeaderRightRail.test.tsx +41 -1
- package/Tests/UI/Components/InfoTooltip.test.tsx +242 -0
- package/Tests/UI/Components/LogsEntityNames.test.ts +16 -1
- package/Tests/UI/Components/LogsFacetSidebarHiddenFacets.test.tsx +7 -3
- package/Tests/UI/Components/ModelTable/BaseModelTableBulkDelete.test.tsx +207 -3
- package/Tests/UI/Components/ModelTable/BaseModelTableBulkDeleteVerb.test.tsx +367 -0
- package/Tests/UI/Components/ModelTable/BaseModelTableCreateButtonTitle.test.tsx +275 -0
- package/Tests/UI/Components/ResourceFacetConfigs.test.ts +2 -1
- package/Tests/UI/Components/RuleCriteria/RuleCriteriaModelTable.test.tsx +3 -3
- package/Tests/UI/Components/SrOnlyForeignRule.test.tsx +994 -0
- package/Tests/UI/Components/StatusPage/ResourceListSelection.test.tsx +34 -1
- package/Tests/UI/Components/TableHeaderTooltip.test.tsx +662 -0
- package/Tests/UI/Components/TelemetryFacetSidebarHiddenFacets.test.tsx +4 -1
- package/Tests/UI/ForeignHiddenRuleGuard.test.ts +1951 -0
- package/Tests/UI/Rum/PrivacySummaryCard.test.tsx +166 -9
- package/Tests/UI/Rum/RecordingHealthTooltips.test.tsx +447 -0
- package/Tests/UI/Rum/ReplayCorrelationPanel.test.tsx +164 -0
- package/Tests/UI/Rum/ReplayFrameCapture.test.ts +6750 -0
- package/Tests/UI/Rum/ReplayPlayerChrome.test.tsx +19 -1
- package/Tests/UI/Rum/ReplayRail.test.tsx +723 -12
- package/Tests/UI/Rum/ReplayRailDetail.test.tsx +86 -0
- package/Tests/UI/Rum/ReplayScreenshot.test.ts +2124 -0
- package/Tests/UI/Rum/ReplayScreenshotActions.test.tsx +3288 -0
- package/Tests/UI/Rum/ReplayStage.test.tsx +62 -0
- package/Tests/UI/Rum/ReplayStageOverlays.test.tsx +983 -2
- package/Tests/UI/Rum/ReplayTabSwitcher.test.tsx +19 -1
- package/Tests/UI/Rum/SessionReplaySettingsPolicyLoading.test.tsx +149 -0
- package/Tests/UI/Rum/SessionReplaySetupGuide.test.tsx +107 -6
- package/Tests/UI/Rum/SessionReplayUsersTableTooltips.test.tsx +330 -0
- package/Tests/UI/Rum/UserFlowTooltips.test.tsx +886 -0
- package/Tests/UI/TailwindPlayCdnForeignHiddenRule.test.ts +1005 -0
- package/Tests/UI/ThemeGroupHoverReveal.test.ts +847 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +80 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +23 -0
- package/Tests/UI/Utils/ModelAPISsoRedirect.test.ts +127 -0
- package/Tests/UI/Utils/Navigation.test.ts +102 -0
- package/Tests/UI/Utils/PermissionGate.test.ts +76 -0
- package/Tests/UI/Utils/Telemetry/TelemetryEntityNames.test.ts +23 -0
- package/Tests/Utils/Incident/IncidentFromAlerts.test.ts +696 -0
- package/Tests/Utils/LabelRuleImportExport.test.ts +5 -0
- package/Tests/Utils/MetricUnitUtil.test.ts +227 -2
- package/Tests/Utils/Monitor/MetricValueFormatter.test.ts +288 -2
- package/Tests/Utils/Monitor/PlatformResourceIdentityAndUnits.test.ts +1559 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveredHostNamingDiagnosis.test.ts +2546 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveredHostUtil.test.ts +315 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveryReverseDnsChain.test.ts +336 -1
- package/Tests/Utils/NetworkDiscovery/NetbiosNameUtil.test.ts +244 -0
- package/Tests/Utils/Rum/SessionTraceState.test.ts +239 -0
- package/Tests/Utils/ValueFormatter.test.ts +50 -0
- package/Tests/tsconfig.json +16 -0
- package/Types/AI/AIResourceContext.ts +7 -0
- package/Types/Dashboard/DashboardTemplates.ts +2 -1
- package/Types/DatabaseServer/DatabaseConnectionSpan.ts +77 -0
- package/Types/DatabaseServer/DatabaseContainerClassifier.ts +2068 -0
- package/Types/DatabaseServer/DatabaseContainerCommand.ts +801 -0
- package/Types/DatabaseServer/DatabaseEndpoint.ts +1943 -0
- package/Types/DatabaseServer/DatabaseServerDiscoverySource.ts +68 -0
- package/Types/DatabaseServer/DatabaseServerMetricCatalog.ts +966 -0
- package/Types/DatabaseServer/DatabaseSystem.ts +2124 -0
- package/Types/DatabaseServer/DatabaseTelemetryResolver.ts +555 -0
- package/Types/Email/EmailTemplateType.ts +1 -0
- package/Types/Incident/IncidentAlertLink.ts +38 -0
- package/Types/Monitor/CephAlertTemplates.ts +18 -0
- package/Types/Monitor/DatabaseAlertTemplates.ts +2020 -0
- package/Types/Monitor/KubernetesAlertTemplates.ts +64 -24
- package/Types/Monitor/KubernetesMetricCatalog.ts +118 -19
- package/Types/Monitor/MetricMonitor/MetricCriteriaContext.ts +14 -0
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.ts +93 -10
- package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.ts +109 -8
- package/Types/Monitor/Recommendation/MonitorRecommendationTypes.ts +36 -7
- package/Types/Monitor/Recommendation/MonitorRecommendationUtil.ts +43 -2
- package/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.ts +41 -6
- package/Types/Monitor/SeriesContext/SeriesLabelDisplay.ts +26 -0
- package/Types/NetworkDevice/DiscoveredHostNamingStatus.ts +147 -0
- package/Types/Permission.ts +315 -0
- package/Types/Probe/ProbeApiIngestResponse.ts +8 -0
- package/Types/Rules/RuleCriteriaFieldRegistry.ts +10 -0
- package/Types/Rules/RuleRun.ts +12 -0
- package/Types/Rum/SessionReplay.ts +25 -6
- package/Types/Rum/WebVitals.ts +52 -0
- package/Types/Telemetry/EntityType.ts +23 -0
- package/Types/Telemetry/ResourceFacetCatalog.ts +14 -0
- package/Types/Telemetry/ServiceType.ts +8 -0
- package/UI/Components/Banner/Banner.tsx +1 -1
- package/UI/Components/Card/Card.tsx +1 -1
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +2 -2
- package/UI/Components/Charts/Line/LineChart.tsx +7 -0
- package/UI/Components/CommandPalette/CommandPalette.tsx +1 -1
- package/UI/Components/Date/StartAndEndDate.tsx +5 -5
- package/UI/Components/Detail/FieldLabel.tsx +8 -0
- package/UI/Components/Diagram/HorizontalStepChain.tsx +1 -1
- package/UI/Components/Feed/FeedOptionsButton.tsx +1 -1
- package/UI/Components/Forms/BasicForm.tsx +1 -1
- package/UI/Components/Header/Header.tsx +1 -1
- package/UI/Components/Header/HeaderIconDropdownButton.tsx +1 -1
- package/UI/Components/HeaderAlert/HeaderAlert.tsx +1 -1
- package/UI/Components/InfoCard/InfoCard.tsx +47 -1
- package/UI/Components/LogsViewer/components/FacetValueRow.tsx +1 -1
- package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +1 -1
- package/UI/Components/Modal/ModalFooter.tsx +1 -1
- package/UI/Components/ModelDetail/CardModelDetail.tsx +2 -2
- package/UI/Components/ModelTable/BaseModelTable.tsx +99 -21
- package/UI/Components/ModelTable/Column.ts +5 -0
- package/UI/Components/Navbar/NavBar.tsx +9 -2
- package/UI/Components/Navbar/NavBarMenuModal.tsx +2 -2
- package/UI/Components/Page/Page.tsx +1 -1
- package/UI/Components/Pagination/Pagination.tsx +3 -3
- package/UI/Components/ProgressButtons/ProgressButtonItem.tsx +1 -1
- package/UI/Components/SideMenu/SideMenu.tsx +4 -1
- package/UI/Components/StatusPage/ResourceGroupNavigator.tsx +4 -2
- package/UI/Components/StatusPage/ResourceList.tsx +6 -6
- package/UI/Components/Table/TableHeader.tsx +47 -2
- package/UI/Components/Table/Types/Column.ts +7 -0
- package/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.tsx +1 -1
- package/UI/Components/TelemetryViewer/components/TelemetryFacetValueRow.tsx +1 -1
- package/UI/Components/Tooltip/InfoTooltip.tsx +78 -0
- package/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.tsx +1 -1
- package/UI/Components/Workflow/ComponentsModal.tsx +2 -2
- package/UI/Components/Workflow/StepTraceViewer.tsx +1 -1
- package/UI/Styles/Theme.css +8 -1
- package/UI/Utils/Navigation.ts +89 -42
- package/UI/Utils/PermissionGate.ts +11 -2
- package/UI/Utils/Telemetry/TelemetryEntityNames.ts +7 -0
- package/UI/Utils/TelemetryService.ts +4 -3
- package/Utils/Incident/IncidentFromAlerts.ts +516 -0
- package/Utils/LabelRuleImportExport.ts +2 -0
- package/Utils/MetricUnitUtil.ts +103 -11
- package/Utils/Monitor/MetricValueFormatter.ts +66 -13
- package/Utils/Monitor/PlatformMetricUnitUtil.ts +215 -0
- package/Utils/Monitor/PlatformResourceIdentity.ts +514 -0
- package/Utils/NetworkDiscovery/DiscoveredHostNamingDiagnosis.ts +425 -0
- package/Utils/NetworkDiscovery/DiscoveredHostUtil.ts +32 -0
- package/Utils/NetworkDiscovery/NetbiosNameUtil.ts +73 -0
- package/Utils/Rum/SessionTraceState.ts +212 -0
- package/Utils/Telemetry/DatabaseServerEntityKeys.ts +275 -0
- package/Utils/Telemetry/EntityKey.ts +176 -0
- package/Utils/ValueFormatter.ts +16 -0
- package/build/dist/Models/DatabaseModels/Alert.js +54 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertFeed.js +2 -0
- package/build/dist/Models/DatabaseModels/AlertFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseServer.js +1683 -0
- package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerEndpoint.js +559 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerEndpoint.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerFeed.js +648 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerFeed.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerLabelRule.js +522 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerLabelRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerRule.js +603 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerTeam.js +506 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerUser.js +505 -0
- package/build/dist/Models/DatabaseModels/DatabaseServerOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Incident.js +54 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentAlert.js +553 -0
- package/build/dist/Models/DatabaseModels/IncidentAlert.js.map +1 -0
- package/build/dist/Models/DatabaseModels/IncidentFeed.js +2 -0
- package/build/dist/Models/DatabaseModels/IncidentFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +18 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +62 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RumApplication.js +53 -1
- package/build/dist/Models/DatabaseModels/RumApplication.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +54 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryException.js +2 -0
- package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserProjectSsoConsent.js +162 -0
- package/build/dist/Models/DatabaseModels/UserProjectSsoConsent.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794800000000-AddSessionReplaySameOriginTracePropagation.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794800000000-AddSessionReplaySameOriginTracePropagation.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794900000000-AddIncidentAlert.js +42 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1794900000000-AddIncidentAlert.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795000000000-AddDatabaseServerTables.js +240 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795000000000-AddDatabaseServerTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795100000000-AddUserProjectSsoConsent.js +26 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1795100000000-AddUserProjectSsoConsent.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/MultipartFormData.js +1 -1
- package/build/dist/Server/Middleware/TelemetryIngest.js +15 -8
- package/build/dist/Server/Middleware/TelemetryIngest.js.map +1 -1
- package/build/dist/Server/Services/AlertReminderRuleService.js +72 -23
- package/build/dist/Server/Services/AlertReminderRuleService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseServerEndpointService.js +694 -0
- package/build/dist/Server/Services/DatabaseServerEndpointService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerFeedService.js +110 -0
- package/build/dist/Server/Services/DatabaseServerFeedService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerLabelRuleEngineService.js +272 -0
- package/build/dist/Server/Services/DatabaseServerLabelRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerLabelRuleService.js +13 -0
- package/build/dist/Server/Services/DatabaseServerLabelRuleService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerOwnerRuleEngineService.js +340 -0
- package/build/dist/Server/Services/DatabaseServerOwnerRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerOwnerRuleService.js +13 -0
- package/build/dist/Server/Services/DatabaseServerOwnerRuleService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerOwnerTeamService.js +160 -0
- package/build/dist/Server/Services/DatabaseServerOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerOwnerUserService.js +153 -0
- package/build/dist/Server/Services/DatabaseServerOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseServerService.js +3272 -0
- package/build/dist/Server/Services/DatabaseServerService.js.map +1 -0
- package/build/dist/Server/Services/DatabaseService.js +8 -4
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DockerResourceService.js +30 -3
- package/build/dist/Server/Services/DockerResourceService.js.map +1 -1
- package/build/dist/Server/Services/IncidentAlertService.js +1370 -0
- package/build/dist/Server/Services/IncidentAlertService.js.map +1 -0
- package/build/dist/Server/Services/IncidentReminderRuleService.js +73 -23
- package/build/dist/Server/Services/IncidentReminderRuleService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +164 -12
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +21 -0
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +18 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/InventoryItemService.js +88 -5
- package/build/dist/Server/Services/InventoryItemService.js.map +1 -1
- package/build/dist/Server/Services/IoTDeviceService.js +111 -24
- package/build/dist/Server/Services/IoTDeviceService.js.map +1 -1
- package/build/dist/Server/Services/OpenTelemetryIngestService.js +24 -9
- package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
- package/build/dist/Server/Services/PodmanResourceService.js +30 -3
- package/build/dist/Server/Services/PodmanResourceService.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js +75 -23
- package/build/dist/Server/Services/ScheduledMaintenanceReminderRuleService.js.map +1 -1
- package/build/dist/Server/Services/ServiceService.js +1 -1
- package/build/dist/Server/Services/ServiceService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryUsageBillingService.js +23 -2
- package/build/dist/Server/Services/TelemetryUsageBillingService.js.map +1 -1
- package/build/dist/Server/Services/UserProjectSsoConsentService.js +79 -0
- package/build/dist/Server/Services/UserProjectSsoConsentService.js.map +1 -0
- package/build/dist/Server/Services/UserService.js +13 -1
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +18 -0
- package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryHelper.js +26 -1
- package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/ResourceTools.js +46 -0
- package/build/dist/Server/Utils/AI/Toolbox/ResourceTools.js.map +1 -1
- package/build/dist/Server/Utils/Database/AffectedResourceRelations.js +6 -0
- package/build/dist/Server/Utils/Database/AffectedResourceRelations.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js +134 -13
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +22 -6
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +1489 -524
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +22 -6
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js +196 -6
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +36 -9
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResourceContext.js +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorResourceContext.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorStepResourceIdentity.js +175 -17
- package/build/dist/Server/Utils/Monitor/MonitorStepResourceIdentity.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/PerSeriesResolutionRootCause.js +29 -0
- package/build/dist/Server/Utils/Monitor/PerSeriesResolutionRootCause.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +211 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js +82 -10
- package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js.map +1 -1
- package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js +25 -0
- package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js.map +1 -1
- package/build/dist/Server/Utils/SessionReplay/SessionReplayGateCache.js +8 -0
- package/build/dist/Server/Utils/SessionReplay/SessionReplayGateCache.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +20 -4
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js +2 -0
- package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/DatabaseEndpointDiscovery.js +442 -0
- package/build/dist/Server/Utils/Telemetry/DatabaseEndpointDiscovery.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +5 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js +15 -1
- package/build/dist/Server/Utils/Telemetry/LogExceptionExtractor.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js +121 -5
- package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ResourceFacetResolver.js +12 -0
- package/build/dist/Server/Utils/Telemetry/ResourceFacetResolver.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ServiceDependencyDiscovery.js +438 -36
- package/build/dist/Server/Utils/Telemetry/ServiceDependencyDiscovery.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/Telemetry.js +12 -0
- package/build/dist/Server/Utils/Telemetry/Telemetry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +17 -18
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.js +16 -10
- package/build/dist/Server/Utils/Telemetry/TelemetryIngestionKeyGuard.js.map +1 -1
- package/build/dist/Types/AI/AIResourceContext.js +7 -0
- package/build/dist/Types/AI/AIResourceContext.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardTemplates.js +2 -1
- package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
- package/build/dist/Types/DatabaseServer/DatabaseConnectionSpan.js +71 -0
- package/build/dist/Types/DatabaseServer/DatabaseConnectionSpan.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseContainerClassifier.js +1462 -0
- package/build/dist/Types/DatabaseServer/DatabaseContainerClassifier.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseContainerCommand.js +691 -0
- package/build/dist/Types/DatabaseServer/DatabaseContainerCommand.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseEndpoint.js +1407 -0
- package/build/dist/Types/DatabaseServer/DatabaseEndpoint.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseServerDiscoverySource.js +60 -0
- package/build/dist/Types/DatabaseServer/DatabaseServerDiscoverySource.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseServerMetricCatalog.js +804 -0
- package/build/dist/Types/DatabaseServer/DatabaseServerMetricCatalog.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseSystem.js +1860 -0
- package/build/dist/Types/DatabaseServer/DatabaseSystem.js.map +1 -0
- package/build/dist/Types/DatabaseServer/DatabaseTelemetryResolver.js +406 -0
- package/build/dist/Types/DatabaseServer/DatabaseTelemetryResolver.js.map +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/Incident/IncidentAlertLink.js +34 -0
- package/build/dist/Types/Incident/IncidentAlertLink.js.map +1 -0
- package/build/dist/Types/Monitor/CephAlertTemplates.js +18 -0
- package/build/dist/Types/Monitor/CephAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/DatabaseAlertTemplates.js +1518 -0
- package/build/dist/Types/Monitor/DatabaseAlertTemplates.js.map +1 -0
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js +57 -24
- package/build/dist/Types/Monitor/KubernetesAlertTemplates.js.map +1 -1
- package/build/dist/Types/Monitor/KubernetesMetricCatalog.js +104 -18
- package/build/dist/Types/Monitor/KubernetesMetricCatalog.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +80 -3
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js +10 -3
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationTypes.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +29 -0
- package/build/dist/Types/Monitor/Recommendation/MonitorRecommendationUtil.js.map +1 -1
- package/build/dist/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.js +21 -6
- package/build/dist/Types/Monitor/Recommendation/RecommendationCriteriaBuilder.js.map +1 -1
- package/build/dist/Types/Monitor/SeriesContext/SeriesLabelDisplay.js +25 -0
- package/build/dist/Types/Monitor/SeriesContext/SeriesLabelDisplay.js.map +1 -1
- package/build/dist/Types/NetworkDevice/DiscoveredHostNamingStatus.js +136 -0
- package/build/dist/Types/NetworkDevice/DiscoveredHostNamingStatus.js.map +1 -0
- package/build/dist/Types/Permission.js +276 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js +10 -0
- package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js.map +1 -1
- package/build/dist/Types/Rules/RuleRun.js +4 -0
- package/build/dist/Types/Rules/RuleRun.js.map +1 -1
- package/build/dist/Types/Rum/WebVitals.js +25 -0
- package/build/dist/Types/Rum/WebVitals.js.map +1 -1
- package/build/dist/Types/Telemetry/EntityType.js +23 -0
- package/build/dist/Types/Telemetry/EntityType.js.map +1 -1
- package/build/dist/Types/Telemetry/ResourceFacetCatalog.js +14 -0
- package/build/dist/Types/Telemetry/ResourceFacetCatalog.js.map +1 -1
- package/build/dist/Types/Telemetry/ServiceType.js +8 -0
- package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
- package/build/dist/UI/Components/Banner/Banner.js +1 -1
- package/build/dist/UI/Components/Banner/Banner.js.map +1 -1
- package/build/dist/UI/Components/Card/Card.js +1 -1
- package/build/dist/UI/Components/Card/Card.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +2 -2
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.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/CommandPalette/CommandPalette.js +1 -1
- package/build/dist/UI/Components/CommandPalette/CommandPalette.js.map +1 -1
- package/build/dist/UI/Components/Date/StartAndEndDate.js +5 -5
- package/build/dist/UI/Components/Date/StartAndEndDate.js.map +1 -1
- package/build/dist/UI/Components/Detail/FieldLabel.js +2 -0
- package/build/dist/UI/Components/Detail/FieldLabel.js.map +1 -1
- package/build/dist/UI/Components/Diagram/HorizontalStepChain.js +1 -1
- package/build/dist/UI/Components/Diagram/HorizontalStepChain.js.map +1 -1
- package/build/dist/UI/Components/Feed/FeedOptionsButton.js +1 -1
- package/build/dist/UI/Components/Feed/FeedOptionsButton.js.map +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js +1 -1
- package/build/dist/UI/Components/Forms/BasicForm.js.map +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +1 -1
- package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
- package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js +1 -1
- package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js.map +1 -1
- package/build/dist/UI/Components/InfoCard/InfoCard.js +22 -1
- package/build/dist/UI/Components/InfoCard/InfoCard.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/FacetValueRow.js +1 -1
- package/build/dist/UI/Components/LogsViewer/components/FacetValueRow.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js +1 -1
- package/build/dist/UI/Components/Modal/ModalFooter.js.map +1 -1
- package/build/dist/UI/Components/ModelDetail/CardModelDetail.js +2 -2
- package/build/dist/UI/Components/ModelDetail/CardModelDetail.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +70 -18
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBar.js +9 -2
- package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +2 -2
- package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
- package/build/dist/UI/Components/Page/Page.js +1 -1
- package/build/dist/UI/Components/Page/Page.js.map +1 -1
- package/build/dist/UI/Components/Pagination/Pagination.js +3 -3
- package/build/dist/UI/Components/Pagination/Pagination.js.map +1 -1
- package/build/dist/UI/Components/ProgressButtons/ProgressButtonItem.js +1 -1
- package/build/dist/UI/Components/ProgressButtons/ProgressButtonItem.js.map +1 -1
- package/build/dist/UI/Components/SideMenu/SideMenu.js +4 -1
- package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
- package/build/dist/UI/Components/StatusPage/ResourceGroupNavigator.js +3 -1
- package/build/dist/UI/Components/StatusPage/ResourceGroupNavigator.js.map +1 -1
- package/build/dist/UI/Components/StatusPage/ResourceList.js +6 -6
- package/build/dist/UI/Components/StatusPage/ResourceList.js.map +1 -1
- package/build/dist/UI/Components/Table/TableHeader.js +18 -2
- package/build/dist/UI/Components/Table/TableHeader.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetValueRow.js +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetValueRow.js.map +1 -1
- package/build/dist/UI/Components/Tooltip/InfoTooltip.js +28 -0
- package/build/dist/UI/Components/Tooltip/InfoTooltip.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js +1 -1
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ComponentsModal.js +2 -2
- package/build/dist/UI/Components/Workflow/ComponentsModal.js.map +1 -1
- package/build/dist/UI/Components/Workflow/StepTraceViewer.js +1 -1
- package/build/dist/UI/Components/Workflow/StepTraceViewer.js.map +1 -1
- package/build/dist/UI/Utils/Navigation.js +66 -33
- package/build/dist/UI/Utils/Navigation.js.map +1 -1
- package/build/dist/UI/Utils/PermissionGate.js +4 -2
- package/build/dist/UI/Utils/PermissionGate.js.map +1 -1
- package/build/dist/UI/Utils/Telemetry/TelemetryEntityNames.js +7 -0
- package/build/dist/UI/Utils/Telemetry/TelemetryEntityNames.js.map +1 -1
- package/build/dist/UI/Utils/TelemetryService.js +3 -2
- package/build/dist/UI/Utils/TelemetryService.js.map +1 -1
- package/build/dist/Utils/Incident/IncidentFromAlerts.js +306 -0
- package/build/dist/Utils/Incident/IncidentFromAlerts.js.map +1 -0
- package/build/dist/Utils/LabelRuleImportExport.js +2 -0
- package/build/dist/Utils/LabelRuleImportExport.js.map +1 -1
- package/build/dist/Utils/MetricUnitUtil.js +77 -13
- package/build/dist/Utils/MetricUnitUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/MetricValueFormatter.js +58 -13
- package/build/dist/Utils/Monitor/MetricValueFormatter.js.map +1 -1
- package/build/dist/Utils/Monitor/PlatformMetricUnitUtil.js +161 -0
- package/build/dist/Utils/Monitor/PlatformMetricUnitUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/PlatformResourceIdentity.js +323 -0
- package/build/dist/Utils/Monitor/PlatformResourceIdentity.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostNamingDiagnosis.js +270 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostNamingDiagnosis.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js +23 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js.map +1 -1
- package/build/dist/Utils/NetworkDiscovery/NetbiosNameUtil.js +61 -0
- package/build/dist/Utils/NetworkDiscovery/NetbiosNameUtil.js.map +1 -1
- package/build/dist/Utils/Rum/SessionTraceState.js +154 -0
- package/build/dist/Utils/Rum/SessionTraceState.js.map +1 -0
- package/build/dist/Utils/Telemetry/DatabaseServerEntityKeys.js +178 -0
- package/build/dist/Utils/Telemetry/DatabaseServerEntityKeys.js.map +1 -0
- package/build/dist/Utils/Telemetry/EntityKey.js +133 -0
- package/build/dist/Utils/Telemetry/EntityKey.js.map +1 -1
- package/build/dist/Utils/ValueFormatter.js +15 -0
- package/build/dist/Utils/ValueFormatter.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.tests.json +7 -5
|
@@ -0,0 +1,1559 @@
|
|
|
1
|
+
import Dictionary from "../../../Types/Dictionary";
|
|
2
|
+
import { JSONObject } from "../../../Types/JSON";
|
|
3
|
+
import MonitorType from "../../../Types/Monitor/MonitorType";
|
|
4
|
+
import { getAllCephMetrics } from "../../../Types/Monitor/CephMetricCatalog";
|
|
5
|
+
import { getAllDockerMetrics } from "../../../Types/Monitor/DockerMetricCatalog";
|
|
6
|
+
import { getAllDockerSwarmMetrics } from "../../../Types/Monitor/DockerSwarmMetricCatalog";
|
|
7
|
+
import * as HostMetricCatalog from "../../../Types/Monitor/HostMetricCatalog";
|
|
8
|
+
import { getAllIoTMetrics } from "../../../Types/Monitor/IotMetricCatalog";
|
|
9
|
+
import { getAllKubernetesMetrics } from "../../../Types/Monitor/KubernetesMetricCatalog";
|
|
10
|
+
import { getAllPodmanMetrics } from "../../../Types/Monitor/PodmanMetricCatalog";
|
|
11
|
+
import { getAllProxmoxMetrics } from "../../../Types/Monitor/ProxmoxMetricCatalog";
|
|
12
|
+
import { getAllVMwareMetrics } from "../../../Types/Monitor/VMwareMetricCatalog";
|
|
13
|
+
import MetricValueFormatter from "../../../Utils/Monitor/MetricValueFormatter";
|
|
14
|
+
import PlatformMetricUnitUtil, {
|
|
15
|
+
MetricCatalogPlatform,
|
|
16
|
+
} from "../../../Utils/Monitor/PlatformMetricUnitUtil";
|
|
17
|
+
import PlatformResourceIdentity, {
|
|
18
|
+
CephResourceIdentity,
|
|
19
|
+
DockerSwarmResourceIdentity,
|
|
20
|
+
KubernetesResourceIdentity,
|
|
21
|
+
ProxmoxResourceIdentity,
|
|
22
|
+
VMwareResourceIdentity,
|
|
23
|
+
} from "../../../Utils/Monitor/PlatformResourceIdentity";
|
|
24
|
+
import { afterEach, describe, expect, jest, test } from "@jest/globals";
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* WHICH RESOURCE IS THIS, AND WHAT UNIT IS ITS VALUE IN.
|
|
28
|
+
*
|
|
29
|
+
* An alert's "Affected Resources" list is written by two readers that must
|
|
30
|
+
* never disagree:
|
|
31
|
+
*
|
|
32
|
+
* - the telemetry worker, naming the resource behind each raw datapoint it
|
|
33
|
+
* scanned;
|
|
34
|
+
* - the criteria evaluator, naming the resource behind each series a
|
|
35
|
+
* grouped monitor evaluated, from the series' group-by labels enriched
|
|
36
|
+
* with context borrowed from the series' own first breaching datapoint.
|
|
37
|
+
*
|
|
38
|
+
* PlatformResourceIdentity is the one copy of the attribute keys both
|
|
39
|
+
* readers use. The borrowing rules (with*Context) are where a wrong answer
|
|
40
|
+
* is most expensive: a node-level series that borrowed a namespace from an
|
|
41
|
+
* arbitrary container row would title the node with somebody else's
|
|
42
|
+
* tenant, and a series that borrowed from a datapoint that DISAGREES with
|
|
43
|
+
* it would be titled as a different object altogether. So every rule is
|
|
44
|
+
* pinned both ways — what a series may borrow, and what it may not.
|
|
45
|
+
*
|
|
46
|
+
* PlatformMetricUnitUtil decides what unit those values are in. The
|
|
47
|
+
* platform catalog beats the exporter-declared unit (docker_stats declares
|
|
48
|
+
* container.cpu.utilization as "1" but sends 0–100; kubeletstats declares
|
|
49
|
+
* k8s.node.cpu.utilization as "1" but it is a cores gauge), and every
|
|
50
|
+
* catalog unit must survive MetricValueFormatter without printing "NaN" or
|
|
51
|
+
* "undefined" into somebody's inbox.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
type ExpectedIdentity<T> = { [K in keyof T]-?: T[K] | undefined };
|
|
55
|
+
|
|
56
|
+
function sortedEntries(
|
|
57
|
+
value: Record<string, unknown>,
|
|
58
|
+
): Array<[string, unknown]> {
|
|
59
|
+
return Object.entries(value)
|
|
60
|
+
.filter((entry: [string, unknown]) => {
|
|
61
|
+
return entry[1] !== undefined;
|
|
62
|
+
})
|
|
63
|
+
.sort((a: [string, unknown], b: [string, unknown]) => {
|
|
64
|
+
return a[0].localeCompare(b[0]);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* Compare identities by their DEFINED fields: the mappers return every key
|
|
70
|
+
* (with undefined for absent ones) while the context rules spread series
|
|
71
|
+
* objects, and neither shape is the point of these tests.
|
|
72
|
+
*/
|
|
73
|
+
function expectSameIdentity(
|
|
74
|
+
actual: Record<string, unknown>,
|
|
75
|
+
expected: Record<string, unknown>,
|
|
76
|
+
): void {
|
|
77
|
+
expect(sortedEntries(actual)).toEqual(sortedEntries(expected));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
describe("PlatformResourceIdentity.readAttribute", () => {
|
|
81
|
+
test("returns non-empty strings verbatim", () => {
|
|
82
|
+
expect(
|
|
83
|
+
PlatformResourceIdentity.readAttribute({ key: "node-1" }, "key"),
|
|
84
|
+
).toBe("node-1");
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("an empty string is not a name", () => {
|
|
88
|
+
expect(
|
|
89
|
+
PlatformResourceIdentity.readAttribute({ key: "" }, "key"),
|
|
90
|
+
).toBeUndefined();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("finite numbers are stringified, non-finite ones are not names", () => {
|
|
94
|
+
expect(PlatformResourceIdentity.readAttribute({ key: 7 }, "key")).toBe("7");
|
|
95
|
+
expect(PlatformResourceIdentity.readAttribute({ key: 0 }, "key")).toBe("0");
|
|
96
|
+
expect(
|
|
97
|
+
PlatformResourceIdentity.readAttribute({ key: Number.NaN }, "key"),
|
|
98
|
+
).toBeUndefined();
|
|
99
|
+
expect(
|
|
100
|
+
PlatformResourceIdentity.readAttribute(
|
|
101
|
+
{ key: Number.POSITIVE_INFINITY },
|
|
102
|
+
"key",
|
|
103
|
+
),
|
|
104
|
+
).toBeUndefined();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("booleans, objects, null and missing keys are not names", () => {
|
|
108
|
+
const attributes: JSONObject = {
|
|
109
|
+
flag: true,
|
|
110
|
+
nested: { name: "x" },
|
|
111
|
+
empty: null,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
expect(
|
|
115
|
+
PlatformResourceIdentity.readAttribute(attributes, "flag"),
|
|
116
|
+
).toBeUndefined();
|
|
117
|
+
expect(
|
|
118
|
+
PlatformResourceIdentity.readAttribute(attributes, "nested"),
|
|
119
|
+
).toBeUndefined();
|
|
120
|
+
expect(
|
|
121
|
+
PlatformResourceIdentity.readAttribute(attributes, "empty"),
|
|
122
|
+
).toBeUndefined();
|
|
123
|
+
expect(
|
|
124
|
+
PlatformResourceIdentity.readAttribute(attributes, "missing"),
|
|
125
|
+
).toBeUndefined();
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
describe("PlatformResourceIdentity.withBothAttributeSpellings", () => {
|
|
130
|
+
test("mirrors a resource.-prefixed label under its bare OTel key", () => {
|
|
131
|
+
expect(
|
|
132
|
+
PlatformResourceIdentity.withBothAttributeSpellings({
|
|
133
|
+
"resource.k8s.node.name": "node-1",
|
|
134
|
+
}),
|
|
135
|
+
).toEqual({
|
|
136
|
+
"resource.k8s.node.name": "node-1",
|
|
137
|
+
"k8s.node.name": "node-1",
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("mirrors a bare OTel label under its resource.-prefixed key", () => {
|
|
142
|
+
expect(
|
|
143
|
+
PlatformResourceIdentity.withBothAttributeSpellings({
|
|
144
|
+
"k8s.node.name": "node-1",
|
|
145
|
+
}),
|
|
146
|
+
).toEqual({
|
|
147
|
+
"k8s.node.name": "node-1",
|
|
148
|
+
"resource.k8s.node.name": "node-1",
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test("never overwrites a key that is already there, in either direction", () => {
|
|
153
|
+
expect(
|
|
154
|
+
PlatformResourceIdentity.withBothAttributeSpellings({
|
|
155
|
+
"resource.k8s.node.name": "stored-node",
|
|
156
|
+
"k8s.node.name": "bare-node",
|
|
157
|
+
}),
|
|
158
|
+
).toEqual({
|
|
159
|
+
"resource.k8s.node.name": "stored-node",
|
|
160
|
+
"k8s.node.name": "bare-node",
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test("does not mutate the labels it was given", () => {
|
|
165
|
+
const labels: JSONObject = { "resource.k8s.pod.name": "web-1" };
|
|
166
|
+
|
|
167
|
+
PlatformResourceIdentity.withBothAttributeSpellings(labels);
|
|
168
|
+
|
|
169
|
+
expect(labels).toEqual({ "resource.k8s.pod.name": "web-1" });
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test("a bare 'resource.' key has no other spelling and gains no '' key", () => {
|
|
173
|
+
expect(
|
|
174
|
+
PlatformResourceIdentity.withBothAttributeSpellings({ "resource.": "x" }),
|
|
175
|
+
).toEqual({ "resource.": "x" });
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test("a bare-keyed series reads as the same Kubernetes identity as a stored-keyed one", () => {
|
|
179
|
+
const bare: KubernetesResourceIdentity =
|
|
180
|
+
PlatformResourceIdentity.kubernetes(
|
|
181
|
+
PlatformResourceIdentity.withBothAttributeSpellings({
|
|
182
|
+
"k8s.node.name": "node-1",
|
|
183
|
+
}),
|
|
184
|
+
);
|
|
185
|
+
const stored: KubernetesResourceIdentity =
|
|
186
|
+
PlatformResourceIdentity.kubernetes(
|
|
187
|
+
PlatformResourceIdentity.withBothAttributeSpellings({
|
|
188
|
+
"resource.k8s.node.name": "node-1",
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
expect(bare).toEqual(stored);
|
|
193
|
+
expect(bare.nodeName).toBe("node-1");
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
describe("PlatformResourceIdentity.kubernetes", () => {
|
|
198
|
+
test("maps a pod datapoint's resource attributes to its identity", () => {
|
|
199
|
+
const identity: KubernetesResourceIdentity =
|
|
200
|
+
PlatformResourceIdentity.kubernetes({
|
|
201
|
+
"resource.k8s.cluster.name": "prod-cluster",
|
|
202
|
+
"resource.k8s.namespace.name": "payments",
|
|
203
|
+
"resource.k8s.node.name": "gke-pool-1-abcd",
|
|
204
|
+
"resource.k8s.pod.name": "checkout-7d9f8b6c5-x2k4q",
|
|
205
|
+
"resource.k8s.container.name": "checkout",
|
|
206
|
+
"resource.k8s.deployment.name": "checkout",
|
|
207
|
+
"resource.k8s.replicaset.name": "checkout-7d9f8b6c5",
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const expected: ExpectedIdentity<KubernetesResourceIdentity> = {
|
|
211
|
+
podName: "checkout-7d9f8b6c5-x2k4q",
|
|
212
|
+
namespace: "payments",
|
|
213
|
+
nodeName: "gke-pool-1-abcd",
|
|
214
|
+
containerName: "checkout",
|
|
215
|
+
workloadType: "Deployment",
|
|
216
|
+
workloadName: "checkout",
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
expect(identity).toEqual(expected);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
/*
|
|
223
|
+
* The precedence chain, most specific controller first. Each row stamps
|
|
224
|
+
* its own key AND every less specific one after it, and must still be
|
|
225
|
+
* titled by its own.
|
|
226
|
+
*/
|
|
227
|
+
const workloadChain: Array<[string, string]> = [
|
|
228
|
+
["resource.k8s.deployment.name", "Deployment"],
|
|
229
|
+
["resource.k8s.statefulset.name", "StatefulSet"],
|
|
230
|
+
["resource.k8s.daemonset.name", "DaemonSet"],
|
|
231
|
+
["resource.k8s.job.name", "Job"],
|
|
232
|
+
["resource.k8s.cronjob.name", "CronJob"],
|
|
233
|
+
["resource.k8s.replicaset.name", "ReplicaSet"],
|
|
234
|
+
["resource.k8s.hpa.name", "HorizontalPodAutoscaler"],
|
|
235
|
+
];
|
|
236
|
+
|
|
237
|
+
for (let index: number = 0; index < workloadChain.length; index++) {
|
|
238
|
+
const [key, type] = workloadChain[index] as [string, string];
|
|
239
|
+
|
|
240
|
+
test(`${type} wins over every less specific workload key`, () => {
|
|
241
|
+
const attributes: JSONObject = {};
|
|
242
|
+
|
|
243
|
+
for (const [laterKey] of workloadChain.slice(index)) {
|
|
244
|
+
attributes[laterKey] = `name-of-${laterKey}`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const identity: KubernetesResourceIdentity =
|
|
248
|
+
PlatformResourceIdentity.kubernetes(attributes);
|
|
249
|
+
|
|
250
|
+
expect(identity.workloadType).toBe(type);
|
|
251
|
+
expect(identity.workloadName).toBe(`name-of-${key}`);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
test("a Job pod spawned by a CronJob is titled by its Job", () => {
|
|
256
|
+
const identity: KubernetesResourceIdentity =
|
|
257
|
+
PlatformResourceIdentity.kubernetes({
|
|
258
|
+
"resource.k8s.cronjob.name": "nightly-backup",
|
|
259
|
+
"resource.k8s.job.name": "nightly-backup-28745120",
|
|
260
|
+
"resource.k8s.pod.name": "nightly-backup-28745120-7xkqz",
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
expect(identity.workloadType).toBe("Job");
|
|
264
|
+
expect(identity.workloadName).toBe("nightly-backup-28745120");
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
test("an empty workload name is skipped, not taken as the winner", () => {
|
|
268
|
+
const identity: KubernetesResourceIdentity =
|
|
269
|
+
PlatformResourceIdentity.kubernetes({
|
|
270
|
+
"resource.k8s.deployment.name": "",
|
|
271
|
+
"resource.k8s.statefulset.name": "postgres",
|
|
272
|
+
"resource.k8s.pod.name": "",
|
|
273
|
+
"resource.k8s.namespace.name": "",
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
expect(identity.workloadType).toBe("StatefulSet");
|
|
277
|
+
expect(identity.workloadName).toBe("postgres");
|
|
278
|
+
expect(identity.podName).toBeUndefined();
|
|
279
|
+
expect(identity.namespace).toBeUndefined();
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test("no workload key leaves both workload fields undefined", () => {
|
|
283
|
+
const identity: KubernetesResourceIdentity =
|
|
284
|
+
PlatformResourceIdentity.kubernetes({
|
|
285
|
+
"resource.k8s.node.name": "node-1",
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
expect(identity.workloadType).toBeUndefined();
|
|
289
|
+
expect(identity.workloadName).toBeUndefined();
|
|
290
|
+
expect(identity.nodeName).toBe("node-1");
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
test("reads only the stored resource.-prefixed keys", () => {
|
|
294
|
+
const identity: KubernetesResourceIdentity =
|
|
295
|
+
PlatformResourceIdentity.kubernetes({
|
|
296
|
+
"k8s.node.name": "node-1",
|
|
297
|
+
"k8s.pod.name": "web-1",
|
|
298
|
+
"k8s.deployment.name": "web",
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
expectSameIdentity(identity, {});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
test("kubernetesKey joins pod, namespace, node, container and workload name", () => {
|
|
305
|
+
expect(
|
|
306
|
+
PlatformResourceIdentity.kubernetesKey({
|
|
307
|
+
podName: "web-1",
|
|
308
|
+
namespace: "prod",
|
|
309
|
+
nodeName: "node-1",
|
|
310
|
+
containerName: "app",
|
|
311
|
+
workloadType: "Deployment",
|
|
312
|
+
workloadName: "web",
|
|
313
|
+
}),
|
|
314
|
+
).toBe("web-1|prod|node-1|app|web");
|
|
315
|
+
|
|
316
|
+
expect(PlatformResourceIdentity.kubernetesKey({ nodeName: "node-1" })).toBe(
|
|
317
|
+
"||node-1||",
|
|
318
|
+
);
|
|
319
|
+
expect(PlatformResourceIdentity.kubernetesKey({})).toBe("||||");
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
test("kubernetesKey does not depend on the workload TYPE", () => {
|
|
323
|
+
expect(
|
|
324
|
+
PlatformResourceIdentity.kubernetesKey({
|
|
325
|
+
workloadType: "Deployment",
|
|
326
|
+
workloadName: "web",
|
|
327
|
+
}),
|
|
328
|
+
).toBe(
|
|
329
|
+
PlatformResourceIdentity.kubernetesKey({
|
|
330
|
+
workloadType: "StatefulSet",
|
|
331
|
+
workloadName: "web",
|
|
332
|
+
}),
|
|
333
|
+
);
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
describe("PlatformResourceIdentity.withKubernetesContext", () => {
|
|
338
|
+
/*
|
|
339
|
+
* The first breaching datapoint of a pod series: a full raw attribute
|
|
340
|
+
* map, as the worker keeps it on each query row.
|
|
341
|
+
*/
|
|
342
|
+
const podDatapoint: KubernetesResourceIdentity =
|
|
343
|
+
PlatformResourceIdentity.kubernetes({
|
|
344
|
+
"resource.k8s.namespace.name": "payments",
|
|
345
|
+
"resource.k8s.node.name": "gke-pool-1-abcd",
|
|
346
|
+
"resource.k8s.pod.name": "checkout-7d9f8b6c5-x2k4q",
|
|
347
|
+
"resource.k8s.container.name": "checkout",
|
|
348
|
+
"resource.k8s.deployment.name": "checkout",
|
|
349
|
+
"resource.k8s.replicaset.name": "checkout-7d9f8b6c5",
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
test("a pod series borrows its node, workload and namespace", () => {
|
|
353
|
+
const series: KubernetesResourceIdentity =
|
|
354
|
+
PlatformResourceIdentity.kubernetes({
|
|
355
|
+
"resource.k8s.pod.name": "checkout-7d9f8b6c5-x2k4q",
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
expectSameIdentity(
|
|
359
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint),
|
|
360
|
+
{
|
|
361
|
+
podName: "checkout-7d9f8b6c5-x2k4q",
|
|
362
|
+
namespace: "payments",
|
|
363
|
+
nodeName: "gke-pool-1-abcd",
|
|
364
|
+
workloadType: "Deployment",
|
|
365
|
+
workloadName: "checkout",
|
|
366
|
+
},
|
|
367
|
+
);
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
/*
|
|
371
|
+
* A pod has many containers; its series is not about any one of them.
|
|
372
|
+
*/
|
|
373
|
+
test("a pod series does not borrow a container", () => {
|
|
374
|
+
const series: KubernetesResourceIdentity = {
|
|
375
|
+
podName: "checkout-7d9f8b6c5-x2k4q",
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
expect(
|
|
379
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint)
|
|
380
|
+
.containerName,
|
|
381
|
+
).toBeUndefined();
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
test("a pod series keeps what its own labels already say", () => {
|
|
385
|
+
const series: KubernetesResourceIdentity = {
|
|
386
|
+
podName: "checkout-7d9f8b6c5-x2k4q",
|
|
387
|
+
namespace: "payments",
|
|
388
|
+
workloadType: "Deployment",
|
|
389
|
+
workloadName: "checkout",
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
expectSameIdentity(
|
|
393
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint),
|
|
394
|
+
{
|
|
395
|
+
podName: "checkout-7d9f8b6c5-x2k4q",
|
|
396
|
+
namespace: "payments",
|
|
397
|
+
nodeName: "gke-pool-1-abcd",
|
|
398
|
+
workloadType: "Deployment",
|
|
399
|
+
workloadName: "checkout",
|
|
400
|
+
},
|
|
401
|
+
);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
test("a pod + container series borrows the pod's context too", () => {
|
|
405
|
+
const series: KubernetesResourceIdentity = {
|
|
406
|
+
podName: "checkout-7d9f8b6c5-x2k4q",
|
|
407
|
+
containerName: "checkout",
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
expectSameIdentity(
|
|
411
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint),
|
|
412
|
+
{
|
|
413
|
+
podName: "checkout-7d9f8b6c5-x2k4q",
|
|
414
|
+
containerName: "checkout",
|
|
415
|
+
namespace: "payments",
|
|
416
|
+
nodeName: "gke-pool-1-abcd",
|
|
417
|
+
workloadType: "Deployment",
|
|
418
|
+
workloadName: "checkout",
|
|
419
|
+
},
|
|
420
|
+
);
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
test("a workload series borrows only its namespace", () => {
|
|
424
|
+
const series: KubernetesResourceIdentity =
|
|
425
|
+
PlatformResourceIdentity.kubernetes({
|
|
426
|
+
"resource.k8s.deployment.name": "checkout",
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
expectSameIdentity(
|
|
430
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint),
|
|
431
|
+
{
|
|
432
|
+
workloadType: "Deployment",
|
|
433
|
+
workloadName: "checkout",
|
|
434
|
+
namespace: "payments",
|
|
435
|
+
},
|
|
436
|
+
);
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
test("a workload + container series borrows nothing", () => {
|
|
440
|
+
const series: KubernetesResourceIdentity = {
|
|
441
|
+
workloadType: "Deployment",
|
|
442
|
+
workloadName: "checkout",
|
|
443
|
+
containerName: "checkout",
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
expect(
|
|
447
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint),
|
|
448
|
+
).toEqual(series);
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
/*
|
|
452
|
+
* A node-level series summed from container rows has a different pod
|
|
453
|
+
* and namespace on every row. Borrowing one would title the node with
|
|
454
|
+
* an arbitrary tenant.
|
|
455
|
+
*/
|
|
456
|
+
test("a node series borrows nothing", () => {
|
|
457
|
+
const series: KubernetesResourceIdentity =
|
|
458
|
+
PlatformResourceIdentity.kubernetes({
|
|
459
|
+
"resource.k8s.node.name": "gke-pool-1-abcd",
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
const enriched: KubernetesResourceIdentity =
|
|
463
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint);
|
|
464
|
+
|
|
465
|
+
expectSameIdentity(enriched, { nodeName: "gke-pool-1-abcd" });
|
|
466
|
+
expect(enriched.namespace).toBeUndefined();
|
|
467
|
+
expect(enriched.podName).toBeUndefined();
|
|
468
|
+
expect(enriched.workloadName).toBeUndefined();
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
test("a container series with no pod borrows nothing", () => {
|
|
472
|
+
const series: KubernetesResourceIdentity = { containerName: "checkout" };
|
|
473
|
+
|
|
474
|
+
expect(
|
|
475
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint),
|
|
476
|
+
).toEqual({ containerName: "checkout" });
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
test("a namespace series borrows nothing", () => {
|
|
480
|
+
const series: KubernetesResourceIdentity = { namespace: "payments" };
|
|
481
|
+
|
|
482
|
+
expect(
|
|
483
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint),
|
|
484
|
+
).toEqual({ namespace: "payments" });
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
const disagreements: Array<[string, KubernetesResourceIdentity]> = [
|
|
488
|
+
["pod", { podName: "some-other-pod" }],
|
|
489
|
+
[
|
|
490
|
+
"namespace",
|
|
491
|
+
{ podName: "checkout-7d9f8b6c5-x2k4q", namespace: "billing" },
|
|
492
|
+
],
|
|
493
|
+
["node", { podName: "checkout-7d9f8b6c5-x2k4q", nodeName: "other-node" }],
|
|
494
|
+
[
|
|
495
|
+
"container",
|
|
496
|
+
{ podName: "checkout-7d9f8b6c5-x2k4q", containerName: "istio-proxy" },
|
|
497
|
+
],
|
|
498
|
+
[
|
|
499
|
+
"workload type",
|
|
500
|
+
{
|
|
501
|
+
workloadType: "StatefulSet",
|
|
502
|
+
workloadName: "checkout",
|
|
503
|
+
},
|
|
504
|
+
],
|
|
505
|
+
[
|
|
506
|
+
"workload name",
|
|
507
|
+
{
|
|
508
|
+
podName: "checkout-7d9f8b6c5-x2k4q",
|
|
509
|
+
workloadType: "Deployment",
|
|
510
|
+
workloadName: "cart",
|
|
511
|
+
},
|
|
512
|
+
],
|
|
513
|
+
];
|
|
514
|
+
|
|
515
|
+
for (const [field, series] of disagreements) {
|
|
516
|
+
test(`a datapoint that disagrees on the ${field} is not the series' datapoint`, () => {
|
|
517
|
+
expect(
|
|
518
|
+
PlatformResourceIdentity.withKubernetesContext(series, podDatapoint),
|
|
519
|
+
).toBe(series);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
describe("PlatformResourceIdentity.proxmox", () => {
|
|
525
|
+
const guestAttributes: JSONObject = {
|
|
526
|
+
id: "qemu/100",
|
|
527
|
+
name: "web-vm",
|
|
528
|
+
"pve.type": "qemu",
|
|
529
|
+
"pve.scope": "guest",
|
|
530
|
+
node: "pve1",
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
test("maps the agent's id / name / pve.type / pve.scope / node", () => {
|
|
534
|
+
const expected: ExpectedIdentity<ProxmoxResourceIdentity> = {
|
|
535
|
+
resourceId: "qemu/100",
|
|
536
|
+
resourceName: "web-vm",
|
|
537
|
+
resourceType: "qemu",
|
|
538
|
+
scope: "guest",
|
|
539
|
+
nodeName: "pve1",
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
expect(PlatformResourceIdentity.proxmox(guestAttributes)).toEqual(expected);
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
test("empty strings are not names", () => {
|
|
546
|
+
expectSameIdentity(
|
|
547
|
+
PlatformResourceIdentity.proxmox({ id: "lxc/101", name: "", node: "" }),
|
|
548
|
+
{ resourceId: "lxc/101" },
|
|
549
|
+
);
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
test("proxmoxKey joins id, name and node", () => {
|
|
553
|
+
expect(
|
|
554
|
+
PlatformResourceIdentity.proxmoxKey(
|
|
555
|
+
PlatformResourceIdentity.proxmox(guestAttributes),
|
|
556
|
+
),
|
|
557
|
+
).toBe("qemu/100|web-vm|pve1");
|
|
558
|
+
expect(
|
|
559
|
+
PlatformResourceIdentity.proxmoxKey({ resourceId: "node/pve1" }),
|
|
560
|
+
).toBe("node/pve1||");
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
test("a series grouped by id borrows type, scope, name and node", () => {
|
|
564
|
+
const series: ProxmoxResourceIdentity = PlatformResourceIdentity.proxmox({
|
|
565
|
+
id: "qemu/100",
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
expectSameIdentity(
|
|
569
|
+
PlatformResourceIdentity.withProxmoxContext(
|
|
570
|
+
series,
|
|
571
|
+
PlatformResourceIdentity.proxmox(guestAttributes),
|
|
572
|
+
),
|
|
573
|
+
{
|
|
574
|
+
resourceId: "qemu/100",
|
|
575
|
+
resourceName: "web-vm",
|
|
576
|
+
resourceType: "qemu",
|
|
577
|
+
scope: "guest",
|
|
578
|
+
nodeName: "pve1",
|
|
579
|
+
},
|
|
580
|
+
);
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
test("a series with no id borrows nothing", () => {
|
|
584
|
+
const series: ProxmoxResourceIdentity = { nodeName: "pve1" };
|
|
585
|
+
|
|
586
|
+
expect(
|
|
587
|
+
PlatformResourceIdentity.withProxmoxContext(
|
|
588
|
+
series,
|
|
589
|
+
PlatformResourceIdentity.proxmox(guestAttributes),
|
|
590
|
+
),
|
|
591
|
+
).toBe(series);
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
test("a datapoint that disagrees on any shared field is ignored", () => {
|
|
595
|
+
const context: ProxmoxResourceIdentity =
|
|
596
|
+
PlatformResourceIdentity.proxmox(guestAttributes);
|
|
597
|
+
|
|
598
|
+
const disagreeing: Array<ProxmoxResourceIdentity> = [
|
|
599
|
+
{ resourceId: "qemu/101" },
|
|
600
|
+
{ resourceId: "qemu/100", resourceName: "db-vm" },
|
|
601
|
+
{ resourceId: "qemu/100", resourceType: "lxc" },
|
|
602
|
+
{ resourceId: "qemu/100", scope: "node" },
|
|
603
|
+
{ resourceId: "qemu/100", nodeName: "pve2" },
|
|
604
|
+
];
|
|
605
|
+
|
|
606
|
+
for (const series of disagreeing) {
|
|
607
|
+
expect(PlatformResourceIdentity.withProxmoxContext(series, context)).toBe(
|
|
608
|
+
series,
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
describe("PlatformResourceIdentity.vmware", () => {
|
|
615
|
+
const vmAttributes: JSONObject = {
|
|
616
|
+
"resource.vcenter.datacenter.name": "dc-east",
|
|
617
|
+
"resource.vcenter.cluster.name": "cluster-a",
|
|
618
|
+
"resource.vcenter.host.name": "esx-01.lab",
|
|
619
|
+
"resource.vcenter.vm.name": "web-01",
|
|
620
|
+
"resource.vcenter.vm.id": "vm-1042",
|
|
621
|
+
"resource.vcenter.resource_pool.name": "prod-pool",
|
|
622
|
+
"resource.vcenter.resource_pool.inventory_path":
|
|
623
|
+
"/dc-east/host/cluster-a/Resources/prod-pool",
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
test("maps the vcenter receiver's resource attributes", () => {
|
|
627
|
+
const expected: ExpectedIdentity<VMwareResourceIdentity> = {
|
|
628
|
+
datacenterName: "dc-east",
|
|
629
|
+
clusterName: "cluster-a",
|
|
630
|
+
hostName: "esx-01.lab",
|
|
631
|
+
vmName: "web-01",
|
|
632
|
+
vmId: "vm-1042",
|
|
633
|
+
datastoreName: undefined,
|
|
634
|
+
resourcePoolName: "prod-pool",
|
|
635
|
+
resourcePoolPath: "/dc-east/host/cluster-a/Resources/prod-pool",
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
expect(PlatformResourceIdentity.vmware(vmAttributes)).toEqual(expected);
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
test("a VM template's identity folds into the VM fields", () => {
|
|
642
|
+
expectSameIdentity(
|
|
643
|
+
PlatformResourceIdentity.vmware({
|
|
644
|
+
"resource.vcenter.datacenter.name": "dc-east",
|
|
645
|
+
"resource.vcenter.vm_template.name": "ubuntu-22.04-golden",
|
|
646
|
+
"resource.vcenter.vm_template.id": "vm-7",
|
|
647
|
+
}),
|
|
648
|
+
{
|
|
649
|
+
datacenterName: "dc-east",
|
|
650
|
+
vmName: "ubuntu-22.04-golden",
|
|
651
|
+
vmId: "vm-7",
|
|
652
|
+
},
|
|
653
|
+
);
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
test("a real VM name wins over a template name, an empty one does not", () => {
|
|
657
|
+
const both: VMwareResourceIdentity = PlatformResourceIdentity.vmware({
|
|
658
|
+
"resource.vcenter.vm.name": "web-01",
|
|
659
|
+
"resource.vcenter.vm.id": "vm-1042",
|
|
660
|
+
"resource.vcenter.vm_template.name": "golden",
|
|
661
|
+
"resource.vcenter.vm_template.id": "vm-7",
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
expect(both.vmName).toBe("web-01");
|
|
665
|
+
expect(both.vmId).toBe("vm-1042");
|
|
666
|
+
|
|
667
|
+
const emptyVm: VMwareResourceIdentity = PlatformResourceIdentity.vmware({
|
|
668
|
+
"resource.vcenter.vm.name": "",
|
|
669
|
+
"resource.vcenter.vm_template.name": "golden",
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
expect(emptyVm.vmName).toBe("golden");
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
test("vmwareKey dedupes on the full tuple, preferring the pool path over its name", () => {
|
|
676
|
+
expect(
|
|
677
|
+
PlatformResourceIdentity.vmwareKey(
|
|
678
|
+
PlatformResourceIdentity.vmware(vmAttributes),
|
|
679
|
+
),
|
|
680
|
+
).toBe(
|
|
681
|
+
"dc-east|cluster-a|esx-01.lab|vm-1042|web-01||/dc-east/host/cluster-a/Resources/prod-pool",
|
|
682
|
+
);
|
|
683
|
+
|
|
684
|
+
expect(
|
|
685
|
+
PlatformResourceIdentity.vmwareKey({
|
|
686
|
+
datacenterName: "dc-east",
|
|
687
|
+
resourcePoolName: "prod-pool",
|
|
688
|
+
}),
|
|
689
|
+
).toBe("dc-east||||||prod-pool");
|
|
690
|
+
|
|
691
|
+
expect(
|
|
692
|
+
PlatformResourceIdentity.vmwareKey({ datastoreName: "datastore-1" }),
|
|
693
|
+
).toBe("|||||datastore-1|");
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
/*
|
|
697
|
+
* The first breaching datapoint of a VM: the whole tree above it.
|
|
698
|
+
*/
|
|
699
|
+
const vmDatapoint: VMwareResourceIdentity =
|
|
700
|
+
PlatformResourceIdentity.vmware(vmAttributes);
|
|
701
|
+
|
|
702
|
+
test("a VM series borrows its host, cluster, datacenter and pool", () => {
|
|
703
|
+
expectSameIdentity(
|
|
704
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
705
|
+
{ vmName: "web-01" },
|
|
706
|
+
vmDatapoint,
|
|
707
|
+
),
|
|
708
|
+
{
|
|
709
|
+
datacenterName: "dc-east",
|
|
710
|
+
clusterName: "cluster-a",
|
|
711
|
+
hostName: "esx-01.lab",
|
|
712
|
+
vmName: "web-01",
|
|
713
|
+
vmId: "vm-1042",
|
|
714
|
+
resourcePoolName: "prod-pool",
|
|
715
|
+
resourcePoolPath: "/dc-east/host/cluster-a/Resources/prod-pool",
|
|
716
|
+
},
|
|
717
|
+
);
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
test("a VM series keyed by id alone borrows its name too", () => {
|
|
721
|
+
expect(
|
|
722
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
723
|
+
{ vmId: "vm-1042" },
|
|
724
|
+
vmDatapoint,
|
|
725
|
+
).vmName,
|
|
726
|
+
).toBe("web-01");
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
test("a VM series never borrows a datastore", () => {
|
|
730
|
+
expect(
|
|
731
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
732
|
+
{ vmName: "web-01" },
|
|
733
|
+
{ ...vmDatapoint, datastoreName: "datastore-1" },
|
|
734
|
+
).datastoreName,
|
|
735
|
+
).toBeUndefined();
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
test("a host series borrows its cluster and datacenter, nothing below or beside it", () => {
|
|
739
|
+
expectSameIdentity(
|
|
740
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
741
|
+
{ hostName: "esx-01.lab" },
|
|
742
|
+
vmDatapoint,
|
|
743
|
+
),
|
|
744
|
+
{
|
|
745
|
+
datacenterName: "dc-east",
|
|
746
|
+
clusterName: "cluster-a",
|
|
747
|
+
hostName: "esx-01.lab",
|
|
748
|
+
},
|
|
749
|
+
);
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
/*
|
|
753
|
+
* The VMs in a pool can run on different hosts, so the host of one of
|
|
754
|
+
* them is not the pool's.
|
|
755
|
+
*/
|
|
756
|
+
test("a resource pool series borrows its cluster, datacenter and own path but never a host", () => {
|
|
757
|
+
const enriched: VMwareResourceIdentity =
|
|
758
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
759
|
+
{ resourcePoolName: "prod-pool" },
|
|
760
|
+
vmDatapoint,
|
|
761
|
+
);
|
|
762
|
+
|
|
763
|
+
/*
|
|
764
|
+
* The pool's inventory path is the same object as its name, so the
|
|
765
|
+
* series is titled the way the raw-scan list titles it.
|
|
766
|
+
*/
|
|
767
|
+
expectSameIdentity(enriched, {
|
|
768
|
+
datacenterName: "dc-east",
|
|
769
|
+
clusterName: "cluster-a",
|
|
770
|
+
resourcePoolName: "prod-pool",
|
|
771
|
+
resourcePoolPath: "/dc-east/host/cluster-a/Resources/prod-pool",
|
|
772
|
+
});
|
|
773
|
+
expect(enriched.hostName).toBeUndefined();
|
|
774
|
+
expect(enriched.vmName).toBeUndefined();
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
test("a pool series keyed by its inventory path never borrows a host either", () => {
|
|
778
|
+
expect(
|
|
779
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
780
|
+
{
|
|
781
|
+
resourcePoolPath: "/dc-east/host/cluster-a/Resources/prod-pool",
|
|
782
|
+
},
|
|
783
|
+
vmDatapoint,
|
|
784
|
+
).hostName,
|
|
785
|
+
).toBeUndefined();
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
test("a datastore series borrows only its datacenter", () => {
|
|
789
|
+
expectSameIdentity(
|
|
790
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
791
|
+
{ datastoreName: "datastore-1" },
|
|
792
|
+
{ datacenterName: "dc-east", clusterName: "cluster-a" },
|
|
793
|
+
),
|
|
794
|
+
{ datastoreName: "datastore-1", datacenterName: "dc-east" },
|
|
795
|
+
);
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
test("a cluster series borrows only its datacenter", () => {
|
|
799
|
+
expectSameIdentity(
|
|
800
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
801
|
+
{ clusterName: "cluster-a" },
|
|
802
|
+
vmDatapoint,
|
|
803
|
+
),
|
|
804
|
+
{ clusterName: "cluster-a", datacenterName: "dc-east" },
|
|
805
|
+
);
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
test("a datacenter series borrows nothing", () => {
|
|
809
|
+
expect(
|
|
810
|
+
PlatformResourceIdentity.withVMwareContext(
|
|
811
|
+
{ datacenterName: "dc-east" },
|
|
812
|
+
vmDatapoint,
|
|
813
|
+
),
|
|
814
|
+
).toEqual({ datacenterName: "dc-east" });
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
test("a datapoint that disagrees on any shared field is ignored", () => {
|
|
818
|
+
const disagreeing: Array<VMwareResourceIdentity> = [
|
|
819
|
+
{ vmName: "web-02" },
|
|
820
|
+
{ vmName: "web-01", vmId: "vm-9999" },
|
|
821
|
+
{ vmName: "web-01", hostName: "esx-02.lab" },
|
|
822
|
+
{ hostName: "esx-01.lab", clusterName: "cluster-b" },
|
|
823
|
+
{ resourcePoolName: "prod-pool", datacenterName: "dc-west" },
|
|
824
|
+
{ resourcePoolPath: "/elsewhere/prod-pool" },
|
|
825
|
+
];
|
|
826
|
+
|
|
827
|
+
for (const series of disagreeing) {
|
|
828
|
+
expect(
|
|
829
|
+
PlatformResourceIdentity.withVMwareContext(series, vmDatapoint),
|
|
830
|
+
).toBe(series);
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
describe("PlatformResourceIdentity.ceph", () => {
|
|
836
|
+
test("maps a daemon datapoint", () => {
|
|
837
|
+
const expected: ExpectedIdentity<CephResourceIdentity> = {
|
|
838
|
+
daemon: "osd.3",
|
|
839
|
+
poolId: undefined,
|
|
840
|
+
poolName: undefined,
|
|
841
|
+
hostname: "ceph-node-2",
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
expect(
|
|
845
|
+
PlatformResourceIdentity.ceph({
|
|
846
|
+
ceph_daemon: "osd.3",
|
|
847
|
+
hostname: "ceph-node-2",
|
|
848
|
+
device_class: "ssd",
|
|
849
|
+
}),
|
|
850
|
+
).toEqual(expected);
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
test("a numeric pool_id is stringified, like a string one", () => {
|
|
854
|
+
expectSameIdentity(
|
|
855
|
+
PlatformResourceIdentity.ceph({ pool_id: 7, name: "rbd" }),
|
|
856
|
+
{
|
|
857
|
+
poolId: "7",
|
|
858
|
+
poolName: "rbd",
|
|
859
|
+
},
|
|
860
|
+
);
|
|
861
|
+
expect(PlatformResourceIdentity.ceph({ pool_id: "7" }).poolId).toBe("7");
|
|
862
|
+
expect(PlatformResourceIdentity.ceph({ pool_id: 0 }).poolId).toBe("0");
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
test("the numeric and string pool ids key identically", () => {
|
|
866
|
+
expect(
|
|
867
|
+
PlatformResourceIdentity.cephKey(
|
|
868
|
+
PlatformResourceIdentity.ceph({ pool_id: 7, name: "rbd" }),
|
|
869
|
+
),
|
|
870
|
+
).toBe(
|
|
871
|
+
PlatformResourceIdentity.cephKey(
|
|
872
|
+
PlatformResourceIdentity.ceph({ pool_id: "7", name: "rbd" }),
|
|
873
|
+
),
|
|
874
|
+
);
|
|
875
|
+
expect(
|
|
876
|
+
PlatformResourceIdentity.cephKey({
|
|
877
|
+
daemon: "osd.3",
|
|
878
|
+
hostname: "ceph-node-2",
|
|
879
|
+
}),
|
|
880
|
+
).toBe("osd.3|||ceph-node-2");
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
test("a daemon series borrows the host it runs on", () => {
|
|
884
|
+
expectSameIdentity(
|
|
885
|
+
PlatformResourceIdentity.withCephContext(
|
|
886
|
+
{ daemon: "osd.3" },
|
|
887
|
+
PlatformResourceIdentity.ceph({
|
|
888
|
+
ceph_daemon: "osd.3",
|
|
889
|
+
hostname: "ceph-node-2",
|
|
890
|
+
}),
|
|
891
|
+
),
|
|
892
|
+
{ daemon: "osd.3", hostname: "ceph-node-2" },
|
|
893
|
+
);
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
test("a pool series borrows its name", () => {
|
|
897
|
+
expectSameIdentity(
|
|
898
|
+
PlatformResourceIdentity.withCephContext(
|
|
899
|
+
{ poolId: "7" },
|
|
900
|
+
PlatformResourceIdentity.ceph({ pool_id: 7, name: "rbd" }),
|
|
901
|
+
),
|
|
902
|
+
{ poolId: "7", poolName: "rbd" },
|
|
903
|
+
);
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
test("a series naming neither a daemon nor a pool borrows nothing", () => {
|
|
907
|
+
const series: CephResourceIdentity = { hostname: "ceph-node-2" };
|
|
908
|
+
|
|
909
|
+
expect(
|
|
910
|
+
PlatformResourceIdentity.withCephContext(series, {
|
|
911
|
+
daemon: "osd.3",
|
|
912
|
+
hostname: "ceph-node-2",
|
|
913
|
+
}),
|
|
914
|
+
).toBe(series);
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
test("a datapoint that disagrees on any shared field is ignored", () => {
|
|
918
|
+
const osd3: CephResourceIdentity = {
|
|
919
|
+
daemon: "osd.3",
|
|
920
|
+
hostname: "ceph-node-2",
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
const disagreeing: Array<CephResourceIdentity> = [
|
|
924
|
+
{ daemon: "osd.4" },
|
|
925
|
+
{ daemon: "osd.3", hostname: "ceph-node-1" },
|
|
926
|
+
{ poolId: "7", poolName: "cephfs_data" },
|
|
927
|
+
];
|
|
928
|
+
|
|
929
|
+
for (const series of disagreeing) {
|
|
930
|
+
expect(
|
|
931
|
+
PlatformResourceIdentity.withCephContext(series, {
|
|
932
|
+
...osd3,
|
|
933
|
+
poolId: "7",
|
|
934
|
+
poolName: "rbd",
|
|
935
|
+
}),
|
|
936
|
+
).toBe(series);
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
describe("PlatformResourceIdentity.dockerSwarm", () => {
|
|
942
|
+
const taskAttributes: JSONObject = {
|
|
943
|
+
"resource.container.name": "web.1.x7k2m9p4q1",
|
|
944
|
+
"resource.container.image.name": "nginx:1.25",
|
|
945
|
+
"docker.swarm.node.name": "worker-1",
|
|
946
|
+
"docker.swarm.service.name": "web",
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
test("maps the prefixed container keys and the swarm keys", () => {
|
|
950
|
+
const expected: ExpectedIdentity<DockerSwarmResourceIdentity> = {
|
|
951
|
+
containerName: "web.1.x7k2m9p4q1",
|
|
952
|
+
containerImage: "nginx:1.25",
|
|
953
|
+
nodeName: "worker-1",
|
|
954
|
+
serviceName: "web",
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
expect(PlatformResourceIdentity.dockerSwarm(taskAttributes)).toEqual(
|
|
958
|
+
expected,
|
|
959
|
+
);
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
test("the bare container keys are not where docker_stats puts identity", () => {
|
|
963
|
+
expectSameIdentity(
|
|
964
|
+
PlatformResourceIdentity.dockerSwarm({
|
|
965
|
+
"container.name": "web.1.x7k2m9p4q1",
|
|
966
|
+
"container.image.name": "nginx:1.25",
|
|
967
|
+
}),
|
|
968
|
+
{},
|
|
969
|
+
);
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
test("dockerSwarmKey joins container, image, node and service", () => {
|
|
973
|
+
expect(
|
|
974
|
+
PlatformResourceIdentity.dockerSwarmKey(
|
|
975
|
+
PlatformResourceIdentity.dockerSwarm(taskAttributes),
|
|
976
|
+
),
|
|
977
|
+
).toBe("web.1.x7k2m9p4q1|nginx:1.25|worker-1|web");
|
|
978
|
+
expect(
|
|
979
|
+
PlatformResourceIdentity.dockerSwarmKey({ serviceName: "web" }),
|
|
980
|
+
).toBe("|||web");
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
test("a container series borrows its image, node and service", () => {
|
|
984
|
+
expectSameIdentity(
|
|
985
|
+
PlatformResourceIdentity.withDockerSwarmContext(
|
|
986
|
+
{ containerName: "web.1.x7k2m9p4q1" },
|
|
987
|
+
PlatformResourceIdentity.dockerSwarm(taskAttributes),
|
|
988
|
+
),
|
|
989
|
+
{
|
|
990
|
+
containerName: "web.1.x7k2m9p4q1",
|
|
991
|
+
containerImage: "nginx:1.25",
|
|
992
|
+
nodeName: "worker-1",
|
|
993
|
+
serviceName: "web",
|
|
994
|
+
},
|
|
995
|
+
);
|
|
996
|
+
});
|
|
997
|
+
|
|
998
|
+
test("a service series or a node series borrows nothing", () => {
|
|
999
|
+
const context: DockerSwarmResourceIdentity =
|
|
1000
|
+
PlatformResourceIdentity.dockerSwarm(taskAttributes);
|
|
1001
|
+
const service: DockerSwarmResourceIdentity = { serviceName: "web" };
|
|
1002
|
+
const node: DockerSwarmResourceIdentity = { nodeName: "worker-1" };
|
|
1003
|
+
|
|
1004
|
+
expect(
|
|
1005
|
+
PlatformResourceIdentity.withDockerSwarmContext(service, context),
|
|
1006
|
+
).toBe(service);
|
|
1007
|
+
expect(PlatformResourceIdentity.withDockerSwarmContext(node, context)).toBe(
|
|
1008
|
+
node,
|
|
1009
|
+
);
|
|
1010
|
+
});
|
|
1011
|
+
|
|
1012
|
+
test("a datapoint that disagrees on any shared field is ignored", () => {
|
|
1013
|
+
const context: DockerSwarmResourceIdentity =
|
|
1014
|
+
PlatformResourceIdentity.dockerSwarm(taskAttributes);
|
|
1015
|
+
|
|
1016
|
+
const disagreeing: Array<DockerSwarmResourceIdentity> = [
|
|
1017
|
+
{ containerName: "web.2.aaaaaaaaaa" },
|
|
1018
|
+
{ containerName: "web.1.x7k2m9p4q1", containerImage: "nginx:1.24" },
|
|
1019
|
+
{ containerName: "web.1.x7k2m9p4q1", nodeName: "worker-2" },
|
|
1020
|
+
{ containerName: "web.1.x7k2m9p4q1", serviceName: "api" },
|
|
1021
|
+
];
|
|
1022
|
+
|
|
1023
|
+
for (const series of disagreeing) {
|
|
1024
|
+
expect(
|
|
1025
|
+
PlatformResourceIdentity.withDockerSwarmContext(series, context),
|
|
1026
|
+
).toBe(series);
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
});
|
|
1030
|
+
|
|
1031
|
+
describe("PlatformMetricUnitUtil.getPlatformForMonitorType", () => {
|
|
1032
|
+
const mapped: Array<[MonitorType, MetricCatalogPlatform]> = [
|
|
1033
|
+
[MonitorType.Kubernetes, "kubernetes"],
|
|
1034
|
+
[MonitorType.Proxmox, "proxmox"],
|
|
1035
|
+
[MonitorType.VMware, "vmware"],
|
|
1036
|
+
[MonitorType.DockerSwarm, "dockerSwarm"],
|
|
1037
|
+
[MonitorType.Ceph, "ceph"],
|
|
1038
|
+
[MonitorType.Docker, "docker"],
|
|
1039
|
+
[MonitorType.Podman, "podman"],
|
|
1040
|
+
[MonitorType.Host, "host"],
|
|
1041
|
+
[MonitorType.IoTDevice, "iot"],
|
|
1042
|
+
];
|
|
1043
|
+
|
|
1044
|
+
for (const [monitorType, platform] of mapped) {
|
|
1045
|
+
test(`${monitorType} reads the ${platform} catalog`, () => {
|
|
1046
|
+
expect(
|
|
1047
|
+
PlatformMetricUnitUtil.getPlatformForMonitorType(monitorType),
|
|
1048
|
+
).toBe(platform);
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
test("a generic Metrics monitor keeps the exporter's declared unit", () => {
|
|
1053
|
+
expect(
|
|
1054
|
+
PlatformMetricUnitUtil.getPlatformForMonitorType(MonitorType.Metrics),
|
|
1055
|
+
).toBeNull();
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
test("every other monitor type, and no type at all, has no catalog", () => {
|
|
1059
|
+
const platformTypes: Set<MonitorType> = new Set<MonitorType>(
|
|
1060
|
+
mapped.map((entry: [MonitorType, MetricCatalogPlatform]) => {
|
|
1061
|
+
return entry[0];
|
|
1062
|
+
}),
|
|
1063
|
+
);
|
|
1064
|
+
|
|
1065
|
+
for (const monitorType of Object.values(MonitorType)) {
|
|
1066
|
+
if (platformTypes.has(monitorType)) {
|
|
1067
|
+
continue;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
expect(
|
|
1071
|
+
PlatformMetricUnitUtil.getPlatformForMonitorType(monitorType),
|
|
1072
|
+
).toBeNull();
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
expect(
|
|
1076
|
+
PlatformMetricUnitUtil.getPlatformForMonitorType(undefined),
|
|
1077
|
+
).toBeNull();
|
|
1078
|
+
});
|
|
1079
|
+
});
|
|
1080
|
+
|
|
1081
|
+
describe("PlatformMetricUnitUtil.getCatalogUnit", () => {
|
|
1082
|
+
test("returns the unit exactly as the catalog spells it", () => {
|
|
1083
|
+
expect(
|
|
1084
|
+
PlatformMetricUnitUtil.getCatalogUnit({
|
|
1085
|
+
platform: "kubernetes",
|
|
1086
|
+
metricName: "k8s.node.memory.usage",
|
|
1087
|
+
}),
|
|
1088
|
+
).toBe("bytes");
|
|
1089
|
+
expect(
|
|
1090
|
+
PlatformMetricUnitUtil.getCatalogUnit({
|
|
1091
|
+
platform: "kubernetes",
|
|
1092
|
+
metricName: "k8s.node.cpu.utilization",
|
|
1093
|
+
}),
|
|
1094
|
+
).toBe("cores");
|
|
1095
|
+
expect(
|
|
1096
|
+
PlatformMetricUnitUtil.getCatalogUnit({
|
|
1097
|
+
platform: "host",
|
|
1098
|
+
metricName: "system.cpu.utilization",
|
|
1099
|
+
}),
|
|
1100
|
+
).toBe("ratio");
|
|
1101
|
+
expect(
|
|
1102
|
+
PlatformMetricUnitUtil.getCatalogUnit({
|
|
1103
|
+
platform: "kubernetes",
|
|
1104
|
+
metricName: "k8s.container.restarts",
|
|
1105
|
+
}),
|
|
1106
|
+
).toBe("count");
|
|
1107
|
+
expect(
|
|
1108
|
+
PlatformMetricUnitUtil.getCatalogUnit({
|
|
1109
|
+
platform: "docker",
|
|
1110
|
+
metricName: "container.cpu.utilization",
|
|
1111
|
+
}),
|
|
1112
|
+
).toBe("%");
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
test("undefined for a metric the catalog does not know", () => {
|
|
1116
|
+
expect(
|
|
1117
|
+
PlatformMetricUnitUtil.getCatalogUnit({
|
|
1118
|
+
platform: "kubernetes",
|
|
1119
|
+
metricName: "not.a.kubernetes.metric",
|
|
1120
|
+
}),
|
|
1121
|
+
).toBeUndefined();
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
test("undefined for a catalog entry whose unit is empty", () => {
|
|
1125
|
+
expect(
|
|
1126
|
+
PlatformMetricUnitUtil.getCatalogUnit({
|
|
1127
|
+
platform: "kubernetes",
|
|
1128
|
+
metricName: "k8s.pod.phase",
|
|
1129
|
+
}),
|
|
1130
|
+
).toBeUndefined();
|
|
1131
|
+
});
|
|
1132
|
+
|
|
1133
|
+
test("looks the metric up in the platform's OWN catalog", () => {
|
|
1134
|
+
// A Kubernetes metric is unknown to the Docker catalog.
|
|
1135
|
+
expect(
|
|
1136
|
+
PlatformMetricUnitUtil.getCatalogUnit({
|
|
1137
|
+
platform: "docker",
|
|
1138
|
+
metricName: "k8s.node.memory.usage",
|
|
1139
|
+
}),
|
|
1140
|
+
).toBeUndefined();
|
|
1141
|
+
});
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
describe("PlatformMetricUnitUtil.getMetricUnit", () => {
|
|
1145
|
+
/*
|
|
1146
|
+
* docker_stats declares "1" and sends 0–100. Taking the declared unit
|
|
1147
|
+
* renders 85.3 as "8530.00%" and makes a "%" threshold fire forever.
|
|
1148
|
+
*/
|
|
1149
|
+
test("the catalog's % beats docker_stats' declared '1'", () => {
|
|
1150
|
+
expect(
|
|
1151
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1152
|
+
platform: "docker",
|
|
1153
|
+
metricName: "container.cpu.utilization",
|
|
1154
|
+
declaredUnit: "1",
|
|
1155
|
+
}),
|
|
1156
|
+
).toBe("%");
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
test("the catalog's cores beats kubeletstats' declared '1'", () => {
|
|
1160
|
+
expect(
|
|
1161
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1162
|
+
platform: "kubernetes",
|
|
1163
|
+
metricName: "k8s.node.cpu.utilization",
|
|
1164
|
+
declaredUnit: "1",
|
|
1165
|
+
}),
|
|
1166
|
+
).toBe("cores");
|
|
1167
|
+
});
|
|
1168
|
+
|
|
1169
|
+
test("the catalog's 'ratio' becomes UCUM's '1', declared or not", () => {
|
|
1170
|
+
expect(
|
|
1171
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1172
|
+
platform: "host",
|
|
1173
|
+
metricName: "system.cpu.utilization",
|
|
1174
|
+
declaredUnit: "1",
|
|
1175
|
+
}),
|
|
1176
|
+
).toBe("1");
|
|
1177
|
+
expect(
|
|
1178
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1179
|
+
platform: "host",
|
|
1180
|
+
metricName: "system.cpu.utilization",
|
|
1181
|
+
}),
|
|
1182
|
+
).toBe("1");
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1185
|
+
test("the catalog's 'count' names no dimension and defers to the declared unit", () => {
|
|
1186
|
+
expect(
|
|
1187
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1188
|
+
platform: "kubernetes",
|
|
1189
|
+
metricName: "k8s.container.restarts",
|
|
1190
|
+
declaredUnit: "{restart}",
|
|
1191
|
+
}),
|
|
1192
|
+
).toBe("{restart}");
|
|
1193
|
+
expect(
|
|
1194
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1195
|
+
platform: "kubernetes",
|
|
1196
|
+
metricName: "k8s.container.restarts",
|
|
1197
|
+
}),
|
|
1198
|
+
).toBeUndefined();
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
test("a metric the catalog does not know keeps its declared unit", () => {
|
|
1202
|
+
expect(
|
|
1203
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1204
|
+
platform: "kubernetes",
|
|
1205
|
+
metricName: "my.custom.gauge",
|
|
1206
|
+
declaredUnit: "By",
|
|
1207
|
+
}),
|
|
1208
|
+
).toBe("By");
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
test("a catalog entry with an empty unit keeps the declared unit", () => {
|
|
1212
|
+
expect(
|
|
1213
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1214
|
+
platform: "kubernetes",
|
|
1215
|
+
metricName: "k8s.pod.phase",
|
|
1216
|
+
declaredUnit: "{phase}",
|
|
1217
|
+
}),
|
|
1218
|
+
).toBe("{phase}");
|
|
1219
|
+
});
|
|
1220
|
+
|
|
1221
|
+
test("no platform means the declared unit, even for a metric a catalog knows", () => {
|
|
1222
|
+
expect(
|
|
1223
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1224
|
+
platform: null,
|
|
1225
|
+
metricName: "container.cpu.utilization",
|
|
1226
|
+
declaredUnit: "1",
|
|
1227
|
+
}),
|
|
1228
|
+
).toBe("1");
|
|
1229
|
+
});
|
|
1230
|
+
|
|
1231
|
+
test("the declared unit is trimmed, and a blank one is no unit", () => {
|
|
1232
|
+
expect(
|
|
1233
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1234
|
+
platform: null,
|
|
1235
|
+
metricName: "my.custom.gauge",
|
|
1236
|
+
declaredUnit: " By ",
|
|
1237
|
+
}),
|
|
1238
|
+
).toBe("By");
|
|
1239
|
+
expect(
|
|
1240
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1241
|
+
platform: null,
|
|
1242
|
+
metricName: "my.custom.gauge",
|
|
1243
|
+
declaredUnit: " ",
|
|
1244
|
+
}),
|
|
1245
|
+
).toBeUndefined();
|
|
1246
|
+
});
|
|
1247
|
+
|
|
1248
|
+
test("nothing known means undefined", () => {
|
|
1249
|
+
expect(
|
|
1250
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1251
|
+
platform: null,
|
|
1252
|
+
metricName: "my.custom.gauge",
|
|
1253
|
+
}),
|
|
1254
|
+
).toBeUndefined();
|
|
1255
|
+
expect(
|
|
1256
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1257
|
+
platform: "kubernetes",
|
|
1258
|
+
metricName: "my.custom.gauge",
|
|
1259
|
+
declaredUnit: null,
|
|
1260
|
+
}),
|
|
1261
|
+
).toBeUndefined();
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1264
|
+
describe("the catalogs' English spellings, whatever their case", () => {
|
|
1265
|
+
afterEach(() => {
|
|
1266
|
+
jest.restoreAllMocks();
|
|
1267
|
+
});
|
|
1268
|
+
|
|
1269
|
+
const spellings: Array<[string, string | undefined]> = [
|
|
1270
|
+
["fraction", "1"],
|
|
1271
|
+
["Fraction", "1"],
|
|
1272
|
+
["RATIO", "1"],
|
|
1273
|
+
["counts", undefined],
|
|
1274
|
+
["Count", undefined],
|
|
1275
|
+
[" bytes ", "bytes"],
|
|
1276
|
+
];
|
|
1277
|
+
|
|
1278
|
+
for (const [catalogUnit, expected] of spellings) {
|
|
1279
|
+
test(`catalog unit '${catalogUnit}' resolves to ${String(expected)}`, () => {
|
|
1280
|
+
jest
|
|
1281
|
+
.spyOn(HostMetricCatalog, "getHostMetricByMetricName")
|
|
1282
|
+
.mockReturnValue({
|
|
1283
|
+
id: "test-metric",
|
|
1284
|
+
friendlyName: "Test Metric",
|
|
1285
|
+
description: "A metric the test injects into the host catalog.",
|
|
1286
|
+
metricName: "test.metric",
|
|
1287
|
+
category: "CPU",
|
|
1288
|
+
defaultAggregation:
|
|
1289
|
+
HostMetricCatalog.getAllHostMetrics()[0]!.defaultAggregation,
|
|
1290
|
+
unit: catalogUnit,
|
|
1291
|
+
} as HostMetricCatalog.HostMetricDefinition);
|
|
1292
|
+
|
|
1293
|
+
expect(
|
|
1294
|
+
PlatformMetricUnitUtil.getMetricUnit({
|
|
1295
|
+
platform: "host",
|
|
1296
|
+
metricName: "test.metric",
|
|
1297
|
+
}),
|
|
1298
|
+
).toBe(expected);
|
|
1299
|
+
});
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1302
|
+
});
|
|
1303
|
+
|
|
1304
|
+
describe("PlatformMetricUnitUtil.buildUnitsByMetricName", () => {
|
|
1305
|
+
test("one lowercased entry per metric with a known unit", () => {
|
|
1306
|
+
const declared: Map<string, string> = new Map<string, string>([
|
|
1307
|
+
["k8s.node.cpu.utilization", "1"],
|
|
1308
|
+
["k8s.container.restarts", "{restart}"],
|
|
1309
|
+
["k8s.node.allocatable_memory", "By"],
|
|
1310
|
+
["my.custom.latency", "ms"],
|
|
1311
|
+
]);
|
|
1312
|
+
|
|
1313
|
+
const units: Dictionary<string> =
|
|
1314
|
+
PlatformMetricUnitUtil.buildUnitsByMetricName({
|
|
1315
|
+
platform: "kubernetes",
|
|
1316
|
+
metricNames: [
|
|
1317
|
+
"k8s.node.memory.usage",
|
|
1318
|
+
"k8s.node.cpu.utilization",
|
|
1319
|
+
"k8s.container.restarts",
|
|
1320
|
+
"k8s.node.allocatable_memory",
|
|
1321
|
+
"My.Custom.Latency",
|
|
1322
|
+
"no.unit.anywhere",
|
|
1323
|
+
"",
|
|
1324
|
+
],
|
|
1325
|
+
declaredUnitsByMetricName: declared,
|
|
1326
|
+
});
|
|
1327
|
+
|
|
1328
|
+
expect(units).toEqual({
|
|
1329
|
+
"k8s.node.memory.usage": "bytes",
|
|
1330
|
+
"k8s.node.cpu.utilization": "cores",
|
|
1331
|
+
"k8s.container.restarts": "{restart}",
|
|
1332
|
+
"k8s.node.allocatable_memory": "bytes",
|
|
1333
|
+
"my.custom.latency": "ms",
|
|
1334
|
+
});
|
|
1335
|
+
});
|
|
1336
|
+
|
|
1337
|
+
test("metrics with no known unit are left out, not mapped to ''", () => {
|
|
1338
|
+
const units: Dictionary<string> =
|
|
1339
|
+
PlatformMetricUnitUtil.buildUnitsByMetricName({
|
|
1340
|
+
platform: "kubernetes",
|
|
1341
|
+
metricNames: ["k8s.container.restarts", "k8s.pod.phase"],
|
|
1342
|
+
declaredUnitsByMetricName: new Map<string, string>(),
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1345
|
+
expect(units).toEqual({});
|
|
1346
|
+
expect(Object.keys(units)).not.toContain("k8s.container.restarts");
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
test("the declared-unit map is read with the lowercased name", () => {
|
|
1350
|
+
const units: Dictionary<string> =
|
|
1351
|
+
PlatformMetricUnitUtil.buildUnitsByMetricName({
|
|
1352
|
+
platform: null,
|
|
1353
|
+
metricNames: ["Custom.Metric"],
|
|
1354
|
+
declaredUnitsByMetricName: new Map<string, string>([
|
|
1355
|
+
["custom.metric", "By"],
|
|
1356
|
+
]),
|
|
1357
|
+
});
|
|
1358
|
+
|
|
1359
|
+
expect(units).toEqual({ "custom.metric": "By" });
|
|
1360
|
+
});
|
|
1361
|
+
|
|
1362
|
+
test("without a platform every entry is the declared unit", () => {
|
|
1363
|
+
const units: Dictionary<string> =
|
|
1364
|
+
PlatformMetricUnitUtil.buildUnitsByMetricName({
|
|
1365
|
+
platform: null,
|
|
1366
|
+
metricNames: ["container.cpu.utilization", "k8s.node.cpu.utilization"],
|
|
1367
|
+
declaredUnitsByMetricName: new Map<string, string>([
|
|
1368
|
+
["container.cpu.utilization", "1"],
|
|
1369
|
+
["k8s.node.cpu.utilization", "1"],
|
|
1370
|
+
]),
|
|
1371
|
+
});
|
|
1372
|
+
|
|
1373
|
+
expect(units).toEqual({
|
|
1374
|
+
"container.cpu.utilization": "1",
|
|
1375
|
+
"k8s.node.cpu.utilization": "1",
|
|
1376
|
+
});
|
|
1377
|
+
});
|
|
1378
|
+
});
|
|
1379
|
+
|
|
1380
|
+
describe("PlatformMetricUnitUtil × MetricValueFormatter over every catalog entry", () => {
|
|
1381
|
+
type CatalogEntry = {
|
|
1382
|
+
platform: MetricCatalogPlatform;
|
|
1383
|
+
metricName: string;
|
|
1384
|
+
unit?: string | undefined;
|
|
1385
|
+
};
|
|
1386
|
+
|
|
1387
|
+
const catalogEntries: Array<CatalogEntry> = [
|
|
1388
|
+
...getAllKubernetesMetrics().map(
|
|
1389
|
+
(m: { metricName: string; unit?: string }) => {
|
|
1390
|
+
return { platform: "kubernetes" as MetricCatalogPlatform, ...m };
|
|
1391
|
+
},
|
|
1392
|
+
),
|
|
1393
|
+
...getAllProxmoxMetrics().map(
|
|
1394
|
+
(m: { metricName: string; unit?: string }) => {
|
|
1395
|
+
return { platform: "proxmox" as MetricCatalogPlatform, ...m };
|
|
1396
|
+
},
|
|
1397
|
+
),
|
|
1398
|
+
...getAllVMwareMetrics().map((m: { metricName: string; unit?: string }) => {
|
|
1399
|
+
return { platform: "vmware" as MetricCatalogPlatform, ...m };
|
|
1400
|
+
}),
|
|
1401
|
+
...getAllDockerSwarmMetrics().map(
|
|
1402
|
+
(m: { metricName: string; unit?: string }) => {
|
|
1403
|
+
return { platform: "dockerSwarm" as MetricCatalogPlatform, ...m };
|
|
1404
|
+
},
|
|
1405
|
+
),
|
|
1406
|
+
...getAllCephMetrics().map((m: { metricName: string; unit?: string }) => {
|
|
1407
|
+
return { platform: "ceph" as MetricCatalogPlatform, ...m };
|
|
1408
|
+
}),
|
|
1409
|
+
...getAllDockerMetrics().map((m: { metricName: string; unit?: string }) => {
|
|
1410
|
+
return { platform: "docker" as MetricCatalogPlatform, ...m };
|
|
1411
|
+
}),
|
|
1412
|
+
...getAllPodmanMetrics().map((m: { metricName: string; unit?: string }) => {
|
|
1413
|
+
return { platform: "podman" as MetricCatalogPlatform, ...m };
|
|
1414
|
+
}),
|
|
1415
|
+
...HostMetricCatalog.getAllHostMetrics().map(
|
|
1416
|
+
(m: { metricName: string; unit?: string }) => {
|
|
1417
|
+
return { platform: "host" as MetricCatalogPlatform, ...m };
|
|
1418
|
+
},
|
|
1419
|
+
),
|
|
1420
|
+
...getAllIoTMetrics().map((m: { metricName: string; unit?: string }) => {
|
|
1421
|
+
return { platform: "iot" as MetricCatalogPlatform, ...m };
|
|
1422
|
+
}),
|
|
1423
|
+
];
|
|
1424
|
+
|
|
1425
|
+
test("every platform catalog contributes entries", () => {
|
|
1426
|
+
const platforms: Set<MetricCatalogPlatform> = new Set(
|
|
1427
|
+
catalogEntries.map((entry: CatalogEntry) => {
|
|
1428
|
+
return entry.platform;
|
|
1429
|
+
}),
|
|
1430
|
+
);
|
|
1431
|
+
|
|
1432
|
+
expect(platforms.size).toBe(9);
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
test("every entry formats a large value without NaN or undefined", () => {
|
|
1436
|
+
const failures: Array<string> = [];
|
|
1437
|
+
|
|
1438
|
+
for (const entry of catalogEntries) {
|
|
1439
|
+
const unit: string | undefined = PlatformMetricUnitUtil.getMetricUnit({
|
|
1440
|
+
platform: entry.platform,
|
|
1441
|
+
metricName: entry.metricName,
|
|
1442
|
+
});
|
|
1443
|
+
|
|
1444
|
+
let rendered: string;
|
|
1445
|
+
|
|
1446
|
+
try {
|
|
1447
|
+
rendered = MetricValueFormatter.format({
|
|
1448
|
+
value: 123456789,
|
|
1449
|
+
unit: unit,
|
|
1450
|
+
metricName: entry.metricName,
|
|
1451
|
+
});
|
|
1452
|
+
} catch (error) {
|
|
1453
|
+
failures.push(
|
|
1454
|
+
`${entry.platform} ${entry.metricName} (${String(unit)}) threw ${String(error)}`,
|
|
1455
|
+
);
|
|
1456
|
+
continue;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
if (
|
|
1460
|
+
!rendered ||
|
|
1461
|
+
rendered.includes("NaN") ||
|
|
1462
|
+
rendered.includes("undefined")
|
|
1463
|
+
) {
|
|
1464
|
+
failures.push(
|
|
1465
|
+
`${entry.platform} ${entry.metricName} (${String(unit)}) → "${rendered}"`,
|
|
1466
|
+
);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
expect(failures).toEqual([]);
|
|
1471
|
+
});
|
|
1472
|
+
|
|
1473
|
+
test("every catalog unit resolves to a unit or to nothing — never to ''", () => {
|
|
1474
|
+
for (const entry of catalogEntries) {
|
|
1475
|
+
const unit: string | undefined = PlatformMetricUnitUtil.getMetricUnit({
|
|
1476
|
+
platform: entry.platform,
|
|
1477
|
+
metricName: entry.metricName,
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
expect(unit === undefined || unit.trim().length > 0).toBe(true);
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
|
|
1484
|
+
/*
|
|
1485
|
+
* "ratio" becomes "1", and "1" only renders as a percentage on a metric
|
|
1486
|
+
* whose NAME says it is a fraction. A ratio entry whose name did not
|
|
1487
|
+
* would print 0.5 bare instead of "50.00%".
|
|
1488
|
+
*/
|
|
1489
|
+
test("every catalog 'ratio' metric renders as a percentage", () => {
|
|
1490
|
+
const ratioEntries: Array<CatalogEntry> = catalogEntries.filter(
|
|
1491
|
+
(entry: CatalogEntry) => {
|
|
1492
|
+
return (entry.unit || "").trim().toLowerCase() === "ratio";
|
|
1493
|
+
},
|
|
1494
|
+
);
|
|
1495
|
+
|
|
1496
|
+
expect(ratioEntries.length).toBeGreaterThan(0);
|
|
1497
|
+
|
|
1498
|
+
for (const entry of ratioEntries) {
|
|
1499
|
+
expect(
|
|
1500
|
+
MetricValueFormatter.format({
|
|
1501
|
+
value: 0.5,
|
|
1502
|
+
unit: PlatformMetricUnitUtil.getMetricUnit({
|
|
1503
|
+
platform: entry.platform,
|
|
1504
|
+
metricName: entry.metricName,
|
|
1505
|
+
}),
|
|
1506
|
+
metricName: entry.metricName,
|
|
1507
|
+
}),
|
|
1508
|
+
).toBe("50.00%");
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
|
|
1512
|
+
test("every catalog '%' metric renders as the percentage it already is", () => {
|
|
1513
|
+
const percentEntries: Array<CatalogEntry> = catalogEntries.filter(
|
|
1514
|
+
(entry: CatalogEntry) => {
|
|
1515
|
+
return (entry.unit || "").trim() === "%";
|
|
1516
|
+
},
|
|
1517
|
+
);
|
|
1518
|
+
|
|
1519
|
+
expect(percentEntries.length).toBeGreaterThan(0);
|
|
1520
|
+
|
|
1521
|
+
for (const entry of percentEntries) {
|
|
1522
|
+
expect(
|
|
1523
|
+
MetricValueFormatter.format({
|
|
1524
|
+
value: 85.3,
|
|
1525
|
+
unit: PlatformMetricUnitUtil.getMetricUnit({
|
|
1526
|
+
platform: entry.platform,
|
|
1527
|
+
metricName: entry.metricName,
|
|
1528
|
+
declaredUnit: "1",
|
|
1529
|
+
}),
|
|
1530
|
+
metricName: entry.metricName,
|
|
1531
|
+
}),
|
|
1532
|
+
).toBe("85.30%");
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
test("every catalog byte metric renders on the decimal byte ladder", () => {
|
|
1537
|
+
const byteEntries: Array<CatalogEntry> = catalogEntries.filter(
|
|
1538
|
+
(entry: CatalogEntry) => {
|
|
1539
|
+
const unit: string = (entry.unit || "").trim();
|
|
1540
|
+
return unit === "bytes" || unit === "By";
|
|
1541
|
+
},
|
|
1542
|
+
);
|
|
1543
|
+
|
|
1544
|
+
expect(byteEntries.length).toBeGreaterThan(0);
|
|
1545
|
+
|
|
1546
|
+
for (const entry of byteEntries) {
|
|
1547
|
+
expect(
|
|
1548
|
+
MetricValueFormatter.format({
|
|
1549
|
+
value: 257760964608,
|
|
1550
|
+
unit: PlatformMetricUnitUtil.getMetricUnit({
|
|
1551
|
+
platform: entry.platform,
|
|
1552
|
+
metricName: entry.metricName,
|
|
1553
|
+
}),
|
|
1554
|
+
metricName: entry.metricName,
|
|
1555
|
+
}),
|
|
1556
|
+
).toBe("258 GB");
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
});
|