@oneuptime/common 14.0.110 → 14.2.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/AIRunRecording.d.mts +12 -0
- package/Models/DatabaseModels/AIRunRecording.d.ts +12 -0
- package/Models/DatabaseModels/AIRunRecording.js +181 -0
- package/Models/DatabaseModels/AIRunRecording.mjs +2 -0
- package/Models/DatabaseModels/Alert.d.mts +1 -0
- package/Models/DatabaseModels/Alert.d.ts +1 -0
- package/Models/DatabaseModels/Alert.js +52 -2
- package/Models/DatabaseModels/AutoRemediationSuggestion.d.mts +2 -0
- package/Models/DatabaseModels/AutoRemediationSuggestion.d.ts +2 -0
- package/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
- package/Models/DatabaseModels/DataStore.js +9 -0
- package/Models/DatabaseModels/EmailLog.js +2 -2
- package/Models/DatabaseModels/Form.js +3 -3
- package/Models/DatabaseModels/FormSubmission.js +4 -4
- package/Models/DatabaseModels/GlobalConfig.js +46 -45
- package/Models/DatabaseModels/Incident.d.mts +1 -0
- package/Models/DatabaseModels/Incident.d.ts +1 -0
- package/Models/DatabaseModels/Incident.js +53 -2
- package/Models/DatabaseModels/IncidentPostmortemActionItem.d.mts +31 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.d.ts +31 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.js +591 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.mjs +3 -0
- package/Models/DatabaseModels/IncidentSlaRule.js +2 -2
- package/Models/DatabaseModels/Index.js +6 -0
- package/Models/DatabaseModels/InventoryItem.js +11 -0
- package/Models/DatabaseModels/Monitor.js +51 -17
- package/Models/DatabaseModels/MonitorNetworkDevice.d.mts +11 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.d.ts +11 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.js +189 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.mjs +2 -0
- package/Models/DatabaseModels/MonitorProbe.js +22 -5
- package/Models/DatabaseModels/NetworkDevice.js +23 -7
- package/Models/DatabaseModels/NetworkEndpoint.d.mts +1 -0
- package/Models/DatabaseModels/NetworkEndpoint.d.ts +1 -0
- package/Models/DatabaseModels/NetworkEndpoint.js +39 -7
- package/Models/DatabaseModels/NetworkInterface.js +5 -5
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +19 -5
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.mts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.ts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +35 -7
- package/Models/DatabaseModels/OpenStackCloudCheck.js +8 -1
- package/Models/DatabaseModels/Project.d.mts +1 -0
- package/Models/DatabaseModels/Project.d.ts +1 -0
- package/Models/DatabaseModels/Project.js +46 -3
- package/Models/DatabaseModels/ProjectCallSMSConfig.js +3 -1
- package/Models/DatabaseModels/ProjectSmtpConfig.js +2 -0
- package/Models/DatabaseModels/PublicNoteApprovalRequest.js +3 -3
- package/Models/DatabaseModels/PublicNoteApprovalStep.js +1 -1
- package/Models/DatabaseModels/RunbookExecution.js +2 -2
- package/Models/DatabaseModels/RunbookRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenance.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceCalendarFeed.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceLabelRule.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurement.js +7 -7
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerTeam.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerUser.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +5 -5
- package/Models/DatabaseModels/TeamMember.js +10 -1
- package/Models/DatabaseModels/TelemetryIngestionKey.js +1 -1
- package/Models/DatabaseModels/WorkspaceNotificationRule.js +36 -1
- package/Models/DatabaseModels/WorkspaceNotificationSummary.js +1 -1
- package/Models/DatabaseModels/WorkspacePublicNoteApprovalMessage.js +3 -3
- package/Server/Services/DatabaseService.d.mts +4 -1
- package/Server/Services/DatabaseService.d.ts +4 -1
- package/Server/Types/Database/CountBy.d.mts +1 -0
- package/Server/Types/Database/CountBy.d.ts +1 -0
- package/Server/Types/Database/UpdateLimit.d.mts +6 -0
- package/Server/Types/Database/UpdateLimit.d.ts +6 -0
- package/Types/AI/AIActionWords.d.mts +28 -2
- package/Types/AI/AIActionWords.d.ts +28 -2
- package/Types/AI/AIActionWords.js +235 -3
- package/Types/AI/AIActionWords.mjs +8 -0
- package/Types/AI/AIChatTypes.d.mts +3 -1
- package/Types/AI/AIChatTypes.d.ts +3 -1
- package/Types/AI/AIReadTableWords.d.mts +192 -0
- package/Types/AI/AIReadTableWords.d.ts +192 -0
- package/Types/AI/AIReadTableWords.js +368 -0
- package/Types/AI/AIReadTableWords.mjs +18 -0
- package/Types/AI/AiOutcomes.d.mts +57 -0
- package/Types/AI/AiOutcomes.d.ts +57 -0
- package/Types/AI/AiOutcomes.js +67 -0
- package/Types/AI/AiOutcomes.mjs +10 -0
- package/Types/AI/AiRunRefusal.d.mts +48 -0
- package/Types/AI/AiRunRefusal.d.ts +48 -0
- package/Types/AI/AiRunRefusal.js +208 -0
- package/Types/AI/AiRunRefusal.mjs +12 -0
- package/Types/AI/InvestigationRecording.d.mts +46 -0
- package/Types/AI/InvestigationRecording.d.ts +46 -0
- package/Types/AI/InvestigationRecording.js +42 -0
- package/Types/AI/InvestigationRecording.mjs +7 -0
- package/Types/AI/ResourceAiAccessPermissions.js +7 -18
- package/Types/API/HTTPResponse.d.mts +3 -0
- package/Types/API/HTTPResponse.d.ts +3 -0
- package/Types/API/HTTPResponse.js +15 -0
- package/Types/AuditLog/AuditLogActionLabel.js +19 -9
- package/Types/BaseDatabase/AggregateBy.d.mts +16 -0
- package/Types/BaseDatabase/AggregateBy.d.ts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +32 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +32 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.js +199 -2
- package/Types/BaseDatabase/ListResult.d.mts +1 -0
- package/Types/BaseDatabase/ListResult.d.ts +1 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.d.mts +47 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.d.ts +47 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.js +282 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.mjs +7 -0
- package/Types/Cloud/CloudResourceHealth.d.mts +30 -1
- package/Types/Cloud/CloudResourceHealth.d.ts +30 -1
- package/Types/Cloud/CloudResourceHealth.js +405 -13
- package/Types/Cloud/CloudResourceHealth.mjs +28 -0
- package/Types/Dashboard/DashboardAutoRefresh.d.mts +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.d.ts +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.js +21 -0
- package/Types/Dashboard/DashboardAutoRefresh.mjs +1 -0
- package/Types/DataObservability/DataCheckRefusals.d.mts +32 -0
- package/Types/DataObservability/DataCheckRefusals.d.ts +32 -0
- package/Types/DataObservability/DataCheckRefusals.js +77 -0
- package/Types/DataObservability/DataCheckRefusals.mjs +8 -0
- package/Types/Database/AccessControl/PermissionScopeNarrowing.js +4 -0
- package/Types/Date.d.mts +8 -1
- package/Types/Date.d.ts +8 -1
- package/Types/Date.js +61 -7
- package/Types/Date.mjs +1 -0
- package/Types/DateLanguage.d.mts +2 -0
- package/Types/DateLanguage.d.ts +2 -0
- package/Types/DateLanguage.js +8 -5
- package/Types/Email/EmailTemplateType.d.mts +1 -0
- package/Types/Email/EmailTemplateType.d.ts +1 -0
- package/Types/Email/EmailTemplateType.js +2 -0
- package/Types/Email/ServerEmailEnvironment.d.mts +85 -0
- package/Types/Email/ServerEmailEnvironment.d.ts +85 -0
- package/Types/Email/ServerEmailEnvironment.js +793 -0
- package/Types/Email/ServerEmailEnvironment.mjs +14 -0
- package/Types/Exception/AiRunRefusalException.d.mts +6 -0
- package/Types/Exception/AiRunRefusalException.d.ts +6 -0
- package/Types/Exception/AiRunRefusalException.js +23 -0
- package/Types/Exception/AiRunRefusalException.mjs +2 -0
- package/Types/Exception/EgressGuardException.js +1 -1
- package/Types/Exception/ErrorMessageRule.d.mts +1 -0
- package/Types/Exception/ErrorMessageRule.d.ts +1 -0
- package/Types/Exception/ErrorMessageRule.js +67 -13
- package/Types/Exception/ErrorMessageRule.mjs +1 -0
- package/Types/Exception/ExceptionMessages.d.mts +2 -0
- package/Types/Exception/ExceptionMessages.d.ts +2 -0
- package/Types/Exception/ExceptionMessages.js +2 -0
- package/Types/Form/FormTargetCatalog.js +2 -2
- package/Types/Form/FormTargetType.js +2 -2
- package/Types/Incident/PostmortemActionItemStatus.d.mts +17 -0
- package/Types/Incident/PostmortemActionItemStatus.d.ts +17 -0
- package/Types/Incident/PostmortemActionItemStatus.js +74 -0
- package/Types/Incident/PostmortemActionItemStatus.mjs +5 -0
- package/Types/JSONFunctions.js +10 -3
- package/Types/Link.d.mts +1 -0
- package/Types/Link.d.ts +1 -0
- package/Types/ListData.d.mts +2 -0
- package/Types/ListData.d.ts +2 -0
- package/Types/ListData.js +4 -0
- package/Types/MeaningKeys.d.mts +4 -0
- package/Types/MeaningKeys.d.ts +4 -0
- package/Types/MeaningKeys.js +74 -0
- package/Types/MeaningKeys.mjs +5 -0
- package/Types/Monitor/MonitorCriteriaInstance.js +9 -0
- package/Types/Monitor/MonitorNotCheckedReason.d.mts +7 -0
- package/Types/Monitor/MonitorNotCheckedReason.d.ts +7 -0
- package/Types/Monitor/MonitorNotCheckedReason.js +36 -0
- package/Types/Monitor/MonitorNotCheckedReason.mjs +4 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.d.mts +6 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.d.ts +6 -0
- package/Types/Monitor/UptimeHistoryLabels.js +2 -2
- package/Types/Monitor/WhoIsTold.d.mts +3 -0
- package/Types/Monitor/WhoIsTold.d.ts +3 -0
- package/Types/Monitor/WhoIsTold.js +63 -13
- package/Types/NoBreakSpaces.d.mts +16 -0
- package/Types/NoBreakSpaces.d.ts +16 -0
- package/Types/NoBreakSpaces.js +419 -0
- package/Types/NoBreakSpaces.mjs +9 -0
- package/Types/NotificationRule/PagingLadder.d.mts +12 -0
- package/Types/NotificationRule/PagingLadder.d.ts +12 -0
- package/Types/NotificationRule/PagingLadder.js +159 -11
- package/Types/NotificationRule/PagingLadder.mjs +3 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.mts +1 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.ts +1 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.js +12 -9
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.mts +3 -1
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.ts +3 -1
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.js +24 -6
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.mts +1 -0
- package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.ts +1 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.mts +3 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.ts +3 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.js +42 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.mjs +4 -0
- package/Types/OnCallDutyPolicy/OnCallPageWords.d.mts +6 -2
- package/Types/OnCallDutyPolicy/OnCallPageWords.d.ts +6 -2
- package/Types/OnCallDutyPolicy/OnCallPageWords.js +21 -20
- package/Types/OnCallDutyPolicy/OnCallPersonPage.d.mts +4 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.d.ts +4 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.js +125 -1
- package/Types/OnCallDutyPolicy/OnCallPersonPage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.mts +12 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.ts +12 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.js +38 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.mjs +3 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.mts +2 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +2 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.js +12 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +1 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.mts +92 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.ts +92 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.js +512 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.mjs +7 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.d.mts +23 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.d.ts +23 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.js +105 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.mjs +6 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.mts +64 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.ts +64 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.js +237 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.mjs +14 -0
- package/Types/OpenStack/OpenStackCapacity.js +12 -5
- package/Types/Permission.d.mts +4 -0
- package/Types/Permission.d.ts +4 -0
- package/Types/Permission.js +66 -10
- package/Types/Probe/ProbeCapability.d.mts +2 -1
- package/Types/Probe/ProbeCapability.d.ts +2 -1
- package/Types/Probe/ProbeCapability.js +10 -0
- package/Types/Product/ProductUsage.js +2 -1
- package/Types/Product/ProjectProductsAnswer.js +2 -1
- package/Types/ReaderLanguage.d.mts +1 -0
- package/Types/ReaderLanguage.d.ts +1 -0
- package/Types/ReaderLanguage.js +13 -1
- package/Types/ReaderLanguage.mjs +1 -0
- package/Types/ResourceAiAgent/AiResourceType.d.mts +1 -0
- package/Types/ResourceAiAgent/AiResourceType.d.ts +1 -0
- package/Types/ResourceAiAgent/AiResourceType.js +12 -0
- package/Types/Rules/RuleRun.js +2 -2
- package/Types/Rum/ProductAnalyticsEventReads.js +10 -1
- package/Types/Rum/ProductAnalyticsEvents.js +13 -1
- package/Types/Rum/SessionReplayCustomEvents.d.mts +4 -1
- package/Types/Rum/SessionReplayCustomEvents.d.ts +4 -1
- package/Types/Rum/SessionReplayCustomEvents.js +12 -0
- package/Types/Rum/SessionReplayCustomEvents.mjs +1 -0
- package/Types/ScheduledMaintenance/MaintenanceCalendar.js +1 -1
- package/Types/ServerSending/ServerSendingStatus.d.mts +7 -0
- package/Types/ServerSending/ServerSendingStatus.d.ts +7 -0
- package/Types/ServerSending/ServerSendingStatus.js +49 -2
- package/Types/ServerSetup/ServerSetupChecklist.js +3 -3
- package/Types/SetupHealth/SetupHealth.d.mts +1 -0
- package/Types/SetupHealth/SetupHealth.d.ts +1 -0
- package/Types/SetupHealth/SetupHealth.js +13 -5
- package/Types/StateTimeline/RowsKeptOnDelete.js +1 -1
- package/Types/StatusPage/DefaultStatusNames.d.mts +11 -3
- package/Types/StatusPage/DefaultStatusNames.d.ts +11 -3
- package/Types/StatusPage/DefaultStatusNames.js +74 -28
- package/Types/StatusPage/DefaultStatusNames.mjs +9 -2
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.mts +8 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.ts +8 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.js +50 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.mjs +3 -0
- package/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js +1 -1
- package/Types/StatusPage/StateChangeNoteMessage.d.mts +3 -2
- package/Types/StatusPage/StateChangeNoteMessage.d.ts +3 -2
- package/Types/StatusPage/StateChangeNoteMessage.js +16 -13
- package/Types/Telemetry/CompatibleIngest.d.mts +20 -0
- package/Types/Telemetry/CompatibleIngest.d.ts +20 -0
- package/Types/Telemetry/CompatibleIngest.js +123 -0
- package/Types/Telemetry/CompatibleIngest.mjs +21 -0
- package/Types/Telemetry/TelemetryIngestSurface.d.mts +5 -0
- package/Types/Telemetry/TelemetryIngestSurface.d.ts +5 -0
- package/Types/Telemetry/TelemetryIngestSurface.js +48 -7
- package/Types/Telemetry/TelemetryIngestionKeyType.js +7 -6
- package/Types/TimezoneAlias.d.mts +1 -0
- package/Types/TimezoneAlias.d.ts +1 -0
- package/Types/TimezoneAlias.js +13 -0
- package/Types/Translator.d.mts +1 -0
- package/Types/Translator.d.ts +1 -0
- package/Types/Translator.js +470 -63
- package/Types/Translator.mjs +1 -0
- package/Types/UserSession/SessionLength.d.mts +33 -0
- package/Types/UserSession/SessionLength.d.ts +33 -0
- package/Types/UserSession/SessionLength.js +134 -5
- package/Types/UserSession/SessionLength.mjs +5 -0
- package/Types/Workflow/RunRecord.js +1 -1
- package/Types/Workflow/Templates.js +2 -2
- package/Types/Workflow/WorkflowStatus.js +21 -10
- package/Types/Workspace/NotificationRules/BaseNotificationRule.d.mts +2 -0
- package/Types/Workspace/NotificationRules/BaseNotificationRule.d.ts +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +26 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +26 -1
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.mts +84 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.ts +84 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.js +456 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.mjs +5 -0
- package/Utils/AI/InvestigationReport.js +2 -2
- package/Utils/API.d.mts +0 -11
- package/Utils/API.d.ts +0 -11
- package/Utils/API.js +0 -432
- package/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +2 -2
- package/Utils/AiRemediation/VerifiedFixRunbook.d.mts +39 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.d.ts +39 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.js +231 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.mjs +10 -0
- package/Utils/Dashboard/DashboardWidgetSorts.js +11 -2
- package/Utils/Dashboard/MonitorListWidgetFormat.d.mts +2 -1
- package/Utils/Dashboard/MonitorListWidgetFormat.d.ts +2 -1
- package/Utils/Dashboard/MonitorListWidgetFormat.js +5 -3
- package/Utils/Dashboard/ValueWidgetSeries.d.mts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.d.ts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.js +75 -0
- package/Utils/DefaultRecordNames.d.mts +6 -0
- package/Utils/DefaultRecordNames.d.ts +6 -0
- package/Utils/DefaultRecordNames.js +122 -0
- package/Utils/DefaultRecordNames.mjs +6 -0
- package/Utils/DeveloperDocs/ExampleBuilder.js +1 -1
- package/Utils/DeveloperDocs/ResourceProfiles.js +2 -2
- package/Utils/Grok/Grok.js +7 -4
- package/Utils/GuidedSetup/StatusPageRecords.d.mts +5 -0
- package/Utils/GuidedSetup/StatusPageRecords.d.ts +5 -0
- package/Utils/GuidedSetup/StatusPageRecords.js +27 -2
- package/Utils/GuidedSetup/StatusPageRecords.mjs +1 -0
- package/Utils/GuidedSetup/WebsiteMonitorRecords.js +6 -0
- package/Utils/HostAddressUtil.d.mts +1 -0
- package/Utils/HostAddressUtil.d.ts +1 -0
- package/Utils/HostAddressUtil.js +30 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.d.mts +20 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.d.ts +20 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.js +107 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.mjs +10 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.d.mts +39 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.d.ts +39 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.js +118 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.mjs +12 -0
- package/Utils/Incident/PostmortemNoteActionItems.d.mts +29 -0
- package/Utils/Incident/PostmortemNoteActionItems.d.ts +29 -0
- package/Utils/Incident/PostmortemNoteActionItems.js +544 -0
- package/Utils/Incident/PostmortemNoteActionItems.mjs +7 -0
- package/Utils/LinearRegExp/LinearRegExp.js +5 -1
- package/Utils/LookupTable.d.mts +3 -0
- package/Utils/LookupTable.d.ts +3 -0
- package/Utils/LookupTable.js +61 -0
- package/Utils/LookupTable.mjs +3 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.mts +2 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.ts +2 -0
- package/Utils/Markdown/LinkReferenceDefinitions.js +101 -1
- package/Utils/Markdown/LinkReferenceDefinitions.mjs +2 -0
- package/Utils/Markdown/OverLongText.js +296 -2
- package/Utils/Markdown/SlowMarkdown.d.mts +1 -0
- package/Utils/Markdown/SlowMarkdown.d.ts +1 -0
- package/Utils/Markdown/SlowMarkdown.js +354 -4
- package/Utils/Markdown/SlowMarkdown.mjs +1 -0
- package/Utils/Metrics/MetricFormulaEvaluator.js +10 -4
- package/Utils/Metrics/MetricSeriesFingerprint.js +13 -4
- package/Utils/Metrics/MetricSeriesScope.d.mts +5 -0
- package/Utils/Metrics/MetricSeriesScope.d.ts +5 -0
- package/Utils/Metrics/MetricSeriesScope.js +5 -1
- package/Utils/Milliseconds.d.mts +7 -0
- package/Utils/Milliseconds.d.ts +7 -0
- package/Utils/Milliseconds.js +60 -0
- package/Utils/Milliseconds.mjs +4 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.mts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.ts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.js +91 -21
- package/Utils/Monitor/EndpointAttachmentUtil.mjs +4 -0
- package/Utils/Monitor/InterfaceInventoryUtil.d.mts +40 -0
- package/Utils/Monitor/InterfaceInventoryUtil.d.ts +40 -0
- package/Utils/Monitor/InterfaceInventoryUtil.js +217 -5
- package/Utils/Monitor/InterfaceInventoryUtil.mjs +8 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +63 -29
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +13 -2
- package/Utils/Monitor/MonitorRootCauseWording.d.mts +5 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +5 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +148 -5
- package/Utils/Monitor/MonitoringOff.d.mts +2 -0
- package/Utils/Monitor/MonitoringOff.d.ts +2 -0
- package/Utils/Monitor/MonitoringOff.js +21 -0
- package/Utils/Monitor/NetworkTopologyUtil.d.mts +2 -1
- package/Utils/Monitor/NetworkTopologyUtil.d.ts +2 -1
- package/Utils/Monitor/NetworkTopologyUtil.js +10 -0
- package/Utils/Monitor/NotOperationalMonitorQuery.d.mts +2 -1
- package/Utils/Monitor/NotOperationalMonitorQuery.d.ts +2 -1
- package/Utils/Monitor/NotOperationalMonitorQuery.js +23 -4
- package/Utils/Monitor/ProbeAgreementRule.d.mts +10 -0
- package/Utils/Monitor/ProbeAgreementRule.d.ts +10 -0
- package/Utils/Monitor/ProbeAgreementRule.js +58 -0
- package/Utils/Monitor/ProbeAgreementRule.mjs +3 -0
- package/Utils/Monitor/ProbeFailureReading.d.mts +18 -0
- package/Utils/Monitor/ProbeFailureReading.d.ts +18 -0
- package/Utils/Monitor/ProbeFailureReading.js +166 -0
- package/Utils/Monitor/ProbeFailureReading.mjs +8 -0
- package/Utils/Monitor/RequestFailureDescriptions.d.mts +61 -0
- package/Utils/Monitor/RequestFailureDescriptions.d.ts +61 -0
- package/Utils/Monitor/RequestFailureDescriptions.js +252 -0
- package/Utils/Monitor/RequestFailureDescriptions.mjs +6 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.d.mts +9 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.d.ts +9 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.js +15 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.mjs +2 -0
- package/Utils/Project/NextNumber.js +1 -1
- package/Utils/PromQL/PromQLAst.d.mts +159 -0
- package/Utils/PromQL/PromQLAst.d.ts +159 -0
- package/Utils/PromQL/PromQLAst.js +118 -0
- package/Utils/PromQL/PromQLAst.mjs +12 -0
- package/Utils/PromQL/PromQLDuration.d.mts +2 -0
- package/Utils/PromQL/PromQLDuration.d.ts +2 -0
- package/Utils/PromQL/PromQLDuration.js +78 -0
- package/Utils/PromQL/PromQLDuration.mjs +3 -0
- package/Utils/PromQL/PromQLEngine.d.mts +15 -0
- package/Utils/PromQL/PromQLEngine.d.ts +15 -0
- package/Utils/PromQL/PromQLEngine.js +974 -0
- package/Utils/PromQL/PromQLEngine.mjs +7 -0
- package/Utils/PromQL/PromQLEngineTypes.d.mts +84 -0
- package/Utils/PromQL/PromQLEngineTypes.d.ts +84 -0
- package/Utils/PromQL/PromQLEngineTypes.js +10 -0
- package/Utils/PromQL/PromQLEngineTypes.mjs +2 -0
- package/Utils/PromQL/PromQLError.d.mts +11 -0
- package/Utils/PromQL/PromQLError.d.ts +11 -0
- package/Utils/PromQL/PromQLError.js +27 -0
- package/Utils/PromQL/PromQLError.mjs +3 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.d.mts +8 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.d.ts +8 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.js +829 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.mjs +3 -0
- package/Utils/PromQL/PromQLFunctions.d.mts +10 -0
- package/Utils/PromQL/PromQLFunctions.d.ts +10 -0
- package/Utils/PromQL/PromQLFunctions.js +127 -0
- package/Utils/PromQL/PromQLFunctions.mjs +4 -0
- package/Utils/PromQL/PromQLLabelOrder.d.mts +8 -0
- package/Utils/PromQL/PromQLLabelOrder.d.ts +8 -0
- package/Utils/PromQL/PromQLLabelOrder.js +212 -0
- package/Utils/PromQL/PromQLLabelOrder.mjs +6 -0
- package/Utils/PromQL/PromQLLabels.d.mts +11 -0
- package/Utils/PromQL/PromQLLabels.d.ts +11 -0
- package/Utils/PromQL/PromQLLabels.js +219 -0
- package/Utils/PromQL/PromQLLabels.mjs +9 -0
- package/Utils/PromQL/PromQLLexer.d.mts +39 -0
- package/Utils/PromQL/PromQLLexer.d.ts +39 -0
- package/Utils/PromQL/PromQLLexer.js +391 -0
- package/Utils/PromQL/PromQLLexer.mjs +3 -0
- package/Utils/PromQL/PromQLMath.d.mts +19 -0
- package/Utils/PromQL/PromQLMath.d.ts +19 -0
- package/Utils/PromQL/PromQLMath.js +200 -0
- package/Utils/PromQL/PromQLMath.mjs +9 -0
- package/Utils/PromQL/PromQLMetricNames.d.mts +21 -0
- package/Utils/PromQL/PromQLMetricNames.d.ts +21 -0
- package/Utils/PromQL/PromQLMetricNames.js +205 -0
- package/Utils/PromQL/PromQLMetricNames.mjs +8 -0
- package/Utils/PromQL/PromQLParser.d.mts +4 -0
- package/Utils/PromQL/PromQLParser.d.ts +4 -0
- package/Utils/PromQL/PromQLParser.js +836 -0
- package/Utils/PromQL/PromQLParser.mjs +4 -0
- package/Utils/PromQL/PromQLRegex.d.mts +20 -0
- package/Utils/PromQL/PromQLRegex.d.ts +20 -0
- package/Utils/PromQL/PromQLRegex.js +1014 -0
- package/Utils/PromQL/PromQLRegex.mjs +5 -0
- package/Utils/PromQL/PrometheusResponse.d.mts +25 -0
- package/Utils/PromQL/PrometheusResponse.d.ts +25 -0
- package/Utils/PromQL/PrometheusResponse.js +92 -0
- package/Utils/PromQL/PrometheusResponse.mjs +3 -0
- package/Utils/PromQL/RE2CharacterClass.d.mts +24 -0
- package/Utils/PromQL/RE2CharacterClass.d.ts +24 -0
- package/Utils/PromQL/RE2CharacterClass.js +532 -0
- package/Utils/PromQL/RE2CharacterClass.mjs +16 -0
- package/Utils/RequestFailedDetailsUtil.d.mts +15 -0
- package/Utils/RequestFailedDetailsUtil.d.ts +15 -0
- package/Utils/RequestFailedDetailsUtil.js +452 -0
- package/Utils/RequestFailedDetailsUtil.mjs +2 -0
- package/Utils/Rum/PathInSentence.d.mts +5 -0
- package/Utils/Rum/PathInSentence.d.ts +5 -0
- package/Utils/Rum/PathInSentence.js +46 -0
- package/Utils/Rum/PathInSentence.mjs +6 -0
- package/Utils/Rum/UrlScrubber.d.mts +5 -1
- package/Utils/Rum/UrlScrubber.d.ts +5 -1
- package/Utils/Rum/UrlScrubber.js +153 -7
- package/Utils/Rum/UserFlow.d.mts +1 -1
- package/Utils/Rum/UserFlow.d.ts +1 -1
- package/Utils/Rum/UserFlow.js +202 -29
- package/Utils/Rum/UserFlow.mjs +1 -1
- package/Utils/Runbook/RunbookStepsSignature.d.mts +3 -0
- package/Utils/Runbook/RunbookStepsSignature.d.ts +3 -0
- package/Utils/Runbook/RunbookStepsSignature.js +30 -0
- package/Utils/Runbook/RunbookStepsSignature.mjs +3 -0
- package/Utils/Schema/TypeSchemas.js +6 -0
- package/Utils/SecurityCase/SecurityOverviewMetrics.d.mts +11 -1
- package/Utils/SecurityCase/SecurityOverviewMetrics.d.ts +11 -1
- package/Utils/SecurityCase/SecurityOverviewMetrics.js +99 -17
- package/Utils/SecurityCase/SecurityOverviewMetrics.mjs +3 -0
- package/Utils/Slo/SloDuration.d.mts +5 -2
- package/Utils/Slo/SloDuration.d.ts +5 -2
- package/Utils/Slo/SloDuration.js +11 -6
- package/Utils/Slo/SloHealth.js +1 -1
- package/Utils/Sms/OnCallPageSms.d.mts +2 -0
- package/Utils/Sms/OnCallPageSms.d.ts +2 -0
- package/Utils/Sms/OnCallPageSms.js +3 -1
- package/Utils/StateListType.d.mts +11 -0
- package/Utils/StateListType.d.ts +11 -0
- package/Utils/StateListType.js +21 -0
- package/Utils/StateListType.mjs +2 -0
- package/Utils/StateOrder.d.mts +8 -11
- package/Utils/StateOrder.d.ts +8 -11
- package/Utils/StateOrder.js +50 -88
- package/Utils/StateOrder.mjs +2 -0
- package/Utils/StateTimeline/StateTimelineRowDelete.js +1 -1
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.mts +9 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.ts +9 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.js +25 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.mjs +2 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.mts +5 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.ts +5 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.js +39 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.mjs +2 -0
- package/Utils/Syslog/SyslogMessageParser.js +16 -6
- package/Utils/Telemetry/HeartbeatAvailability.d.mts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.d.ts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.js +113 -26
- package/Utils/Uptime/DayUptimeGraphUtil.js +2 -2
- package/Utils/ValueFormatter.d.mts +1 -0
- package/Utils/ValueFormatter.d.ts +1 -0
- package/Utils/ValueFormatter.js +258 -18
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PromQLValueType } from "./PromQLAst.mjs";
|
|
2
|
+
export interface PromQLFunctionSignature {
|
|
3
|
+
name: string;
|
|
4
|
+
argTypes: Array<PromQLValueType>;
|
|
5
|
+
variadic: number;
|
|
6
|
+
returnType: PromQLValueType;
|
|
7
|
+
}
|
|
8
|
+
export declare const PROMQL_FUNCTIONS: ReadonlyMap<string, PromQLFunctionSignature>;
|
|
9
|
+
export declare const PROMQL_NATIVE_HISTOGRAM_FUNCTIONS: ReadonlySet<string>;
|
|
10
|
+
export declare const getPromQLFunction: (name: string) => PromQLFunctionSignature | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PromQLValueType } from "./PromQLAst";
|
|
2
|
+
export interface PromQLFunctionSignature {
|
|
3
|
+
name: string;
|
|
4
|
+
argTypes: Array<PromQLValueType>;
|
|
5
|
+
variadic: number;
|
|
6
|
+
returnType: PromQLValueType;
|
|
7
|
+
}
|
|
8
|
+
export declare const PROMQL_FUNCTIONS: ReadonlyMap<string, PromQLFunctionSignature>;
|
|
9
|
+
export declare const PROMQL_NATIVE_HISTOGRAM_FUNCTIONS: ReadonlySet<string>;
|
|
10
|
+
export declare const getPromQLFunction: (name: string) => PromQLFunctionSignature | undefined;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPromQLFunction = exports.PROMQL_NATIVE_HISTOGRAM_FUNCTIONS = exports.PROMQL_FUNCTIONS = void 0;
|
|
4
|
+
const PromQLAst_1 = require("./PromQLAst");
|
|
5
|
+
const SCALAR = PromQLAst_1.PromQLValueType.Scalar;
|
|
6
|
+
const VECTOR = PromQLAst_1.PromQLValueType.InstantVector;
|
|
7
|
+
const MATRIX = PromQLAst_1.PromQLValueType.RangeVector;
|
|
8
|
+
const STRING = PromQLAst_1.PromQLValueType.String;
|
|
9
|
+
const signature = (name, argTypes, returnType, variadic = 0) => {
|
|
10
|
+
return { name, argTypes, variadic, returnType };
|
|
11
|
+
};
|
|
12
|
+
// One instant vector in, one out: abs, ceil, the trigonometry and the rest.
|
|
13
|
+
const SIMPLE_VECTOR_FUNCTIONS = [
|
|
14
|
+
"abs",
|
|
15
|
+
"acos",
|
|
16
|
+
"acosh",
|
|
17
|
+
"asin",
|
|
18
|
+
"asinh",
|
|
19
|
+
"atan",
|
|
20
|
+
"atanh",
|
|
21
|
+
"ceil",
|
|
22
|
+
"cos",
|
|
23
|
+
"cosh",
|
|
24
|
+
"deg",
|
|
25
|
+
"exp",
|
|
26
|
+
"floor",
|
|
27
|
+
"ln",
|
|
28
|
+
"log10",
|
|
29
|
+
"log2",
|
|
30
|
+
"rad",
|
|
31
|
+
"sgn",
|
|
32
|
+
"sin",
|
|
33
|
+
"sinh",
|
|
34
|
+
"sqrt",
|
|
35
|
+
"tan",
|
|
36
|
+
"tanh",
|
|
37
|
+
];
|
|
38
|
+
// One range vector in, one value per series out.
|
|
39
|
+
const OVER_TIME_FUNCTIONS = [
|
|
40
|
+
"avg_over_time",
|
|
41
|
+
"count_over_time",
|
|
42
|
+
"last_over_time",
|
|
43
|
+
"mad_over_time",
|
|
44
|
+
"max_over_time",
|
|
45
|
+
"min_over_time",
|
|
46
|
+
"present_over_time",
|
|
47
|
+
"stddev_over_time",
|
|
48
|
+
"stdvar_over_time",
|
|
49
|
+
"sum_over_time",
|
|
50
|
+
"changes",
|
|
51
|
+
"resets",
|
|
52
|
+
"deriv",
|
|
53
|
+
"delta",
|
|
54
|
+
"idelta",
|
|
55
|
+
"increase",
|
|
56
|
+
"irate",
|
|
57
|
+
"rate",
|
|
58
|
+
];
|
|
59
|
+
// An optional instant vector of timestamps in, defaulting to vector(time()).
|
|
60
|
+
const DATE_FUNCTIONS = [
|
|
61
|
+
"day_of_month",
|
|
62
|
+
"day_of_week",
|
|
63
|
+
"day_of_year",
|
|
64
|
+
"days_in_month",
|
|
65
|
+
"hour",
|
|
66
|
+
"minute",
|
|
67
|
+
"month",
|
|
68
|
+
"year",
|
|
69
|
+
];
|
|
70
|
+
const buildSignatures = () => {
|
|
71
|
+
const signatures = [
|
|
72
|
+
...SIMPLE_VECTOR_FUNCTIONS.map((name) => {
|
|
73
|
+
return signature(name, [VECTOR], VECTOR);
|
|
74
|
+
}),
|
|
75
|
+
...OVER_TIME_FUNCTIONS.map((name) => {
|
|
76
|
+
return signature(name, [MATRIX], VECTOR);
|
|
77
|
+
}),
|
|
78
|
+
...DATE_FUNCTIONS.map((name) => {
|
|
79
|
+
return signature(name, [VECTOR], VECTOR, 1);
|
|
80
|
+
}),
|
|
81
|
+
signature("absent", [VECTOR], VECTOR),
|
|
82
|
+
signature("absent_over_time", [MATRIX], VECTOR),
|
|
83
|
+
signature("clamp", [VECTOR, SCALAR, SCALAR], VECTOR),
|
|
84
|
+
signature("clamp_max", [VECTOR, SCALAR], VECTOR),
|
|
85
|
+
signature("clamp_min", [VECTOR, SCALAR], VECTOR),
|
|
86
|
+
signature("double_exponential_smoothing", [MATRIX, SCALAR, SCALAR], VECTOR),
|
|
87
|
+
signature("holt_winters", [MATRIX, SCALAR, SCALAR], VECTOR),
|
|
88
|
+
signature("histogram_quantile", [SCALAR, VECTOR], VECTOR),
|
|
89
|
+
signature("label_join", [VECTOR, STRING, STRING, STRING], VECTOR, -1),
|
|
90
|
+
signature("label_replace", [VECTOR, STRING, STRING, STRING, STRING], VECTOR),
|
|
91
|
+
signature("pi", [], SCALAR),
|
|
92
|
+
signature("predict_linear", [MATRIX, SCALAR], VECTOR),
|
|
93
|
+
signature("quantile_over_time", [SCALAR, MATRIX], VECTOR),
|
|
94
|
+
signature("round", [VECTOR, SCALAR], VECTOR, 1),
|
|
95
|
+
signature("scalar", [VECTOR], SCALAR),
|
|
96
|
+
signature("sort", [VECTOR], VECTOR),
|
|
97
|
+
signature("sort_desc", [VECTOR], VECTOR),
|
|
98
|
+
signature("sort_by_label", [VECTOR, STRING], VECTOR, -1),
|
|
99
|
+
signature("sort_by_label_desc", [VECTOR, STRING], VECTOR, -1),
|
|
100
|
+
signature("time", [], SCALAR),
|
|
101
|
+
signature("timestamp", [VECTOR], VECTOR),
|
|
102
|
+
signature("vector", [SCALAR], VECTOR),
|
|
103
|
+
];
|
|
104
|
+
const map = new Map();
|
|
105
|
+
for (const item of signatures) {
|
|
106
|
+
map.set(item.name, item);
|
|
107
|
+
}
|
|
108
|
+
return map;
|
|
109
|
+
};
|
|
110
|
+
exports.PROMQL_FUNCTIONS = buildSignatures();
|
|
111
|
+
/*
|
|
112
|
+
* Prometheus' native histogram functions. OneUptime stores OpenTelemetry
|
|
113
|
+
* histograms as classic buckets, so these have nothing to read; the parser
|
|
114
|
+
* names the series to use instead of saying the function is unknown.
|
|
115
|
+
*/
|
|
116
|
+
exports.PROMQL_NATIVE_HISTOGRAM_FUNCTIONS = new Set([
|
|
117
|
+
"histogram_avg",
|
|
118
|
+
"histogram_count",
|
|
119
|
+
"histogram_fraction",
|
|
120
|
+
"histogram_stddev",
|
|
121
|
+
"histogram_stdvar",
|
|
122
|
+
"histogram_sum",
|
|
123
|
+
]);
|
|
124
|
+
const getPromQLFunction = (name) => {
|
|
125
|
+
return exports.PROMQL_FUNCTIONS.get(name);
|
|
126
|
+
};
|
|
127
|
+
exports.getPromQLFunction = getPromQLFunction;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import commonJsModule from "./PromQLFunctions.js";
|
|
2
|
+
export const PROMQL_FUNCTIONS = commonJsModule.PROMQL_FUNCTIONS;
|
|
3
|
+
export const PROMQL_NATIVE_HISTOGRAM_FUNCTIONS = commonJsModule.PROMQL_NATIVE_HISTOGRAM_FUNCTIONS;
|
|
4
|
+
export const getPromQLFunction = commonJsModule.getPromQLFunction;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PromQLLabels } from "./PromQLLabels.mjs";
|
|
2
|
+
export declare const comparePromQLText: (a: string, b: string) => number;
|
|
3
|
+
export declare const promQLNaturalLess: (a: string, b: string) => boolean;
|
|
4
|
+
export declare const comparePromQLLabelValues: (a: string, b: string) => number;
|
|
5
|
+
export declare const comparePromQLLabelSets: (a: PromQLLabels, b: PromQLLabels) => number;
|
|
6
|
+
export declare const sortPromQLByLabels: <T extends {
|
|
7
|
+
labels: PromQLLabels;
|
|
8
|
+
}>(items: ReadonlyArray<T>, names: ReadonlyArray<string>, descending: boolean) => Array<T>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PromQLLabels } from "./PromQLLabels";
|
|
2
|
+
export declare const comparePromQLText: (a: string, b: string) => number;
|
|
3
|
+
export declare const promQLNaturalLess: (a: string, b: string) => boolean;
|
|
4
|
+
export declare const comparePromQLLabelValues: (a: string, b: string) => number;
|
|
5
|
+
export declare const comparePromQLLabelSets: (a: PromQLLabels, b: PromQLLabels) => number;
|
|
6
|
+
export declare const sortPromQLByLabels: <T extends {
|
|
7
|
+
labels: PromQLLabels;
|
|
8
|
+
}>(items: ReadonlyArray<T>, names: ReadonlyArray<string>, descending: boolean) => Array<T>;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortPromQLByLabels = exports.comparePromQLLabelSets = exports.comparePromQLLabelValues = exports.promQLNaturalLess = exports.comparePromQLText = void 0;
|
|
4
|
+
const PromQLLabels_1 = require("./PromQLLabels");
|
|
5
|
+
/*
|
|
6
|
+
* The orders Prometheus puts label values and label sets in, for
|
|
7
|
+
* sort_by_label() and sort_by_label_desc() (funcSortByLabel and
|
|
8
|
+
* funcSortByLabelDesc in promql/functions.go): label values in natural order
|
|
9
|
+
* (github.com/facette/natsort), and samples whose named labels are all equal
|
|
10
|
+
* by their whole label sets (labels.Compare).
|
|
11
|
+
*
|
|
12
|
+
* Go compares strings byte by byte in UTF-8, which is code point order.
|
|
13
|
+
* JavaScript's < compares UTF-16 code units, which puts U+10000 and above
|
|
14
|
+
* (written as surrogates, D800-DFFF) before U+E000-U+FFFF, so "😀" < "�"
|
|
15
|
+
* in JavaScript and the other way round in Go. Every comparison of text here
|
|
16
|
+
* is in code point order, as Go's.
|
|
17
|
+
*/
|
|
18
|
+
const SURROGATE_START = 0xd800;
|
|
19
|
+
const PRIVATE_USE_START = 0xe000;
|
|
20
|
+
/*
|
|
21
|
+
* Where a UTF-16 code unit sits in code point order: surrogates, which
|
|
22
|
+
* write U+10000 and above, after every other code unit.
|
|
23
|
+
*/
|
|
24
|
+
const codeUnitRank = (unit) => {
|
|
25
|
+
if (unit < SURROGATE_START) {
|
|
26
|
+
return unit;
|
|
27
|
+
}
|
|
28
|
+
return unit >= PRIVATE_USE_START ? unit - 0x800 : unit + 0x2000;
|
|
29
|
+
};
|
|
30
|
+
// Go's strings.Compare: -1, 0 or 1, in code point order.
|
|
31
|
+
const comparePromQLText = (a, b) => {
|
|
32
|
+
const shared = Math.min(a.length, b.length);
|
|
33
|
+
for (let index = 0; index < shared; index++) {
|
|
34
|
+
const unitA = a.charCodeAt(index);
|
|
35
|
+
const unitB = b.charCodeAt(index);
|
|
36
|
+
if (unitA !== unitB) {
|
|
37
|
+
return codeUnitRank(unitA) < codeUnitRank(unitB) ? -1 : 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return Math.sign(a.length - b.length);
|
|
41
|
+
};
|
|
42
|
+
exports.comparePromQLText = comparePromQLText;
|
|
43
|
+
// natsort's chunkify, `(\d+|\D+)`: runs of ASCII digits and runs of the rest.
|
|
44
|
+
const CHUNK_REGEX = /\d+|\D+/g;
|
|
45
|
+
const DIGITS_REGEX = /^\d+$/;
|
|
46
|
+
const LEADING_ZEROS_REGEX = /^0+(?=\d)/;
|
|
47
|
+
// The largest int, on the 64-bit machines Prometheus runs on.
|
|
48
|
+
const INT64_MAX = "9223372036854775807";
|
|
49
|
+
const chunksOf = (text) => {
|
|
50
|
+
return text.match(CHUNK_REGEX) || [];
|
|
51
|
+
};
|
|
52
|
+
/*
|
|
53
|
+
* strconv.Atoi of a chunk, as the digits of its value without leading zeros:
|
|
54
|
+
* undefined for a chunk that is not a number, and for one past int64, which
|
|
55
|
+
* Atoi refuses as out of range.
|
|
56
|
+
*/
|
|
57
|
+
const intOf = (chunk) => {
|
|
58
|
+
if (!DIGITS_REGEX.test(chunk)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const digits = chunk.replace(LEADING_ZEROS_REGEX, "");
|
|
62
|
+
if (digits.length > INT64_MAX.length ||
|
|
63
|
+
(digits.length === INT64_MAX.length && digits > INT64_MAX)) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
return digits;
|
|
67
|
+
};
|
|
68
|
+
// Two numbers' digits, leading zeros dropped, compared as the numbers.
|
|
69
|
+
const compareInts = (a, b) => {
|
|
70
|
+
if (a.length !== b.length) {
|
|
71
|
+
return a.length < b.length ? -1 : 1;
|
|
72
|
+
}
|
|
73
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
74
|
+
};
|
|
75
|
+
/*
|
|
76
|
+
* natsort.Compare: whether a comes before b in natural order. The two are
|
|
77
|
+
* read chunk by chunk; two numbers compare as numbers, anything else as
|
|
78
|
+
* text, and when every chunk so far is equal the string that runs out of
|
|
79
|
+
* chunks first comes first.
|
|
80
|
+
*
|
|
81
|
+
* A port, quirks and all. A number past int64 compares as text, so
|
|
82
|
+
* "10000000000000000000000" comes before "5". And it answers false both ways
|
|
83
|
+
* round for "" and any other value, and true both ways round for values that
|
|
84
|
+
* differ only in leading zeros ("01" and "1"): comparePromQLLabelValues says
|
|
85
|
+
* what OneUptime does then.
|
|
86
|
+
*/
|
|
87
|
+
const promQLNaturalLess = (a, b) => {
|
|
88
|
+
const chunksA = chunksOf(a);
|
|
89
|
+
const chunksB = chunksOf(b);
|
|
90
|
+
for (let index = 0; index < chunksA.length; index++) {
|
|
91
|
+
if (index >= chunksB.length) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const chunkA = chunksA[index];
|
|
95
|
+
const chunkB = chunksB[index];
|
|
96
|
+
const intA = intOf(chunkA);
|
|
97
|
+
const intB = intOf(chunkB);
|
|
98
|
+
const order = intA !== undefined && intB !== undefined
|
|
99
|
+
? compareInts(intA, intB)
|
|
100
|
+
: (0, exports.comparePromQLText)(chunkA, chunkB);
|
|
101
|
+
if (order !== 0) {
|
|
102
|
+
return order < 0;
|
|
103
|
+
}
|
|
104
|
+
if (index === chunksA.length - 1) {
|
|
105
|
+
// a has run out: b is after it.
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (index === chunksB.length - 1) {
|
|
109
|
+
// b has run out: a is after it.
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
};
|
|
115
|
+
exports.promQLNaturalLess = promQLNaturalLess;
|
|
116
|
+
/*
|
|
117
|
+
* How sort_by_label() orders two values of a label it sorts by: -1, 0 or 1.
|
|
118
|
+
* Equal values tie, and the next label decides. Otherwise natural order, as
|
|
119
|
+
* Prometheus sorts, wherever natsort answers one way round: "a9" before
|
|
120
|
+
* "a10", "B" before "a" (an upper-case letter is a smaller byte), "1.9"
|
|
121
|
+
* before "1.10".
|
|
122
|
+
*
|
|
123
|
+
* Where natsort gives the same answer both ways round, an empty value (a
|
|
124
|
+
* missing label) against any other and "01" against "1", Prometheus' own
|
|
125
|
+
* order is the order the series happened to come in, which no query can
|
|
126
|
+
* know. There, OneUptime compares the values as text, as Go would: a
|
|
127
|
+
* missing label first ("" before anything), "001" before "01" before "1".
|
|
128
|
+
* So a query gives the same order every time.
|
|
129
|
+
*/
|
|
130
|
+
const comparePromQLLabelValues = (a, b) => {
|
|
131
|
+
if (a === b) {
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
const aFirst = (0, exports.promQLNaturalLess)(a, b);
|
|
135
|
+
const bFirst = (0, exports.promQLNaturalLess)(b, a);
|
|
136
|
+
if (aFirst !== bFirst) {
|
|
137
|
+
return aFirst ? -1 : 1;
|
|
138
|
+
}
|
|
139
|
+
return (0, exports.comparePromQLText)(a, b);
|
|
140
|
+
};
|
|
141
|
+
exports.comparePromQLLabelValues = comparePromQLLabelValues;
|
|
142
|
+
/*
|
|
143
|
+
* A label set's names in the order Prometheus keeps them, by code point.
|
|
144
|
+
* A label with an empty value is not a label (PromQLLabels).
|
|
145
|
+
*/
|
|
146
|
+
const namesInOrder = (labels) => {
|
|
147
|
+
return Object.keys(labels)
|
|
148
|
+
.filter((name) => {
|
|
149
|
+
return (0, PromQLLabels_1.promQLLabelValue)(labels, name) !== "";
|
|
150
|
+
})
|
|
151
|
+
.sort(exports.comparePromQLText);
|
|
152
|
+
};
|
|
153
|
+
const compareNamedLabelSets = (a, namesA, b, namesB) => {
|
|
154
|
+
const shared = Math.min(namesA.length, namesB.length);
|
|
155
|
+
for (let index = 0; index < shared; index++) {
|
|
156
|
+
const nameA = namesA[index];
|
|
157
|
+
const nameB = namesB[index];
|
|
158
|
+
const nameOrder = (0, exports.comparePromQLText)(nameA, nameB);
|
|
159
|
+
if (nameOrder !== 0) {
|
|
160
|
+
return nameOrder;
|
|
161
|
+
}
|
|
162
|
+
const valueOrder = (0, exports.comparePromQLText)((0, PromQLLabels_1.promQLLabelValue)(a, nameA), (0, PromQLLabels_1.promQLLabelValue)(b, nameB));
|
|
163
|
+
if (valueOrder !== 0) {
|
|
164
|
+
return valueOrder;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return Math.sign(namesA.length - namesB.length);
|
|
168
|
+
};
|
|
169
|
+
/*
|
|
170
|
+
* Prometheus' labels.Compare: -1, 0 or 1. Label by label in name order, the
|
|
171
|
+
* metric name among them: a smaller name first, then a smaller value; when
|
|
172
|
+
* one set runs out with every label so far the same, the shorter set first.
|
|
173
|
+
* So {a="z", g="1"} comes before {b="a", g="1"}: the names differ before the
|
|
174
|
+
* values are read.
|
|
175
|
+
*/
|
|
176
|
+
const comparePromQLLabelSets = (a, b) => {
|
|
177
|
+
return compareNamedLabelSets(a, namesInOrder(a), b, namesInOrder(b));
|
|
178
|
+
};
|
|
179
|
+
exports.comparePromQLLabelSets = comparePromQLLabelSets;
|
|
180
|
+
/*
|
|
181
|
+
* sort_by_label(): the items by the values of the named labels, the first
|
|
182
|
+
* label first, and items equal on all of them by their whole label sets.
|
|
183
|
+
* sort_by_label_desc() is the same order backwards, its ties included, as
|
|
184
|
+
* Prometheus sorts them (-labels.Compare).
|
|
185
|
+
*/
|
|
186
|
+
const sortPromQLByLabels = (items, names, descending) => {
|
|
187
|
+
const direction = descending ? -1 : 1;
|
|
188
|
+
return items
|
|
189
|
+
.map((item) => {
|
|
190
|
+
return {
|
|
191
|
+
item,
|
|
192
|
+
values: names.map((name) => {
|
|
193
|
+
return (0, PromQLLabels_1.promQLLabelValue)(item.labels, name);
|
|
194
|
+
}),
|
|
195
|
+
names: namesInOrder(item.labels),
|
|
196
|
+
};
|
|
197
|
+
})
|
|
198
|
+
.sort((a, b) => {
|
|
199
|
+
for (let index = 0; index < a.values.length; index++) {
|
|
200
|
+
const order = (0, exports.comparePromQLLabelValues)(a.values[index], b.values[index]);
|
|
201
|
+
if (order !== 0) {
|
|
202
|
+
return order * direction;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return (compareNamedLabelSets(a.item.labels, a.names, b.item.labels, b.names) *
|
|
206
|
+
direction);
|
|
207
|
+
})
|
|
208
|
+
.map((entry) => {
|
|
209
|
+
return entry.item;
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
exports.sortPromQLByLabels = sortPromQLByLabels;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import commonJsModule from "./PromQLLabelOrder.js";
|
|
2
|
+
export const comparePromQLLabelSets = commonJsModule.comparePromQLLabelSets;
|
|
3
|
+
export const comparePromQLLabelValues = commonJsModule.comparePromQLLabelValues;
|
|
4
|
+
export const comparePromQLText = commonJsModule.comparePromQLText;
|
|
5
|
+
export const promQLNaturalLess = commonJsModule.promQLNaturalLess;
|
|
6
|
+
export const sortPromQLByLabels = commonJsModule.sortPromQLByLabels;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PromQLLabelMatcher } from "./PromQLAst.mjs";
|
|
2
|
+
export type PromQLLabels = Record<string, string>;
|
|
3
|
+
export declare const promQLLabelValue: (labels: PromQLLabels, name: string) => string;
|
|
4
|
+
export declare const promQLLabelsKey: (labels: PromQLLabels) => string;
|
|
5
|
+
export declare const dropMetricName: (labels: PromQLLabels) => PromQLLabels;
|
|
6
|
+
export declare const promQLMatchSignature: (labels: PromQLLabels, on: boolean, names: Array<string>) => string;
|
|
7
|
+
export type PromQLLabelsTest = (labels: PromQLLabels) => boolean;
|
|
8
|
+
export declare const compilePromQLMatchers: (matchers: Array<PromQLLabelMatcher>) => PromQLLabelsTest;
|
|
9
|
+
export declare const matchesPromQLMatchers: (labels: PromQLLabels, matchers: Array<PromQLLabelMatcher>) => boolean;
|
|
10
|
+
export declare const formatPromQLLabels: (labels: PromQLLabels) => string;
|
|
11
|
+
export declare const formatPromQLValue: (value: number) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PromQLLabelMatcher } from "./PromQLAst";
|
|
2
|
+
export type PromQLLabels = Record<string, string>;
|
|
3
|
+
export declare const promQLLabelValue: (labels: PromQLLabels, name: string) => string;
|
|
4
|
+
export declare const promQLLabelsKey: (labels: PromQLLabels) => string;
|
|
5
|
+
export declare const dropMetricName: (labels: PromQLLabels) => PromQLLabels;
|
|
6
|
+
export declare const promQLMatchSignature: (labels: PromQLLabels, on: boolean, names: Array<string>) => string;
|
|
7
|
+
export type PromQLLabelsTest = (labels: PromQLLabels) => boolean;
|
|
8
|
+
export declare const compilePromQLMatchers: (matchers: Array<PromQLLabelMatcher>) => PromQLLabelsTest;
|
|
9
|
+
export declare const matchesPromQLMatchers: (labels: PromQLLabels, matchers: Array<PromQLLabelMatcher>) => boolean;
|
|
10
|
+
export declare const formatPromQLLabels: (labels: PromQLLabels) => string;
|
|
11
|
+
export declare const formatPromQLValue: (value: number) => string;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.formatPromQLValue = exports.formatPromQLLabels = exports.matchesPromQLMatchers = exports.compilePromQLMatchers = exports.promQLMatchSignature = exports.dropMetricName = exports.promQLLabelsKey = exports.promQLLabelValue = void 0;
|
|
37
|
+
const PromQLAst_1 = require("./PromQLAst");
|
|
38
|
+
const PromQLError_1 = __importStar(require("./PromQLError"));
|
|
39
|
+
const PromQLRegex_1 = require("./PromQLRegex");
|
|
40
|
+
const PatternProblem_1 = require("../LinearRegExp/PatternProblem");
|
|
41
|
+
const LookupTable_1 = require("../LookupTable");
|
|
42
|
+
const SEPARATOR = "\xff";
|
|
43
|
+
/*
|
|
44
|
+
* A label's value, "" for a label the series does not have: never what
|
|
45
|
+
* every object inherits, since a label may be named constructor or toString.
|
|
46
|
+
*/
|
|
47
|
+
const promQLLabelValue = (labels, name) => {
|
|
48
|
+
return Object.prototype.hasOwnProperty.call(labels, name)
|
|
49
|
+
? labels[name] || ""
|
|
50
|
+
: "";
|
|
51
|
+
};
|
|
52
|
+
exports.promQLLabelValue = promQLLabelValue;
|
|
53
|
+
// One string per label set, the same for the same labels in any order.
|
|
54
|
+
const promQLLabelsKey = (labels) => {
|
|
55
|
+
const names = Object.keys(labels).sort();
|
|
56
|
+
let key = "";
|
|
57
|
+
for (const name of names) {
|
|
58
|
+
key += `${name}${SEPARATOR}${labels[name]}${SEPARATOR}`;
|
|
59
|
+
}
|
|
60
|
+
return key;
|
|
61
|
+
};
|
|
62
|
+
exports.promQLLabelsKey = promQLLabelsKey;
|
|
63
|
+
const dropMetricName = (labels) => {
|
|
64
|
+
if (labels[PromQLAst_1.PROMQL_METRIC_NAME_LABEL] === undefined) {
|
|
65
|
+
return labels;
|
|
66
|
+
}
|
|
67
|
+
const copy = (0, LookupTable_1.copyOwnValues)(labels);
|
|
68
|
+
delete copy[PromQLAst_1.PROMQL_METRIC_NAME_LABEL];
|
|
69
|
+
return copy;
|
|
70
|
+
};
|
|
71
|
+
exports.dropMetricName = dropMetricName;
|
|
72
|
+
/*
|
|
73
|
+
* The key two series match on: only the listed labels for `on (...)`, every
|
|
74
|
+
* label but the listed ones and the metric name otherwise.
|
|
75
|
+
*/
|
|
76
|
+
const promQLMatchSignature = (labels, on, names) => {
|
|
77
|
+
if (on) {
|
|
78
|
+
let key = "";
|
|
79
|
+
for (const name of [...names].sort()) {
|
|
80
|
+
key += `${name}${SEPARATOR}${(0, exports.promQLLabelValue)(labels, name)}${SEPARATOR}`;
|
|
81
|
+
}
|
|
82
|
+
return key;
|
|
83
|
+
}
|
|
84
|
+
const ignored = new Set(names);
|
|
85
|
+
ignored.add(PromQLAst_1.PROMQL_METRIC_NAME_LABEL);
|
|
86
|
+
const kept = {};
|
|
87
|
+
for (const name of Object.keys(labels)) {
|
|
88
|
+
if (!ignored.has(name)) {
|
|
89
|
+
(0, LookupTable_1.writeOwnValue)(kept, name, labels[name]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return (0, exports.promQLLabelsKey)(kept);
|
|
93
|
+
};
|
|
94
|
+
exports.promQLMatchSignature = promQLMatchSignature;
|
|
95
|
+
/*
|
|
96
|
+
* Whether a matcher's pattern matches a value. A question the linear-time
|
|
97
|
+
* matcher stops at its work limit has no answer, and a query does not
|
|
98
|
+
* answer without it: it is refused, with a sentence that names the pattern.
|
|
99
|
+
*/
|
|
100
|
+
const testMatcherPattern = (regex, matcher, value) => {
|
|
101
|
+
try {
|
|
102
|
+
return regex.test(value);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
if (error instanceof PatternProblem_1.PatternWorkLimitError) {
|
|
106
|
+
throw new PromQLError_1.default(`The pattern "${matcher.value}" for the label "${matcher.name}" needed more work to match one of the label's values than the value's length allows. Write a simpler pattern.`, PromQLError_1.PromQLErrorType.Execution);
|
|
107
|
+
}
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
// One matcher, its pattern compiled once (PromQLRegex).
|
|
112
|
+
const compilePromQLMatcher = (matcher) => {
|
|
113
|
+
switch (matcher.type) {
|
|
114
|
+
case PromQLAst_1.PromQLMatchType.Equal:
|
|
115
|
+
return (labels) => {
|
|
116
|
+
return (0, exports.promQLLabelValue)(labels, matcher.name) === matcher.value;
|
|
117
|
+
};
|
|
118
|
+
case PromQLAst_1.PromQLMatchType.NotEqual:
|
|
119
|
+
return (labels) => {
|
|
120
|
+
return (0, exports.promQLLabelValue)(labels, matcher.name) !== matcher.value;
|
|
121
|
+
};
|
|
122
|
+
case PromQLAst_1.PromQLMatchType.RegexMatch:
|
|
123
|
+
case PromQLAst_1.PromQLMatchType.RegexNoMatch: {
|
|
124
|
+
const regex = (0, PromQLRegex_1.compilePromQLRegex)(matcher.value).regex;
|
|
125
|
+
const wanted = matcher.type === PromQLAst_1.PromQLMatchType.RegexMatch;
|
|
126
|
+
return (labels) => {
|
|
127
|
+
return (testMatcherPattern(regex, matcher, (0, exports.promQLLabelValue)(labels, matcher.name)) === wanted);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
/*
|
|
133
|
+
* A selector's matchers, compiled once for the series one query reads: a
|
|
134
|
+
* pattern is compiled here, not once per series. The parser has checked
|
|
135
|
+
* every pattern (PromQLParser), so each compiles.
|
|
136
|
+
*/
|
|
137
|
+
const compilePromQLMatchers = (matchers) => {
|
|
138
|
+
const tests = matchers.map(compilePromQLMatcher);
|
|
139
|
+
return (labels) => {
|
|
140
|
+
for (const test of tests) {
|
|
141
|
+
if (!test(labels)) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
exports.compilePromQLMatchers = compilePromQLMatchers;
|
|
149
|
+
/*
|
|
150
|
+
* Whether one series' labels satisfy every matcher of a selector. A read of
|
|
151
|
+
* many series compiles the matchers once instead (compilePromQLMatchers).
|
|
152
|
+
*/
|
|
153
|
+
const matchesPromQLMatchers = (labels, matchers) => {
|
|
154
|
+
return (0, exports.compilePromQLMatchers)(matchers)(labels);
|
|
155
|
+
};
|
|
156
|
+
exports.matchesPromQLMatchers = matchesPromQLMatchers;
|
|
157
|
+
/*
|
|
158
|
+
* A label set the way Prometheus prints one: `up{instance="a", job="api"}`,
|
|
159
|
+
* or `{job="api"}` without a metric name.
|
|
160
|
+
*/
|
|
161
|
+
const formatPromQLLabels = (labels) => {
|
|
162
|
+
const name = labels[PromQLAst_1.PROMQL_METRIC_NAME_LABEL] || "";
|
|
163
|
+
const pairs = Object.keys(labels)
|
|
164
|
+
.filter((label) => {
|
|
165
|
+
return label !== PromQLAst_1.PROMQL_METRIC_NAME_LABEL;
|
|
166
|
+
})
|
|
167
|
+
.sort()
|
|
168
|
+
.map((label) => {
|
|
169
|
+
return `${label}=${JSON.stringify(labels[label])}`;
|
|
170
|
+
});
|
|
171
|
+
if (pairs.length === 0) {
|
|
172
|
+
return name.length > 0 ? name : "{}";
|
|
173
|
+
}
|
|
174
|
+
return `${name}{${pairs.join(", ")}}`;
|
|
175
|
+
};
|
|
176
|
+
exports.formatPromQLLabels = formatPromQLLabels;
|
|
177
|
+
/*
|
|
178
|
+
* A sample value the way the Prometheus HTTP API writes it: a string, with
|
|
179
|
+
* the special values spelled "NaN", "+Inf" and "-Inf", and never in
|
|
180
|
+
* exponent notation (Go's strconv.FormatFloat(v, 'f', -1, 64)).
|
|
181
|
+
*/
|
|
182
|
+
const formatPromQLValue = (value) => {
|
|
183
|
+
if (Number.isNaN(value)) {
|
|
184
|
+
return "NaN";
|
|
185
|
+
}
|
|
186
|
+
if (value === Infinity) {
|
|
187
|
+
return "+Inf";
|
|
188
|
+
}
|
|
189
|
+
if (value === -Infinity) {
|
|
190
|
+
return "-Inf";
|
|
191
|
+
}
|
|
192
|
+
const text = String(value);
|
|
193
|
+
if (!text.includes("e")) {
|
|
194
|
+
return text;
|
|
195
|
+
}
|
|
196
|
+
return expandExponent(text);
|
|
197
|
+
};
|
|
198
|
+
exports.formatPromQLValue = formatPromQLValue;
|
|
199
|
+
// "1.5e-7" is "0.00000015"; "1e+21" is "1000000000000000000000".
|
|
200
|
+
const expandExponent = (text) => {
|
|
201
|
+
const negative = text.startsWith("-");
|
|
202
|
+
const unsigned = negative ? text.slice(1) : text;
|
|
203
|
+
const [mantissa, exponentText] = unsigned.split("e");
|
|
204
|
+
const exponent = Number(exponentText);
|
|
205
|
+
const [integerPart, fractionPart] = mantissa.split(".");
|
|
206
|
+
const digits = `${integerPart}${fractionPart || ""}`;
|
|
207
|
+
const pointPosition = integerPart.length + exponent;
|
|
208
|
+
let result;
|
|
209
|
+
if (pointPosition <= 0) {
|
|
210
|
+
result = `0.${"0".repeat(-pointPosition)}${digits}`;
|
|
211
|
+
}
|
|
212
|
+
else if (pointPosition >= digits.length) {
|
|
213
|
+
result = `${digits}${"0".repeat(pointPosition - digits.length)}`;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
result = `${digits.slice(0, pointPosition)}.${digits.slice(pointPosition)}`;
|
|
217
|
+
}
|
|
218
|
+
return negative ? `-${result}` : result;
|
|
219
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import commonJsModule from "./PromQLLabels.js";
|
|
2
|
+
export const compilePromQLMatchers = commonJsModule.compilePromQLMatchers;
|
|
3
|
+
export const dropMetricName = commonJsModule.dropMetricName;
|
|
4
|
+
export const formatPromQLLabels = commonJsModule.formatPromQLLabels;
|
|
5
|
+
export const formatPromQLValue = commonJsModule.formatPromQLValue;
|
|
6
|
+
export const matchesPromQLMatchers = commonJsModule.matchesPromQLMatchers;
|
|
7
|
+
export const promQLLabelValue = commonJsModule.promQLLabelValue;
|
|
8
|
+
export const promQLLabelsKey = commonJsModule.promQLLabelsKey;
|
|
9
|
+
export const promQLMatchSignature = commonJsModule.promQLMatchSignature;
|