@oneuptime/common 12.0.34 → 13.0.0
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/GlobalConfig.ts +12 -12
- package/Models/DatabaseModels/InventoryItem.ts +44 -1
- package/Models/DatabaseModels/NetworkDevice.ts +126 -0
- package/Server/EnvironmentConfig.ts +47 -16
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791700000000-AddMacAddressToNetworkDevice.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Infrastructure/Redis.ts +8 -8
- package/Server/Infrastructure/Status.ts +10 -4
- package/Server/Services/DatabaseService.ts +65 -13
- package/Server/Services/InventoryItemService.ts +31 -1
- package/Server/Services/MonitorTemplateService.ts +140 -19
- package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +349 -41
- package/Server/Services/NetworkDeviceDiscoveryScanService.ts +87 -2
- package/Server/Services/NetworkDeviceService.ts +69 -0
- package/Server/Services/UserNotificationRuleService.ts +76 -25
- package/Server/Types/Database/Permissions/ReadPermission.ts +45 -5
- package/Server/Types/Database/QueryUtil.ts +56 -0
- package/Server/Types/Markdown.ts +93 -1
- package/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.ts +82 -17
- package/Server/Utils/EmailRollup/EmailRollupFlushRunner.ts +10 -1
- package/Server/Utils/EmailRollup/EmailRollupRenderer.ts +2 -2
- package/Server/Utils/Monitor/Criteria/CompareCriteria.ts +82 -35
- package/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.ts +31 -5
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +202 -37
- package/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.ts +82 -9
- package/Server/Utils/Monitor/MonitorCriteriaMessageBuilder.ts +16 -7
- package/Server/Utils/Monitor/MonitorCriteriaMessageFormatter.ts +29 -17
- package/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.ts +107 -48
- package/Server/Utils/Monitor/NetworkDeviceMacLearningUtil.ts +158 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +27 -0
- package/Server/Utils/Telemetry/EntityRegistry.ts +11 -1
- package/Server/Utils/Telemetry/TelemetryEntity.ts +83 -9
- package/Tests/App/Dashboard/AddNeighborToMonitoringModal.test.tsx +32 -0
- package/Tests/App/Dashboard/AdoptedDeviceDrawer.test.tsx +374 -0
- package/Tests/App/Dashboard/DashboardLabelVariables.test.tsx +580 -0
- package/Tests/App/Dashboard/DashboardMonitorLabelVariable.test.tsx +438 -0
- package/Tests/App/Dashboard/DashboardVariableAllContract.test.tsx +5 -2
- package/Tests/App/Dashboard/DeviceAttachmentCard.test.tsx +273 -0
- package/Tests/App/Dashboard/DiscoveryReviewInventoryRefresh.test.tsx +505 -0
- package/Tests/App/Dashboard/EntityDetailPanel.test.tsx +163 -0
- package/Tests/App/Dashboard/InfrastructureExplorer.test.tsx +401 -0
- package/Tests/App/Dashboard/InfrastructureGraph.test.tsx +232 -0
- package/Tests/App/Dashboard/InventoryItems.test.tsx +201 -0
- package/Tests/App/Dashboard/InventoryTypeAndStatusFacets.test.tsx +798 -0
- package/Tests/App/Dashboard/NetworkTopologyLiveView.test.tsx +320 -0
- package/Tests/App/Dashboard/NetworkTopologyToolbar.test.tsx +275 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedEmptyState.test.tsx +975 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedPlanGate.test.tsx +63 -0
- package/Tests/App/Dashboard/ServiceMapGraph.test.tsx +626 -0
- package/Tests/App/Dashboard/TopologyDataLoading.test.tsx +348 -0
- package/Tests/App/Dashboard/TopologyPageNavigation.test.tsx +331 -0
- package/Tests/App/Dashboard/UserSettingsEmailPreferences.test.tsx +603 -0
- package/Tests/App/Dashboard/UserSettingsNotificationSettings.test.tsx +324 -0
- package/Tests/App/PublicDashboard/DashboardVariableSelector.test.tsx +13 -4
- package/Tests/App/StatusPage/StatusPageOidcOrigin.test.tsx +223 -0
- package/Tests/Models/InventoryItemStatus.test.ts +147 -0
- package/Tests/Models/NetworkDeviceMacAddressColumn.test.ts +294 -0
- package/Tests/Server/API/DashboardPublicResourceListAPI.test.ts +129 -0
- package/Tests/Server/EnvironmentConfigValkey.test.ts +227 -0
- package/Tests/Server/Infrastructure/Postgres/AddMacAddressToNetworkDeviceMigration.test.ts +365 -0
- package/Tests/Server/Infrastructure/Postgres/CustomFieldValueMappingMigration.test.ts +62 -23
- package/Tests/Server/Infrastructure/ValkeyDeploymentConfig.test.ts +265 -0
- package/Tests/Server/Middleware/HttpMetricsMiddleware.test.ts +382 -0
- package/Tests/Server/Middleware/SCIMAuthorization.test.ts +525 -0
- package/Tests/Server/Services/DatabaseServiceAggregateBy.test.ts +291 -56
- package/Tests/Server/Services/DatabaseServiceSortTiebreaker.test.ts +151 -0
- package/Tests/Server/Services/InventoryItemManualCreate.test.ts +105 -0
- package/Tests/Server/Services/InventoryItemPromotionGate.test.ts +178 -0
- package/Tests/Server/Services/MonitorTemplateServiceCustomFieldSync.test.ts +502 -0
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +1133 -81
- package/Tests/Server/Services/NetworkDeviceDiscoveryScanRegistration.test.ts +520 -0
- package/Tests/Server/Services/NetworkDeviceMacAddressNormalization.test.ts +572 -0
- package/Tests/Server/Types/Database/InventoryStatusPostgres.test.ts +368 -0
- package/Tests/Server/Types/Database/Permissions/ReadBlockPermission.test.ts +261 -14
- package/Tests/Server/Types/Database/QueryUtilIncludesAnyOfGroups.test.ts +169 -0
- package/Tests/Server/Types/Database/QueryUtilIncludesAnyOfGroupsPostgres.test.ts +297 -0
- package/Tests/Server/Types/Markdown.test.ts +194 -1
- package/Tests/Server/Types/Workflow/Components/IncomingWebhookUtils.test.ts +279 -0
- package/Tests/Server/Types/Workflow/Components/TextToJson.test.ts +212 -0
- package/Tests/Server/Utils/CustomField/CustomFieldMappingRegistry.test.ts +436 -0
- package/Tests/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.test.ts +214 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupFlushRunnerBehaviour.test.ts +1 -1
- package/Tests/Server/Utils/EmailRollup/EmailRollupRenderer.test.ts +10 -3
- package/Tests/Server/Utils/EventLoop.test.ts +359 -0
- package/Tests/Server/Utils/JsonWebToken.test.ts +30 -0
- package/Tests/Server/Utils/Monitor/Criteria/CompareCriteria.test.ts +242 -0
- package/Tests/Server/Utils/Monitor/Criteria/CompareCriteriaAggregation.test.ts +13 -7
- package/Tests/Server/Utils/Monitor/Criteria/DatabaseMonitorCriteria.test.ts +29 -0
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.ts +30 -6
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteriaAnomalyUnits.test.ts +246 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEmailEvalLogAgreement.test.ts +280 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +224 -10
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorMetricUnits.test.ts +570 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaExpectationBuilderUnits.test.ts +30 -5
- package/Tests/Server/Utils/Monitor/MonitorCriteriaMessageBuilderUnits.test.ts +68 -21
- package/Tests/Server/Utils/Monitor/MonitorCriteriaObservationBuilderUnits.test.ts +36 -19
- package/Tests/Server/Utils/Monitor/NetworkDeviceMacLearningUtil.test.ts +573 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +317 -0
- package/Tests/Server/Utils/Telemetry/ContextSpanProcessor.test.ts +281 -0
- package/Tests/Server/Utils/Telemetry/InventoryDuplicateIdentity.test.ts +316 -0
- package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +111 -8
- package/Tests/Types/Database/IncludesAnyOfGroups.test.ts +106 -0
- package/Tests/Types/JSONFunctions.test.ts +40 -0
- package/Tests/Types/NetworkAutomation/AutoImportRunMerge.test.ts +235 -0
- package/Tests/Types/NetworkAutomation/RuleRunResult.test.ts +66 -0
- package/Tests/Types/NetworkAutomation/RuleRunResultDescribe.test.ts +309 -1
- package/Tests/Types/Telemetry/InventoryLiveness.test.ts +99 -0
- package/Tests/UI/Components/CustomFields/CustomFieldsDetail.test.tsx +160 -0
- package/Tests/UI/ReactRouterSingletonBuild.test.ts +133 -0
- package/Tests/UI/Rum/ReplayHeader.test.tsx +10 -2
- package/Tests/UI/Rum/ReplayPlayerChrome.test.tsx +514 -0
- package/Tests/UI/Rum/ReplayTimeFormat.test.ts +94 -0
- package/Tests/UI/Rum/ReplayUi.test.tsx +559 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +5 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +1 -0
- package/Tests/Utils/Dashboard/Components/DashboardMonitorListComponent.test.ts +11 -1
- package/Tests/Utils/Dashboard/LabelVariable.test.ts +257 -0
- package/Tests/Utils/Dashboard/VariableUrlState.test.ts +144 -14
- package/Tests/Utils/MetricUnitUtil.test.ts +81 -0
- package/Tests/Utils/Monitor/DeviceMacLearningUtil.test.ts +497 -0
- package/Tests/Utils/Monitor/MetricValueFormatter.test.ts +546 -0
- package/Tests/Utils/Monitor/MonitorTemplateCustomFieldUtil.test.ts +218 -0
- package/Tests/Utils/Monitor/NetworkTopologyEndpointAdoption.test.ts +1755 -0
- package/Tests/Utils/NetworkAutomation/AutoImportRunChain.test.ts +320 -0
- package/Types/BaseDatabase/IncludesAnyOfGroups.ts +77 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardMonitorListComponent.ts +1 -0
- package/Types/Dashboard/DashboardVariable.ts +8 -0
- package/Types/JSON.ts +4 -0
- package/Types/JSONFunctions.ts +16 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +13 -0
- package/Types/NetworkAutomation/RuleRunResult.ts +402 -13
- package/Types/SerializableObjectDictionary.ts +4 -0
- package/Types/Telemetry/InventoryLiveness.ts +56 -0
- package/UI/Components/CSVFileUpload/CSVFileUpload.tsx +9 -2
- package/UI/Components/CustomFields/CustomFieldsDetail.tsx +46 -21
- package/UI/Components/Dashboard/DashboardVariableControl.tsx +285 -0
- package/UI/esbuild-config.js +6 -0
- package/Utils/Dashboard/Components/DashboardMonitorListComponent.ts +12 -1
- package/Utils/Dashboard/LabelVariable.ts +152 -0
- package/Utils/Dashboard/VariableUrlState.ts +27 -5
- package/Utils/MetricUnitUtil.ts +34 -0
- package/Utils/Monitor/DeviceMacLearningUtil.ts +177 -0
- package/Utils/Monitor/MetricValueFormatter.ts +342 -0
- package/Utils/Monitor/MonitorTemplateCustomFieldUtil.ts +124 -0
- package/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.ts +7 -2
- package/Utils/Monitor/NetworkTopologyUtil.ts +693 -0
- package/Utils/NetworkAutomation/AutoImportRunChain.ts +138 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +12 -12
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/InventoryItem.js +34 -1
- package/build/dist/Models/DatabaseModels/InventoryItem.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +128 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +44 -12
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791700000000-AddMacAddressToNetworkDevice.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791700000000-AddMacAddressToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Redis.js +8 -8
- package/build/dist/Server/Infrastructure/Redis.js.map +1 -1
- package/build/dist/Server/Infrastructure/Status.js +10 -4
- package/build/dist/Server/Infrastructure/Status.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +58 -13
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/InventoryItemService.js +28 -1
- package/build/dist/Server/Services/InventoryItemService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +116 -17
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +270 -37
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +65 -0
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceService.js +54 -0
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +60 -25
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/ReadPermission.js +29 -4
- package/build/dist/Server/Types/Database/Permissions/ReadPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryUtil.js +36 -0
- package/build/dist/Server/Types/Database/QueryUtil.js.map +1 -1
- package/build/dist/Server/Types/Markdown.js +75 -0
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.js +53 -18
- package/build/dist/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.js.map +1 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js +10 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js.map +1 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupRenderer.js +2 -2
- package/build/dist/Server/Utils/EmailRollup/EmailRollupRenderer.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js +58 -35
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js +29 -5
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +166 -35
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.js +58 -9
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaMessageBuilder.js +9 -3
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaMessageBuilder.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaMessageFormatter.js +26 -12
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaMessageFormatter.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js +74 -33
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMacLearningUtil.js +114 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMacLearningUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +25 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +9 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +70 -13
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Types/BaseDatabase/IncludesAnyOfGroups.js +54 -0
- package/build/dist/Types/BaseDatabase/IncludesAnyOfGroups.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardVariable.js +1 -0
- package/build/dist/Types/Dashboard/DashboardVariable.js.map +1 -1
- package/build/dist/Types/JSON.js +1 -0
- package/build/dist/Types/JSON.js.map +1 -1
- package/build/dist/Types/JSONFunctions.js +13 -0
- package/build/dist/Types/JSONFunctions.js.map +1 -1
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js +291 -6
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -1
- package/build/dist/Types/SerializableObjectDictionary.js +4 -0
- package/build/dist/Types/SerializableObjectDictionary.js.map +1 -1
- package/build/dist/Types/Telemetry/InventoryLiveness.js +37 -0
- package/build/dist/Types/Telemetry/InventoryLiveness.js.map +1 -0
- package/build/dist/UI/Components/CSVFileUpload/CSVFileUpload.js +7 -0
- package/build/dist/UI/Components/CSVFileUpload/CSVFileUpload.js.map +1 -1
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js +9 -2
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js.map +1 -1
- package/build/dist/UI/Components/Dashboard/DashboardVariableControl.js +137 -0
- package/build/dist/UI/Components/Dashboard/DashboardVariableControl.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardMonitorListComponent.js +9 -1
- package/build/dist/Utils/Dashboard/Components/DashboardMonitorListComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/LabelVariable.js +96 -0
- package/build/dist/Utils/Dashboard/LabelVariable.js.map +1 -0
- package/build/dist/Utils/Dashboard/VariableUrlState.js +19 -4
- package/build/dist/Utils/Dashboard/VariableUrlState.js.map +1 -1
- package/build/dist/Utils/MetricUnitUtil.js +26 -0
- package/build/dist/Utils/MetricUnitUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/DeviceMacLearningUtil.js +112 -0
- package/build/dist/Utils/Monitor/DeviceMacLearningUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/MetricValueFormatter.js +276 -0
- package/build/dist/Utils/Monitor/MetricValueFormatter.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorTemplateCustomFieldUtil.js +101 -0
- package/build/dist/Utils/Monitor/MonitorTemplateCustomFieldUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js +7 -2
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +484 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkAutomation/AutoImportRunChain.js +59 -0
- package/build/dist/Utils/NetworkAutomation/AutoImportRunChain.js.map +1 -0
- package/jest.config.json +2 -0
- package/package.json +1 -1
- package/test-setup.sh +9 -9
- package/tsconfig.json +51 -11
- package/Tests/App/Dashboard/NotificationEmailPreferences.test.tsx +0 -399
|
@@ -116,9 +116,9 @@ describe("MonitorCriteriaMessageBuilder — metric unit labelling", () => {
|
|
|
116
116
|
});
|
|
117
117
|
|
|
118
118
|
// Observed value carries the unit.
|
|
119
|
-
expect(message).toContain("latest
|
|
120
|
-
expect(message).toContain("min
|
|
121
|
-
expect(message).toContain("max
|
|
119
|
+
expect(message).toContain("latest 60 ms");
|
|
120
|
+
expect(message).toContain("min 60 ms");
|
|
121
|
+
expect(message).toContain("max 60 ms");
|
|
122
122
|
// Threshold in the expectation clause carries the same unit.
|
|
123
123
|
expect(message).toContain("greater than 5 sec");
|
|
124
124
|
});
|
|
@@ -150,11 +150,20 @@ describe("MonitorCriteriaMessageBuilder — metric unit labelling", () => {
|
|
|
150
150
|
matchMessage: null,
|
|
151
151
|
});
|
|
152
152
|
|
|
153
|
-
expect(message).toContain("latest
|
|
153
|
+
expect(message).toContain("latest 500 ms");
|
|
154
154
|
expect(message).toContain("greater than 2 sec");
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
/*
|
|
158
|
+
* A ratio metric carries OTel's dimensionless "1" over samples that are
|
|
159
|
+
* fractions in [0, 1]. Printing "0.06 1" is meaningless and printing a
|
|
160
|
+
* bare "0.06" reads as 0.06% when the value is 6%.
|
|
161
|
+
*
|
|
162
|
+
* The fired-alert email has rendered this as "6.00%" since CompareCriteria
|
|
163
|
+
* adopted MetricValueFormatter; this line — the monitor's own evaluation
|
|
164
|
+
* log for the SAME sample — used to say "0.06". Both now agree.
|
|
165
|
+
*/
|
|
166
|
+
test("renders a dimensionless ratio metric as the percentage it means", () => {
|
|
158
167
|
const criteriaFilter: CriteriaFilter = {
|
|
159
168
|
checkOn: CheckOn.MetricValue,
|
|
160
169
|
filterType: FilterType.GreaterThan,
|
|
@@ -179,12 +188,50 @@ describe("MonitorCriteriaMessageBuilder — metric unit labelling", () => {
|
|
|
179
188
|
matchMessage: null,
|
|
180
189
|
});
|
|
181
190
|
|
|
182
|
-
expect(message).toContain("latest
|
|
183
|
-
//
|
|
191
|
+
expect(message).toContain("latest 6.00%");
|
|
192
|
+
// Never the dimensionless marker, and never the unscaled fraction.
|
|
184
193
|
expect(message).not.toContain("0.06 1");
|
|
185
|
-
expect(message).toContain("
|
|
194
|
+
expect(message).not.toContain("latest 0.06");
|
|
195
|
+
// The threshold is scaled the same way, so the two halves agree.
|
|
196
|
+
expect(message).toContain("greater than 90.00%");
|
|
186
197
|
expect(message).not.toContain("greater than 0.9 1");
|
|
187
198
|
});
|
|
199
|
+
|
|
200
|
+
/*
|
|
201
|
+
* The control for the rule above: "1" is only a percentage when the
|
|
202
|
+
* metric NAME says the value is a fraction. A counter carrying "1" —
|
|
203
|
+
* cumulative layout shift is the canonical one — keeps its bare number.
|
|
204
|
+
*/
|
|
205
|
+
test("a non-fraction metric carrying '1' keeps its bare number", () => {
|
|
206
|
+
const criteriaFilter: CriteriaFilter = {
|
|
207
|
+
checkOn: CheckOn.MetricValue,
|
|
208
|
+
filterType: FilterType.GreaterThan,
|
|
209
|
+
value: "0.25",
|
|
210
|
+
metricMonitorOptions: {
|
|
211
|
+
metricAlias: "a",
|
|
212
|
+
metricAggregationType: EvaluateOverTimeType.Average,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const inputs: ReturnType<typeof buildInputs> = buildInputs({
|
|
217
|
+
metricNativeUnit: "1",
|
|
218
|
+
metricName: "browser.cumulative_layout_shift",
|
|
219
|
+
sampleValues: [0.31],
|
|
220
|
+
criteriaFilter,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const message: string =
|
|
224
|
+
MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage({
|
|
225
|
+
...inputs,
|
|
226
|
+
didMeetCriteria: false,
|
|
227
|
+
matchMessage: null,
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
expect(message).toContain("latest 0.31");
|
|
231
|
+
expect(message).not.toContain("0.31 1");
|
|
232
|
+
expect(message).not.toContain("31.00%");
|
|
233
|
+
expect(message).toContain("greater than 0.25");
|
|
234
|
+
});
|
|
188
235
|
});
|
|
189
236
|
|
|
190
237
|
/*
|
|
@@ -221,7 +268,7 @@ describe("MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage — Evaluatio
|
|
|
221
268
|
});
|
|
222
269
|
|
|
223
270
|
expect(message).toBe(
|
|
224
|
-
"Metric Value (a) recorded latest
|
|
271
|
+
"Metric Value (a) recorded latest 60 ms (min 60 ms, max 60 ms) across 3 data points. (expected to be greater than 5 sec using average).",
|
|
225
272
|
);
|
|
226
273
|
});
|
|
227
274
|
|
|
@@ -251,10 +298,10 @@ describe("MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage — Evaluatio
|
|
|
251
298
|
});
|
|
252
299
|
|
|
253
300
|
expect(message).toBe(
|
|
254
|
-
"Metric Value (a) recorded latest 10
|
|
301
|
+
"Metric Value (a) recorded latest 10 sec (min 8 sec, max 12 sec) across 3 data points. (expected to be less than 5 sec using average).",
|
|
255
302
|
);
|
|
256
303
|
// The unit rides both the observed value and the "less than N unit" clause.
|
|
257
|
-
expect(message).toContain("latest 10
|
|
304
|
+
expect(message).toContain("latest 10 sec");
|
|
258
305
|
expect(message).toContain("less than 5 sec");
|
|
259
306
|
});
|
|
260
307
|
|
|
@@ -286,7 +333,7 @@ describe("MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage — Evaluatio
|
|
|
286
333
|
});
|
|
287
334
|
|
|
288
335
|
expect(message).toBe(
|
|
289
|
-
"Metric Value (a) recorded latest 3.
|
|
336
|
+
"Metric Value (a) recorded latest 3.5 sec (min 1.5 sec, max 3.5 sec) across 3 data points. (expected to be greater than 2 sec using maximum value).",
|
|
290
337
|
);
|
|
291
338
|
// The raw ms magnitudes never leak into the rendered line.
|
|
292
339
|
expect(message).not.toContain("1500");
|
|
@@ -329,14 +376,14 @@ describe("MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage — Evaluatio
|
|
|
329
376
|
* observed value and the threshold, even though "1.00" appears in the text.
|
|
330
377
|
*/
|
|
331
378
|
expect(message).toBe(
|
|
332
|
-
"Metric Value (a) recorded latest
|
|
379
|
+
"Metric Value (a) recorded latest 100.00% (min 95.00%, max 100.00%) across 3 data points. (expected to be greater than 90.00% using average).",
|
|
333
380
|
);
|
|
334
381
|
/*
|
|
335
382
|
* Neither the value nor the threshold carries a unit: each number is
|
|
336
383
|
* immediately followed by punctuation/wording, never a " 1" unit suffix.
|
|
337
384
|
*/
|
|
338
|
-
expect(message).toContain("latest
|
|
339
|
-
expect(message).toContain("greater than
|
|
385
|
+
expect(message).toContain("latest 100.00% (min 95.00%, max 100.00%)");
|
|
386
|
+
expect(message).toContain("greater than 90.00% using average");
|
|
340
387
|
});
|
|
341
388
|
|
|
342
389
|
/*
|
|
@@ -375,11 +422,11 @@ describe("MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage — Evaluatio
|
|
|
375
422
|
});
|
|
376
423
|
|
|
377
424
|
expect(message).toBe(
|
|
378
|
-
"Metric Value (a) recorded latest 6.00
|
|
425
|
+
"Metric Value (a) recorded latest 6.00% across 1 data point. (expected to be greater than 90.00% using average).",
|
|
379
426
|
);
|
|
380
427
|
// Both the converted observed value and the threshold carry the "%" unit.
|
|
381
|
-
expect(message).toContain("latest 6.00
|
|
382
|
-
expect(message).toContain("greater than 90
|
|
428
|
+
expect(message).toContain("latest 6.00%");
|
|
429
|
+
expect(message).toContain("greater than 90.00%");
|
|
383
430
|
// The raw fraction magnitude never leaks into the rendered line.
|
|
384
431
|
expect(message).not.toContain("0.06");
|
|
385
432
|
// Singular grammar for the lone sample — no "(min .., max ..)" clause.
|
|
@@ -488,7 +535,7 @@ describe("MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage — Evaluatio
|
|
|
488
535
|
});
|
|
489
536
|
|
|
490
537
|
expect(message).toBe(
|
|
491
|
-
"Metric Value (a) recorded latest 7
|
|
538
|
+
"Metric Value (a) recorded latest 7 sec across 1 data point. (expected to be greater than 5 sec using average).",
|
|
492
539
|
);
|
|
493
540
|
// Singular grammar, and no "(min .., max ..)" clause for a lone sample.
|
|
494
541
|
expect(message).toContain("across 1 data point.");
|
|
@@ -522,7 +569,7 @@ describe("MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage — Evaluatio
|
|
|
522
569
|
});
|
|
523
570
|
|
|
524
571
|
expect(message).toBe(
|
|
525
|
-
"Metric Value (a) recorded latest 100
|
|
572
|
+
"Metric Value (a) recorded latest 100 ms (min 100 ms, max 100 ms) across 3 data points. (expected to equal 100 ms using average).",
|
|
526
573
|
);
|
|
527
574
|
});
|
|
528
575
|
|
|
@@ -552,7 +599,7 @@ describe("MonitorCriteriaMessageBuilder.buildCriteriaFilterMessage — Evaluatio
|
|
|
552
599
|
});
|
|
553
600
|
|
|
554
601
|
expect(message).toBe(
|
|
555
|
-
"Metric Value (a) recorded latest 70
|
|
602
|
+
"Metric Value (a) recorded latest 70 ms (min 55 ms, max 70 ms) across 3 data points. (expected to be greater than or equal to 50 ms using maximum value).",
|
|
556
603
|
);
|
|
557
604
|
});
|
|
558
605
|
|
|
@@ -318,7 +318,7 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
318
318
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
319
319
|
|
|
320
320
|
expect(observation).toBe(
|
|
321
|
-
"Metric Value (a) recorded latest
|
|
321
|
+
"Metric Value (a) recorded latest 60 ms (min 60 ms, max 60 ms) across 3 data points.",
|
|
322
322
|
);
|
|
323
323
|
});
|
|
324
324
|
|
|
@@ -339,7 +339,7 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
339
339
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
340
340
|
|
|
341
341
|
expect(observation).toBe(
|
|
342
|
-
"Metric Value (a) recorded latest 60
|
|
342
|
+
"Metric Value (a) recorded latest 60 ms (min 40 ms, max 60 ms) across 2 data points.",
|
|
343
343
|
);
|
|
344
344
|
});
|
|
345
345
|
|
|
@@ -364,9 +364,9 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
364
364
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
365
365
|
|
|
366
366
|
expect(observation).toBe(
|
|
367
|
-
"Metric Value (a) recorded latest 2.
|
|
367
|
+
"Metric Value (a) recorded latest 2.5 sec across 1 data point.",
|
|
368
368
|
);
|
|
369
|
-
expect(observation).toContain("2.
|
|
369
|
+
expect(observation).toContain("2.5 sec");
|
|
370
370
|
});
|
|
371
371
|
|
|
372
372
|
/*
|
|
@@ -389,9 +389,9 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
389
389
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
390
390
|
|
|
391
391
|
expect(observation).toBe(
|
|
392
|
-
"Metric Value (a) recorded latest 2.
|
|
392
|
+
"Metric Value (a) recorded latest 2.5 GB across 1 data point.",
|
|
393
393
|
);
|
|
394
|
-
expect(observation).toContain("2.
|
|
394
|
+
expect(observation).toContain("2.5 GB");
|
|
395
395
|
});
|
|
396
396
|
|
|
397
397
|
/*
|
|
@@ -413,13 +413,30 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
413
413
|
const observation: string | null =
|
|
414
414
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
415
415
|
|
|
416
|
+
/*
|
|
417
|
+
* The user mislabelled a millisecond metric as megabytes. The
|
|
418
|
+
* conversion still no-ops — ms and MB are different families — so the
|
|
419
|
+
* SAMPLE is untouched at 5000, and the renderer then takes the label
|
|
420
|
+
* at its word and reads 5000 MB out as "5 GB". Every string this
|
|
421
|
+
* sentence can produce is wrong, because the configuration is; what
|
|
422
|
+
* this test pins is that the mislabelling is passed through rather
|
|
423
|
+
* than silently repaired.
|
|
424
|
+
*/
|
|
416
425
|
expect(observation).toBe(
|
|
417
|
-
"Metric Value (a) recorded latest
|
|
426
|
+
"Metric Value (a) recorded latest 5 GB across 1 data point.",
|
|
418
427
|
);
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
428
|
+
expect(observation).toContain("5 GB");
|
|
429
|
+
/*
|
|
430
|
+
* Still reported in the threshold unit's FAMILY — the label the user
|
|
431
|
+
* chose won, which is the behaviour this test guards. It reads "GB"
|
|
432
|
+
* rather than "MB" only because the ladder rescales within that family;
|
|
433
|
+
* the alternative would be to drop the user's unit when it looks
|
|
434
|
+
* incompatible, which would hide the misconfiguration entirely.
|
|
435
|
+
*/
|
|
436
|
+
expect(observation).not.toContain("ms");
|
|
437
|
+
expect(
|
|
438
|
+
MonitorCriteriaObservationBuilder.getMetricValueDisplayUnit(inputs),
|
|
439
|
+
).toBe("MB");
|
|
423
440
|
});
|
|
424
441
|
|
|
425
442
|
/*
|
|
@@ -486,7 +503,7 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
486
503
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
487
504
|
|
|
488
505
|
expect(observation).toBe(
|
|
489
|
-
"Metric Value (a) recorded latest 60
|
|
506
|
+
"Metric Value (a) recorded latest 60 ms (min 40 ms, max 60 ms) across 2 data points.",
|
|
490
507
|
);
|
|
491
508
|
});
|
|
492
509
|
|
|
@@ -532,7 +549,7 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
532
549
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
533
550
|
|
|
534
551
|
expect(observation).toBe(
|
|
535
|
-
"Metric Value (b) recorded latest 3
|
|
552
|
+
"Metric Value (b) recorded latest 3 sec (min 1 sec, max 3 sec) across 3 data points.",
|
|
536
553
|
);
|
|
537
554
|
// The a-series (ms, 40/60) must not leak in.
|
|
538
555
|
expect(observation).not.toContain("(a)");
|
|
@@ -562,7 +579,7 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
562
579
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
563
580
|
|
|
564
581
|
expect(observation).toBe(
|
|
565
|
-
"Metric Value (a) recorded latest 6.00
|
|
582
|
+
"Metric Value (a) recorded latest 6.00% across 1 data point.",
|
|
566
583
|
);
|
|
567
584
|
|
|
568
585
|
const unit: string | undefined =
|
|
@@ -630,7 +647,7 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
630
647
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
631
648
|
|
|
632
649
|
expect(observation).toBe(
|
|
633
|
-
"Metric Value (c) recorded latest 2.
|
|
650
|
+
"Metric Value (c) recorded latest 2.5 sec (min 1.5 sec, max 2.5 sec) across 2 data points.",
|
|
634
651
|
);
|
|
635
652
|
// The formula alias, not the base query, is summarized.
|
|
636
653
|
expect(observation).toContain("(c)");
|
|
@@ -659,9 +676,9 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
659
676
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
660
677
|
|
|
661
678
|
expect(observation).toBe(
|
|
662
|
-
"Metric Value (a) recorded latest 1.
|
|
679
|
+
"Metric Value (a) recorded latest 1.5 Gbit across 1 data point.",
|
|
663
680
|
);
|
|
664
|
-
expect(observation).toContain("1.
|
|
681
|
+
expect(observation).toContain("1.5 Gbit");
|
|
665
682
|
});
|
|
666
683
|
|
|
667
684
|
/*
|
|
@@ -686,10 +703,10 @@ describe("MonitorCriteriaObservationBuilder.describeFilterObservation — metric
|
|
|
686
703
|
MonitorCriteriaObservationBuilder.describeFilterObservation(inputs);
|
|
687
704
|
|
|
688
705
|
expect(observation).toBe(
|
|
689
|
-
"Metric Value (a) recorded latest 5
|
|
706
|
+
"Metric Value (a) recorded latest 5 sec across 1 data point.",
|
|
690
707
|
);
|
|
691
708
|
// Unconverted value, but labelled with the threshold unit.
|
|
692
|
-
expect(observation).toContain("5
|
|
709
|
+
expect(observation).toContain("5 sec");
|
|
693
710
|
});
|
|
694
711
|
});
|
|
695
712
|
|