@oneuptime/common 14.0.10 → 14.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (837) hide show
  1. package/Models/DatabaseModels/AIConversation.ts +127 -1
  2. package/Models/DatabaseModels/CephCluster.ts +12 -0
  3. package/Models/DatabaseModels/CloudResource.ts +12 -0
  4. package/Models/DatabaseModels/DatabaseServer.ts +12 -0
  5. package/Models/DatabaseModels/DockerHost.ts +12 -0
  6. package/Models/DatabaseModels/DockerSwarmCluster.ts +12 -0
  7. package/Models/DatabaseModels/GlobalOidc.ts +0 -4
  8. package/Models/DatabaseModels/GlobalOidcProject.ts +0 -4
  9. package/Models/DatabaseModels/GlobalSso.ts +0 -4
  10. package/Models/DatabaseModels/GlobalSsoProject.ts +0 -4
  11. package/Models/DatabaseModels/Host.ts +12 -0
  12. package/Models/DatabaseModels/IncidentForm.ts +594 -0
  13. package/Models/DatabaseModels/IncidentFormSubmission.ts +283 -0
  14. package/Models/DatabaseModels/IncidentTemplate.ts +59 -0
  15. package/Models/DatabaseModels/Index.ts +14 -0
  16. package/Models/DatabaseModels/IoTFleet.ts +12 -0
  17. package/Models/DatabaseModels/KubernetesCluster.ts +12 -0
  18. package/Models/DatabaseModels/MessageQueue.ts +1102 -0
  19. package/Models/DatabaseModels/MessageQueueLabelRule.ts +553 -0
  20. package/Models/DatabaseModels/MessageQueueOwnerRule.ts +633 -0
  21. package/Models/DatabaseModels/MessageQueueOwnerTeam.ts +491 -0
  22. package/Models/DatabaseModels/MessageQueueOwnerUser.ts +490 -0
  23. package/Models/DatabaseModels/PodmanHost.ts +12 -0
  24. package/Models/DatabaseModels/Project.ts +59 -0
  25. package/Models/DatabaseModels/ProjectOidc.ts +0 -4
  26. package/Models/DatabaseModels/ProjectSso.ts +0 -4
  27. package/Models/DatabaseModels/ProxmoxCluster.ts +12 -0
  28. package/Models/DatabaseModels/RumApplication.ts +12 -0
  29. package/Models/DatabaseModels/ServerlessFunction.ts +12 -0
  30. package/Models/DatabaseModels/Service.ts +12 -0
  31. package/Models/DatabaseModels/StatusPageOidc.ts +0 -4
  32. package/Models/DatabaseModels/StatusPageSso.ts +0 -4
  33. package/Models/DatabaseModels/TeamComplianceSetting.ts +47 -2
  34. package/Models/DatabaseModels/VMwareVCenter.ts +12 -0
  35. package/Server/API/AIChatAPI.ts +13 -114
  36. package/Server/API/AIInvestigationAPI.ts +3 -3
  37. package/Server/API/AIInvestigationConversationAPI.ts +266 -0
  38. package/Server/API/IncidentFormAPI.ts +376 -0
  39. package/Server/API/ProjectOIDC.ts +16 -25
  40. package/Server/API/ProjectSSO.ts +16 -24
  41. package/Server/API/StatusPageAPI.ts +42 -77
  42. package/Server/Enterprise/EnterpriseEdition.ts +93 -28
  43. package/Server/Enterprise/EnterpriseFeature.ts +25 -3
  44. package/Server/Enterprise/EnterpriseLicenseSnapshot.ts +1 -1
  45. package/Server/Enterprise/EnterpriseServerModule.ts +4 -1
  46. package/Server/EnvironmentConfig.ts +1 -1
  47. package/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.ts +129 -0
  48. package/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.ts +52 -0
  49. package/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.ts +75 -0
  50. package/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.ts +477 -0
  51. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
  52. package/Server/Middleware/IncidentFormRateLimit.ts +847 -0
  53. package/Server/Middleware/UserAuthorization.ts +16 -38
  54. package/Server/Services/AIService.ts +10 -13
  55. package/Server/Services/IncidentCustomFieldService.ts +112 -2
  56. package/Server/Services/IncidentEpisodeMemberService.ts +24 -4
  57. package/Server/Services/IncidentEpisodeService.ts +10 -1
  58. package/Server/Services/IncidentFormService.ts +1566 -0
  59. package/Server/Services/IncidentFormSubmissionService.ts +97 -0
  60. package/Server/Services/IncidentGroupingEngineService.ts +45 -8
  61. package/Server/Services/IncidentService.ts +123 -5
  62. package/Server/Services/IncidentTemplateService.ts +22 -0
  63. package/Server/Services/Index.ts +14 -0
  64. package/Server/Services/MessageQueueLabelRuleEngineService.ts +321 -0
  65. package/Server/Services/MessageQueueLabelRuleService.ts +14 -0
  66. package/Server/Services/MessageQueueOwnerRuleEngineService.ts +412 -0
  67. package/Server/Services/MessageQueueOwnerRuleService.ts +14 -0
  68. package/Server/Services/MessageQueueOwnerTeamService.ts +62 -0
  69. package/Server/Services/MessageQueueOwnerUserService.ts +62 -0
  70. package/Server/Services/MessageQueueService.ts +1463 -0
  71. package/Server/Services/OpenTelemetryIngestService.ts +37 -4
  72. package/Server/Services/ProjectService.ts +0 -59
  73. package/Server/Services/StatusPagePrivateUserService.ts +1 -4
  74. package/Server/Services/StatusPageService.ts +1 -51
  75. package/Server/Services/TeamComplianceSettingService.ts +163 -42
  76. package/Server/Services/UserNotificationRuleService.ts +8 -1
  77. package/Server/Services/WorkspaceNotificationSummaryService.ts +12 -3
  78. package/Server/Types/Database/Permissions/CreatePermission.ts +17 -3
  79. package/Server/Types/Database/Permissions/EditionPermission.ts +140 -38
  80. package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +16 -0
  81. package/Server/Types/Database/Permissions/TablePermission.ts +3 -3
  82. package/Server/Types/Database/Permissions/UpdatePermission.ts +20 -6
  83. package/Server/Utils/AI/Chat/AgentContextCompactor.ts +200 -0
  84. package/Server/Utils/AI/Chat/ChatAgentRunner.ts +307 -48
  85. package/Server/Utils/AI/Chat/ChatRunCancellation.ts +156 -0
  86. package/Server/Utils/AI/Chat/ObservabilityAssistant.ts +78 -18
  87. package/Server/Utils/AI/Chat/ObservabilityChatPrompt.ts +1 -1
  88. package/Server/Utils/AI/Chat/ToolOutputPager.ts +322 -0
  89. package/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.ts +88 -30
  90. package/Server/Utils/AI/ClusterAccess/KubectlJobRunner.ts +13 -1
  91. package/Server/Utils/AI/CodeFix/CodeFixReadiness.ts +0 -32
  92. package/Server/Utils/AI/CodeFix/FixRunBudget.ts +27 -25
  93. package/Server/Utils/AI/Remediation/RemediationCommandTools.ts +7 -1
  94. package/Server/Utils/AI/Remediation/RemediationExecutionRunner.ts +34 -14
  95. package/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.ts +69 -24
  96. package/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.ts +9 -0
  97. package/Server/Utils/AI/SRE/AIInvestigationEngine.ts +53 -10
  98. package/Server/Utils/AI/SRE/AlertInvestigationRunner.ts +27 -10
  99. package/Server/Utils/AI/SRE/IncidentInvestigationRunner.ts +27 -10
  100. package/Server/Utils/AI/SRE/InvestigationQueue.ts +16 -19
  101. package/Server/Utils/AI/SRE/InvestigationThread.ts +646 -0
  102. package/Server/Utils/AI/SRE/InvestigationThreadService.ts +715 -0
  103. package/Server/Utils/AI/Toolbox/Serializer.ts +10 -3
  104. package/Server/Utils/EditionEnforcement.ts +19 -202
  105. package/Server/Utils/LLM/LLMService.ts +259 -63
  106. package/Server/Utils/RelaxedScimTeamLocksReport.ts +245 -0
  107. package/Server/Utils/Rules/RuleRun/RuleRunRegistry.ts +25 -0
  108. package/Server/Utils/SameOriginRequest.ts +203 -0
  109. package/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.ts +2 -0
  110. package/Server/Utils/Telemetry/EntityRegistry.ts +4 -1
  111. package/Server/Utils/Telemetry/MessageQueueDiscovery.ts +1402 -0
  112. package/Server/Utils/Telemetry/ResourceEntityFilter.ts +4 -1
  113. package/Server/Utils/VendorAssets.ts +3 -3
  114. package/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.ts +3 -1
  115. package/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.ts +3 -1
  116. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +10 -1
  117. package/Tests/App/Accounts/IncidentFormPage.test.tsx +2036 -0
  118. package/Tests/App/Accounts/IncidentFormServerMessages.test.ts +119 -0
  119. package/Tests/App/Accounts/IncidentFormUtils.test.ts +1157 -0
  120. package/Tests/App/Accounts/LoginPasskey.test.tsx +6 -4
  121. package/Tests/App/Accounts/LoginSso.test.tsx +724 -0
  122. package/Tests/App/AdminDashboard/AdminAuthenticationRequireSso.test.tsx +338 -0
  123. package/Tests/App/AdminDashboard/AdminAuthenticationSsoCardLocales.test.tsx +331 -0
  124. package/Tests/App/AdminDashboard/AdminEnterprisePluginPage.test.tsx +47 -33
  125. package/Tests/App/AdminDashboard/GlobalSsoOidcPages.test.tsx +1021 -0
  126. package/Tests/App/Dashboard/AffectedResourcesDisplay.test.tsx +876 -78
  127. package/Tests/App/Dashboard/AffectedResourcesSlo.test.tsx +20 -3
  128. package/Tests/App/Dashboard/CephProxmoxVMwareDocumentationCards.test.tsx +359 -0
  129. package/Tests/App/Dashboard/CephSetupGuide.test.ts +961 -0
  130. package/Tests/App/Dashboard/CloudDocumentationCard.test.tsx +381 -95
  131. package/Tests/App/Dashboard/CloudSetupGuide.test.ts +1463 -0
  132. package/Tests/App/Dashboard/ClusterAccessNotice.test.tsx +174 -12
  133. package/Tests/App/Dashboard/ContainerSetupGuideCards.test.tsx +345 -0
  134. package/Tests/App/Dashboard/CoreListEmptyStates.test.tsx +501 -0
  135. package/Tests/App/Dashboard/DashboardLazyPages.test.tsx +0 -1
  136. package/Tests/App/Dashboard/DatabaseDocumentationCard.test.tsx +400 -0
  137. package/Tests/App/Dashboard/DatabaseDocumentationMarkdown.test.ts +5 -0
  138. package/Tests/App/Dashboard/DatabaseSetupGuide.test.ts +1869 -0
  139. package/Tests/App/Dashboard/DatabaseTelemetryScope.test.ts +44 -0
  140. package/Tests/App/Dashboard/DatabaseTelemetryTabs.test.tsx +50 -9
  141. package/Tests/App/Dashboard/DockerSetupGuide.test.ts +899 -0
  142. package/Tests/App/Dashboard/DockerSwarmSetupGuide.test.ts +964 -0
  143. package/Tests/App/Dashboard/EnterpriseFeatureUpgrade.test.tsx +141 -7
  144. package/Tests/App/Dashboard/EnterprisePluginPage.test.tsx +52 -39
  145. package/Tests/App/Dashboard/EventOverviewPages.test.tsx +7 -1
  146. package/Tests/App/Dashboard/GettingStartedTaskRoutes.test.tsx +331 -0
  147. package/Tests/App/Dashboard/HomeOverviewStatsFirstRun.test.tsx +925 -0
  148. package/Tests/App/Dashboard/HostDocumentationCard.test.tsx +225 -0
  149. package/Tests/App/Dashboard/HostSetupGuide.test.ts +1183 -0
  150. package/Tests/App/Dashboard/IdentityEnterpriseShells.test.tsx +69 -45
  151. package/Tests/App/Dashboard/IncidentCreateTemplateCustomFieldSettings.test.tsx +745 -0
  152. package/Tests/App/Dashboard/IncidentCreateTemplateOwners.test.tsx +414 -0
  153. package/Tests/App/Dashboard/IncidentCustomFieldCreateSettingsForm.test.ts +1042 -0
  154. package/Tests/App/Dashboard/IncidentCustomFieldSettingsCard.test.tsx +1816 -0
  155. package/Tests/App/Dashboard/IncidentFormPlan.test.ts +89 -0
  156. package/Tests/App/Dashboard/IncidentFormShareLinkCard.test.tsx +846 -0
  157. package/Tests/App/Dashboard/IncidentFormsPages.test.tsx +1324 -0
  158. package/Tests/App/Dashboard/IncidentTemplateCustomFieldSettings.test.tsx +630 -0
  159. package/Tests/App/Dashboard/IncidentsSideMenu.test.tsx +13 -0
  160. package/Tests/App/Dashboard/IncomingEmailMonitorLinkVerifyHint.test.tsx +104 -0
  161. package/Tests/App/Dashboard/InvestigationConversation.test.tsx +1107 -0
  162. package/Tests/App/Dashboard/InvestigationConversationData.test.ts +546 -0
  163. package/Tests/App/Dashboard/InvestigationEvidenceList.test.tsx +170 -5
  164. package/Tests/App/Dashboard/InvestigationNotStarted.test.tsx +207 -2
  165. package/Tests/App/Dashboard/InvestigationPanel.test.tsx +729 -34
  166. package/Tests/App/Dashboard/InvestigationPanelStatus.test.tsx +9 -21
  167. package/Tests/App/Dashboard/InvestigationReportView.test.tsx +274 -37
  168. package/Tests/App/Dashboard/InvestigationStatusBadge.test.tsx +130 -0
  169. package/Tests/App/Dashboard/IoTDocumentationCard.test.tsx +218 -0
  170. package/Tests/App/Dashboard/IoTSetupGuide.test.ts +1124 -0
  171. package/Tests/App/Dashboard/KubernetesClusterAiAccessSettings.test.ts +20 -6
  172. package/Tests/App/Dashboard/KubernetesClusterAiDocumentationMarkdown.test.ts +107 -83
  173. package/Tests/App/Dashboard/KubernetesSetupGuide.test.ts +787 -0
  174. package/Tests/App/Dashboard/MessageQueueBreadcrumbs.test.tsx +228 -0
  175. package/Tests/App/Dashboard/MessageQueueBrokerHealth.test.tsx +1538 -0
  176. package/Tests/App/Dashboard/MessageQueueBrokerHealthMetricChart.test.tsx +969 -0
  177. package/Tests/App/Dashboard/MessageQueueBrokerHealthReads.test.ts +889 -0
  178. package/Tests/App/Dashboard/MessageQueueBrokerMetricsReach.test.ts +236 -0
  179. package/Tests/App/Dashboard/MessageQueueDocumentationCard.test.tsx +479 -0
  180. package/Tests/App/Dashboard/MessageQueueListPages.test.tsx +1232 -0
  181. package/Tests/App/Dashboard/MessageQueueMetricDescriptions.test.ts +244 -0
  182. package/Tests/App/Dashboard/MessageQueueMonitorLink.test.ts +952 -0
  183. package/Tests/App/Dashboard/MessageQueueMonitorLinkMonitorCreate.test.tsx +859 -0
  184. package/Tests/App/Dashboard/MessageQueueOverview.test.tsx +1773 -0
  185. package/Tests/App/Dashboard/MessageQueueOverviewPresentation.test.ts +196 -0
  186. package/Tests/App/Dashboard/MessageQueuePresentation.test.ts +799 -0
  187. package/Tests/App/Dashboard/MessageQueueProducersConsumers.test.tsx +680 -0
  188. package/Tests/App/Dashboard/MessageQueueRoutes.test.tsx +383 -0
  189. package/Tests/App/Dashboard/MessageQueueRulePages.test.tsx +278 -0
  190. package/Tests/App/Dashboard/MessageQueueSetupGuide.test.ts +2778 -0
  191. package/Tests/App/Dashboard/MessageQueueSideMenus.test.tsx +273 -0
  192. package/Tests/App/Dashboard/MessageQueueSpanPopulations.test.ts +930 -0
  193. package/Tests/App/Dashboard/MessageQueueSpanStore.ts +351 -0
  194. package/Tests/App/Dashboard/MessageQueueTelemetryScope.test.ts +375 -0
  195. package/Tests/App/Dashboard/MessageQueueTelemetryScopeTabs.test.tsx +668 -0
  196. package/Tests/App/Dashboard/MessageQueueViewPages.test.tsx +685 -0
  197. package/Tests/App/Dashboard/MonitorAndHomeNotOperationalMenus.test.tsx +342 -0
  198. package/Tests/App/Dashboard/MonitorCreateFirstRunDefaults.test.tsx +623 -0
  199. package/Tests/App/Dashboard/MonitorCreateFromMonitorBackedDevice.test.tsx +442 -0
  200. package/Tests/App/Dashboard/MonitorLogsPageViewSummary.test.tsx +814 -0
  201. package/Tests/App/Dashboard/MonitorSetupCardBodies.test.tsx +246 -0
  202. package/Tests/App/Dashboard/NavigationSearchKeywords.test.tsx +8 -0
  203. package/Tests/App/Dashboard/OnboardingSsoEmptyState.test.tsx +27 -12
  204. package/Tests/App/Dashboard/PlanGatedPage.test.tsx +292 -0
  205. package/Tests/App/Dashboard/PodmanSetupGuide.test.ts +948 -0
  206. package/Tests/App/Dashboard/ProductOrientation.test.tsx +5 -4
  207. package/Tests/App/Dashboard/ProductSettingsSectionCollapsed.test.tsx +266 -0
  208. package/Tests/App/Dashboard/ProxmoxSetupGuide.test.ts +1318 -0
  209. package/Tests/App/Dashboard/ResourceAiAgentAttentionServerParity.test.ts +555 -0
  210. package/Tests/App/Dashboard/ResourceAiAgentPage.test.tsx +298 -9
  211. package/Tests/App/Dashboard/ResourceAiAgentStatus.test.ts +453 -0
  212. package/Tests/App/Dashboard/ResourceArchiveSettings.test.tsx +16 -0
  213. package/Tests/App/Dashboard/ResourceConnectionGuideCard.test.tsx +444 -0
  214. package/Tests/App/Dashboard/ResourceConnectionGuideOverviewsInfra.test.tsx +798 -0
  215. package/Tests/App/Dashboard/ResourceConnectionGuideOverviewsPlatforms.test.tsx +717 -0
  216. package/Tests/App/Dashboard/ResourceConnectionGuides.test.ts +981 -0
  217. package/Tests/App/Dashboard/ResourceConnectionState.test.ts +132 -0
  218. package/Tests/App/Dashboard/RumDocumentationCard.test.tsx +293 -0
  219. package/Tests/App/Dashboard/RumSessionReplayRetentionSettings.test.tsx +467 -0
  220. package/Tests/App/Dashboard/RumSetupGuide.test.ts +758 -0
  221. package/Tests/App/Dashboard/ScheduledMaintenanceOverviewPage.test.tsx +25 -0
  222. package/Tests/App/Dashboard/ServerlessDocumentationCard.test.tsx +254 -0
  223. package/Tests/App/Dashboard/ServerlessSetupGuide.test.ts +1074 -0
  224. package/Tests/App/Dashboard/SetupGuide.test.ts +246 -0
  225. package/Tests/App/Dashboard/SetupGuideCard.test.tsx +756 -0
  226. package/Tests/App/Dashboard/SloListSideMenu.test.tsx +120 -0
  227. package/Tests/App/Dashboard/SsoPages.test.tsx +833 -0
  228. package/Tests/App/Dashboard/TelemetryDocumentation.test.tsx +253 -0
  229. package/Tests/App/Dashboard/TelemetryRetentionShells.test.tsx +730 -0
  230. package/Tests/App/Dashboard/VMwareSetupGuide.test.ts +1033 -0
  231. package/Tests/App/StatusPage/StatusPageSsoEmptyState.test.tsx +87 -7
  232. package/Tests/Models/DatabaseModels/DatabaseServerModels.test.ts +28 -9
  233. package/Tests/Models/DatabaseModels/IncidentFormModel.test.ts +1250 -0
  234. package/Tests/Models/DatabaseModels/MessageQueueModels.test.ts +1983 -0
  235. package/Tests/Models/DatabaseModels/StaticRuleCriteriaInheritance.test.ts +4 -2
  236. package/Tests/Models/DatabaseModels/TeamComplianceSettingModel.test.ts +190 -14
  237. package/Tests/Models/IncidentTemplateCustomFieldSettingsColumn.test.ts +291 -0
  238. package/Tests/Server/API/AIInvestigationConversationAPI.test.ts +412 -0
  239. package/Tests/Server/API/GlobalConfigLicense.test.ts +38 -9
  240. package/Tests/Server/API/IncidentFormAPI.test.ts +942 -0
  241. package/Tests/Server/API/IncidentFormPublicRoutes.test.ts +1653 -0
  242. package/Tests/Server/API/KubernetesClusterAiAccessAPI.test.ts +2 -1
  243. package/Tests/Server/API/{SsoProviderListingsEdition.test.ts → SsoProviderListings.test.ts} +164 -110
  244. package/Tests/Server/Enterprise/EnterpriseEdition.test.ts +76 -54
  245. package/Tests/Server/Enterprise/EnterpriseFeatureActive.test.ts +125 -42
  246. package/Tests/Server/Enterprise/EnterpriseLicenseSnapshot.test.ts +36 -10
  247. package/Tests/Server/Enterprise/EnterpriseModelFeatureMap.test.ts +51 -9
  248. package/Tests/Server/Enterprise/FakeEnterpriseModule.ts +13 -8
  249. package/Tests/Server/Enterprise/SsoInCommunityEdition.test.ts +540 -0
  250. package/Tests/Server/Infrastructure/Postgres/AddConfigurableRuleCriteriaMigration.test.ts +3 -0
  251. package/Tests/Server/Infrastructure/Postgres/AddIncidentFormsMigration.test.ts +438 -0
  252. package/Tests/Server/Infrastructure/Postgres/AddTeamComplianceRuleNotificationChannelsMigration.test.ts +255 -0
  253. package/Tests/Server/Infrastructure/Postgres/MessageQueueTablesMigration.test.ts +637 -0
  254. package/Tests/Server/Middleware/IncidentFormRateLimit.test.ts +1630 -0
  255. package/Tests/Server/Middleware/UserAuthorization.test.ts +16 -17
  256. package/Tests/Server/Middleware/UserAuthorizationSsoEnforcement.test.ts +544 -0
  257. package/Tests/Server/Services/AIServiceDailyBudget.test.ts +37 -8
  258. package/Tests/Server/Services/IncidentCreatedFeedTitle.test.ts +212 -0
  259. package/Tests/Server/Services/IncidentCustomFieldDeleteFormQuestions.test.ts +297 -0
  260. package/Tests/Server/Services/IncidentFormOwnersCreatedNotification.test.ts +497 -0
  261. package/Tests/Server/Services/IncidentFormPostgres.test.ts +958 -0
  262. package/Tests/Server/Services/IncidentFormPublicForm.test.ts +1260 -0
  263. package/Tests/Server/Services/IncidentFormPublicSubmission.test.ts +2520 -0
  264. package/Tests/Server/Services/IncidentFormRegistration.test.ts +159 -0
  265. package/Tests/Server/Services/IncidentFormService.test.ts +663 -0
  266. package/Tests/Server/Services/IncidentFormSubmissionService.test.ts +430 -0
  267. package/Tests/Server/Services/IncidentFormSubmissionTemplateBranch.test.ts +473 -0
  268. package/Tests/Server/Services/IncidentGroupingTemplateSubstitution.test.ts +81 -0
  269. package/Tests/Server/Services/IncidentTemplateCustomFieldSettings.test.ts +262 -0
  270. package/Tests/Server/Services/IncidentTemplateOwnersOnDeclare.test.ts +566 -0
  271. package/Tests/Server/Services/IncidentTitleMarkdownSinks.test.ts +640 -0
  272. package/Tests/Server/Services/LlmLogServiceTokenAggregateParams.test.ts +3 -3
  273. package/Tests/Server/Services/MessageQueueOwnerServices.test.ts +440 -0
  274. package/Tests/Server/Services/MessageQueueRegistries.test.ts +577 -0
  275. package/Tests/Server/Services/MessageQueueRuleEngines.test.ts +900 -0
  276. package/Tests/Server/Services/MessageQueueService.test.ts +2210 -0
  277. package/Tests/Server/Services/MessageQueueSqlPostgres.test.ts +1271 -0
  278. package/Tests/Server/Services/OpenTelemetryResourceRetentionMemo.test.ts +28 -1
  279. package/Tests/Server/Services/OpenTelemetryRetentionOverrideEdition.test.ts +474 -0
  280. package/Tests/Server/Services/OpenTelemetryServiceResolutionCache.test.ts +21 -0
  281. package/Tests/Server/Services/OwnerRowUniqueness.test.ts +3 -0
  282. package/Tests/Server/Services/ProjectServiceAuditLogLicense.test.ts +0 -1
  283. package/Tests/Server/Services/RuleRun/LabelRuleEnginesGroupBRun.test.ts +56 -6
  284. package/Tests/Server/Services/RuleRun/OwnerRuleEnginesGroupBRun.test.ts +30 -1
  285. package/Tests/Server/Services/SsoRequirementReads.test.ts +454 -0
  286. package/Tests/Server/Services/SsoRequirementWrites.test.ts +529 -0
  287. package/Tests/Server/Services/StaticRuleCriteriaRuntimeCoverage.test.ts +3 -3
  288. package/Tests/Server/Services/StatusPagePrivateUserInvitationPolicy.test.ts +107 -89
  289. package/Tests/Server/Services/TeamComplianceSettingPostgres.test.ts +1068 -176
  290. package/Tests/Server/Services/TeamComplianceSettingService.test.ts +1962 -200
  291. package/Tests/Server/Types/Database/Permissions/EditionPermission.test.ts +654 -297
  292. package/Tests/Server/Types/Database/Permissions/RetentionOverrideColumns.test.ts +784 -0
  293. package/Tests/Server/Types/Database/Permissions/SsoScalePlanGate.test.ts +418 -0
  294. package/Tests/Server/Utils/AI/AIAlertGating.test.ts +0 -1
  295. package/Tests/Server/Utils/AI/AIInvestigationEngineRunLimits.test.ts +136 -0
  296. package/Tests/Server/Utils/AI/AIInvestigationQueue.test.ts +15 -14
  297. package/Tests/Server/Utils/AI/AgentContextCompactor.test.ts +351 -0
  298. package/Tests/Server/Utils/AI/ChatAgentRunnerSharedThread.test.ts +842 -0
  299. package/Tests/Server/Utils/AI/ChatRunCancellation.test.ts +195 -0
  300. package/Tests/Server/Utils/AI/CodeFixReadiness.test.ts +10 -57
  301. package/Tests/Server/Utils/AI/FixRunBudget.test.ts +20 -24
  302. package/Tests/Server/Utils/AI/Insights/InvestigationQueueInsightSubject.test.ts +7 -30
  303. package/Tests/Server/Utils/AI/InvestigationClusterAccessWiring.test.ts +225 -29
  304. package/Tests/Server/Utils/AI/InvestigationInfrastructureAccessWiring.test.ts +266 -25
  305. package/Tests/Server/Utils/AI/InvestigationThread.test.ts +580 -0
  306. package/Tests/Server/Utils/AI/InvestigationThreadService.test.ts +801 -0
  307. package/Tests/Server/Utils/AI/KubectlInvestigationToolkit.test.ts +525 -43
  308. package/Tests/Server/Utils/AI/KubectlJobRunner.test.ts +4 -2
  309. package/Tests/Server/Utils/AI/LLMServiceUnreachableProvider.test.ts +435 -0
  310. package/Tests/Server/Utils/AI/ObservabilityAssistantLimits.test.ts +462 -0
  311. package/Tests/Server/Utils/AI/RemediationExecutionRunner.test.ts +14 -25
  312. package/Tests/Server/Utils/AI/RemediationExecutionRunnerResourceMode.test.ts +2 -0
  313. package/Tests/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.test.ts +297 -15
  314. package/Tests/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.test.ts +10 -6
  315. package/Tests/Server/Utils/AI/ToolOutputPager.test.ts +382 -0
  316. package/Tests/Server/Utils/AI/ToolResultSerializer.test.ts +23 -4
  317. package/Tests/Server/Utils/AI/Toolbox/LogTools.test.ts +25 -6
  318. package/Tests/Server/Utils/AI/Toolbox/Serializer.test.ts +14 -3
  319. package/Tests/Server/Utils/EditionEnforcement.test.ts +107 -147
  320. package/Tests/Server/Utils/{CommunityEditionSsoReport.test.ts → RelaxedScimTeamLocksReport.test.ts} +212 -208
  321. package/Tests/Server/Utils/SameOriginRequest.test.ts +372 -0
  322. package/Tests/Server/Utils/Telemetry/EntityRegistry.test.ts +20 -0
  323. package/Tests/Server/Utils/Telemetry/MessageQueueDiscovery.test.ts +2590 -0
  324. package/Tests/Server/Utils/Telemetry/MessageQueueSpanQueryTwin.ts +246 -0
  325. package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +23 -0
  326. package/Tests/Types/AI/AIAgentRunLimits.test.ts +255 -0
  327. package/Tests/Types/Code/JsonSyntax.test.ts +1300 -0
  328. package/Tests/Types/CustomField/CustomFieldCreateSettings.test.ts +1113 -0
  329. package/Tests/Types/CustomField/CustomFieldMappingCatalog.test.ts +91 -0
  330. package/Tests/Types/CustomField/CustomFieldValueValidator.test.ts +30 -0
  331. package/Tests/Types/Incident/IncidentFormIpAllowlist.test.ts +227 -0
  332. package/Tests/Types/Incident/IncidentFormPublic.test.ts +1916 -0
  333. package/Tests/Types/MessageQueue/MessageQueueEntityKey.test.ts +916 -0
  334. package/Tests/Types/MessageQueue/MessageQueueIdentity.test.ts +567 -0
  335. package/Tests/Types/MessageQueue/MessageQueueManualIdentity.test.ts +686 -0
  336. package/Tests/Types/MessageQueue/MessageQueueMetricCatalog.test.ts +1726 -0
  337. package/Tests/Types/MessageQueue/MessageQueueMetricResolution.test.ts +1758 -0
  338. package/Tests/Types/MessageQueue/MessagingInstrumentationFixtures.test.ts +4686 -0
  339. package/Tests/Types/MessageQueue/MessagingSystem.test.ts +840 -0
  340. package/Tests/Types/MessageQueue/MessagingTelemetryFixtures.ts +3287 -0
  341. package/Tests/Types/MessageQueue/MessagingTelemetryResolver.test.ts +2966 -0
  342. package/Tests/Types/Monitor/MessageQueueAlertTemplates.test.ts +5401 -0
  343. package/Tests/Types/Monitor/MetricEngineFold.ts +154 -0
  344. package/Tests/Types/ResourceAiAgent/ResourceAiAccess.test.ts +5 -3
  345. package/Tests/Types/Team/ComplianceRule.test.ts +588 -37
  346. package/Tests/Types/Team/TeamComplianceStatus.test.ts +64 -11
  347. package/Tests/Types/XML.test.ts +51 -0
  348. package/Tests/UI/Components/CodeEditor/CodeEditor.test.tsx +2362 -0
  349. package/Tests/UI/Components/CodeEditor/CodeEditorCommands.test.ts +810 -0
  350. package/Tests/UI/Components/CodeEditor/CodeEditorHighlight.test.ts +338 -0
  351. package/Tests/UI/Components/CodeEditor/CodeEditorLanguages.test.ts +222 -0
  352. package/Tests/UI/Components/CodeEditor/CodeEditorStyles.test.ts +807 -0
  353. package/Tests/UI/Components/CodeEditor/NoMonaco.test.ts +245 -0
  354. package/Tests/UI/Components/CodeEditor/YamlEditor.test.tsx +729 -0
  355. package/Tests/UI/Components/CopyTextButton.test.tsx +76 -0
  356. package/Tests/UI/Components/EditionLabelLapseCopy.ts +51 -14
  357. package/Tests/UI/Components/EditionLabelLicenseStatus.test.tsx +131 -23
  358. package/Tests/UI/Components/ErrorMessageAction.test.tsx +142 -0
  359. package/Tests/UI/Components/FacetSidebarInScope.test.tsx +459 -0
  360. package/Tests/UI/Components/FacetValuesInScope.test.ts +270 -0
  361. package/Tests/UI/Components/Forms/FormFieldCodeEditors.test.tsx +294 -0
  362. package/Tests/UI/Components/Forms/FormFieldMarkdown.test.tsx +126 -0
  363. package/Tests/UI/Components/Forms/FormFieldYaml.test.tsx +22 -75
  364. package/Tests/UI/Components/Forms/ModelFormOnBeforeCreateMiscData.test.tsx +254 -0
  365. package/Tests/UI/Components/Icon.test.tsx +32 -0
  366. package/Tests/UI/Components/Input.test.tsx +31 -0
  367. package/Tests/UI/Components/LockedFilterChipScope.test.tsx +501 -0
  368. package/Tests/UI/Components/MarkdownConverters.test.ts +253 -1
  369. package/Tests/UI/Components/MarkdownEditor.test.tsx +2785 -2
  370. package/Tests/UI/Components/MarkdownEditorHistory.test.ts +243 -0
  371. package/Tests/UI/Components/MarkdownListEditing.test.ts +1118 -0
  372. package/Tests/UI/Components/MarkdownPaste.test.ts +1180 -0
  373. package/Tests/UI/Components/MarkdownViewerCopy.test.tsx +466 -0
  374. package/Tests/UI/Components/MarkdownVisualEditing.test.ts +1089 -0
  375. package/Tests/UI/Components/ModelTable/BaseModelTableEmptyStateAction.test.tsx +623 -0
  376. package/Tests/UI/Components/ResetObjectID.test.tsx +282 -0
  377. package/Tests/UI/Components/RuleCriteria/RuleCriteriaModelTable.test.tsx +3 -3
  378. package/Tests/UI/Components/Table/EmptyTableMessage.test.ts +439 -0
  379. package/Tests/UI/Components/Table/TableEmptyState.test.tsx +352 -0
  380. package/Tests/UI/Components/TableRowMobileTitles.test.tsx +78 -0
  381. package/Tests/UI/Components/TextArea.test.tsx +19 -0
  382. package/Tests/UI/Components/Workflow/ModelColumnEditor.render.test.tsx +12 -29
  383. package/Tests/UI/Components/fixtures/MarkdownPasteFixtures.ts +460 -0
  384. package/Tests/UI/EsbuildConfig.test.ts +115 -39
  385. package/Tests/UI/EsbuildEnterpriseAlias.test.ts +4 -4
  386. package/Tests/UI/Monitor/MonitorLogSummaryRender.test.tsx +377 -0
  387. package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +81 -1
  388. package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +17 -0
  389. package/Tests/Utils/LabelRuleImportExport.test.ts +5 -0
  390. package/Tests/Utils/Markdown/DashboardMarkdownRenderer.ts +81 -0
  391. package/Tests/Utils/Markdown/UntrustedMarkdown.test.ts +1339 -0
  392. package/Tests/Utils/Monitor/MonitorLogSummaryUtil.test.ts +862 -0
  393. package/Types/AI/AIAgentRunLimits.ts +146 -0
  394. package/Types/Code/CodeType.ts +2 -0
  395. package/Types/Code/JsonSyntax.ts +923 -0
  396. package/Types/CustomField/CustomFieldCreateSettings.ts +549 -0
  397. package/Types/CustomField/CustomFieldMappingCatalog.ts +77 -0
  398. package/Types/CustomField/CustomFieldValueValidator.ts +10 -7
  399. package/Types/EnterpriseLicense/EnterpriseLicensePeriods.ts +1 -1
  400. package/Types/Icon/IconProp.ts +2 -0
  401. package/Types/Incident/IncidentFormIpAllowlist.ts +206 -0
  402. package/Types/Incident/IncidentFormPublic.ts +1145 -0
  403. package/Types/Kubernetes/KubernetesClusterAiAccess.ts +10 -3
  404. package/Types/MessageQueue/MessageQueueIdentity.ts +256 -0
  405. package/Types/MessageQueue/MessageQueueManualIdentity.ts +325 -0
  406. package/Types/MessageQueue/MessageQueueMetricCatalog.ts +1357 -0
  407. package/Types/MessageQueue/MessagingSystem.ts +518 -0
  408. package/Types/MessageQueue/MessagingTelemetryResolver.ts +2311 -0
  409. package/Types/Monitor/MessageQueueAlertTemplates.ts +2128 -0
  410. package/Types/Permission.ts +310 -0
  411. package/Types/ResourceAiAgent/ResourceAiAccess.ts +10 -4
  412. package/Types/Rules/RuleCriteriaFieldRegistry.ts +12 -0
  413. package/Types/Rules/RuleRun.ts +4 -0
  414. package/Types/Team/ComplianceNotificationChannel.ts +4 -3
  415. package/Types/Team/ComplianceRule.ts +71 -18
  416. package/Types/Team/ComplianceRuleType.ts +2 -2
  417. package/Types/Team/TeamComplianceStatus.ts +6 -2
  418. package/Types/Telemetry/EntityType.ts +16 -0
  419. package/Types/Telemetry/LockedFilterDetail.ts +22 -0
  420. package/Types/XML.ts +26 -0
  421. package/UI/Components/CodeEditor/CodeEditor.css +379 -0
  422. package/UI/Components/CodeEditor/CodeEditor.tsx +1128 -294
  423. package/UI/Components/CodeEditor/CodeEditorCommands.ts +774 -0
  424. package/UI/Components/CodeEditor/CodeEditorHighlight.ts +106 -0
  425. package/UI/Components/CodeEditor/CodeEditorLanguages.ts +164 -0
  426. package/UI/Components/CodeEditor/YamlEditor.tsx +28 -326
  427. package/UI/Components/CopyTextButton/CopyTextButton.tsx +5 -1
  428. package/UI/Components/CustomFields/CustomFieldModelFormFields.tsx +6 -25
  429. package/UI/Components/EditionLabel/EditionLabel.tsx +14 -13
  430. package/UI/Components/ErrorMessage/ErrorMessage.tsx +11 -1
  431. package/UI/Components/Forms/Fields/FormField.tsx +8 -0
  432. package/UI/Components/Forms/Types/Field.ts +8 -0
  433. package/UI/Components/Icon/Icon.tsx +18 -0
  434. package/UI/Components/Input/Input.tsx +11 -4
  435. package/UI/Components/LogsViewer/LogsViewer.tsx +4 -0
  436. package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +21 -3
  437. package/UI/Components/Markdown.tsx/MarkdownConverters.ts +0 -0
  438. package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +877 -79
  439. package/UI/Components/Markdown.tsx/MarkdownEditorHistory.ts +284 -0
  440. package/UI/Components/Markdown.tsx/MarkdownListEditing.ts +1362 -0
  441. package/UI/Components/Markdown.tsx/MarkdownPaste.ts +1326 -0
  442. package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +106 -10
  443. package/UI/Components/Markdown.tsx/MarkdownVisualEditing.ts +1032 -0
  444. package/UI/Components/ModelTable/BaseModelTable.tsx +85 -7
  445. package/UI/Components/ResetObjectID/ResetObjectID.tsx +35 -9
  446. package/UI/Components/Table/EmptyTableMessage.ts +81 -0
  447. package/UI/Components/Table/Table.tsx +50 -21
  448. package/UI/Components/Table/TableRow.tsx +9 -1
  449. package/UI/Components/TelemetryViewer/FacetVisibility.ts +97 -2
  450. package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +13 -0
  451. package/UI/Components/TelemetryViewer/components/LockedFilterChip.tsx +214 -7
  452. package/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.tsx +21 -3
  453. package/UI/Components/TextArea/TextArea.tsx +9 -2
  454. package/UI/Components/Workflow/ModelFieldPicker.tsx +10 -12
  455. package/UI/Styles/Theme.css +8 -0
  456. package/UI/esbuild-config.js +2 -32
  457. package/Utils/LabelRuleImportExport.ts +2 -0
  458. package/Utils/Markdown/UntrustedMarkdown.ts +1513 -0
  459. package/Utils/Monitor/IncomingEmailMonitorRequestUtil.ts +41 -0
  460. package/Utils/Monitor/MonitorLogSummaryUtil.ts +212 -0
  461. package/Utils/Telemetry/EntityKey.ts +48 -0
  462. package/build/dist/Models/DatabaseModels/AIConversation.js +125 -1
  463. package/build/dist/Models/DatabaseModels/AIConversation.js.map +1 -1
  464. package/build/dist/Models/DatabaseModels/CephCluster.js +12 -0
  465. package/build/dist/Models/DatabaseModels/CephCluster.js.map +1 -1
  466. package/build/dist/Models/DatabaseModels/CloudResource.js +12 -0
  467. package/build/dist/Models/DatabaseModels/CloudResource.js.map +1 -1
  468. package/build/dist/Models/DatabaseModels/DatabaseServer.js +12 -0
  469. package/build/dist/Models/DatabaseModels/DatabaseServer.js.map +1 -1
  470. package/build/dist/Models/DatabaseModels/DockerHost.js +12 -0
  471. package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
  472. package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js +12 -0
  473. package/build/dist/Models/DatabaseModels/DockerSwarmCluster.js.map +1 -1
  474. package/build/dist/Models/DatabaseModels/GlobalOidc.js +0 -4
  475. package/build/dist/Models/DatabaseModels/GlobalOidc.js.map +1 -1
  476. package/build/dist/Models/DatabaseModels/GlobalOidcProject.js +0 -4
  477. package/build/dist/Models/DatabaseModels/GlobalOidcProject.js.map +1 -1
  478. package/build/dist/Models/DatabaseModels/GlobalSso.js +0 -4
  479. package/build/dist/Models/DatabaseModels/GlobalSso.js.map +1 -1
  480. package/build/dist/Models/DatabaseModels/GlobalSsoProject.js +0 -4
  481. package/build/dist/Models/DatabaseModels/GlobalSsoProject.js.map +1 -1
  482. package/build/dist/Models/DatabaseModels/Host.js +12 -0
  483. package/build/dist/Models/DatabaseModels/Host.js.map +1 -1
  484. package/build/dist/Models/DatabaseModels/IncidentForm.js +605 -0
  485. package/build/dist/Models/DatabaseModels/IncidentForm.js.map +1 -0
  486. package/build/dist/Models/DatabaseModels/IncidentFormSubmission.js +299 -0
  487. package/build/dist/Models/DatabaseModels/IncidentFormSubmission.js.map +1 -0
  488. package/build/dist/Models/DatabaseModels/IncidentTemplate.js +60 -0
  489. package/build/dist/Models/DatabaseModels/IncidentTemplate.js.map +1 -1
  490. package/build/dist/Models/DatabaseModels/Index.js +14 -0
  491. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  492. package/build/dist/Models/DatabaseModels/IoTFleet.js +12 -0
  493. package/build/dist/Models/DatabaseModels/IoTFleet.js.map +1 -1
  494. package/build/dist/Models/DatabaseModels/KubernetesCluster.js +12 -0
  495. package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
  496. package/build/dist/Models/DatabaseModels/MessageQueue.js +1106 -0
  497. package/build/dist/Models/DatabaseModels/MessageQueue.js.map +1 -0
  498. package/build/dist/Models/DatabaseModels/MessageQueueLabelRule.js +562 -0
  499. package/build/dist/Models/DatabaseModels/MessageQueueLabelRule.js.map +1 -0
  500. package/build/dist/Models/DatabaseModels/MessageQueueOwnerRule.js +643 -0
  501. package/build/dist/Models/DatabaseModels/MessageQueueOwnerRule.js.map +1 -0
  502. package/build/dist/Models/DatabaseModels/MessageQueueOwnerTeam.js +506 -0
  503. package/build/dist/Models/DatabaseModels/MessageQueueOwnerTeam.js.map +1 -0
  504. package/build/dist/Models/DatabaseModels/MessageQueueOwnerUser.js +505 -0
  505. package/build/dist/Models/DatabaseModels/MessageQueueOwnerUser.js.map +1 -0
  506. package/build/dist/Models/DatabaseModels/PodmanHost.js +12 -0
  507. package/build/dist/Models/DatabaseModels/PodmanHost.js.map +1 -1
  508. package/build/dist/Models/DatabaseModels/Project.js +61 -0
  509. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  510. package/build/dist/Models/DatabaseModels/ProjectOidc.js +0 -4
  511. package/build/dist/Models/DatabaseModels/ProjectOidc.js.map +1 -1
  512. package/build/dist/Models/DatabaseModels/ProjectSso.js +0 -4
  513. package/build/dist/Models/DatabaseModels/ProjectSso.js.map +1 -1
  514. package/build/dist/Models/DatabaseModels/ProxmoxCluster.js +12 -0
  515. package/build/dist/Models/DatabaseModels/ProxmoxCluster.js.map +1 -1
  516. package/build/dist/Models/DatabaseModels/RumApplication.js +12 -0
  517. package/build/dist/Models/DatabaseModels/RumApplication.js.map +1 -1
  518. package/build/dist/Models/DatabaseModels/ServerlessFunction.js +12 -0
  519. package/build/dist/Models/DatabaseModels/ServerlessFunction.js.map +1 -1
  520. package/build/dist/Models/DatabaseModels/Service.js +12 -0
  521. package/build/dist/Models/DatabaseModels/Service.js.map +1 -1
  522. package/build/dist/Models/DatabaseModels/StatusPageOidc.js +0 -4
  523. package/build/dist/Models/DatabaseModels/StatusPageOidc.js.map +1 -1
  524. package/build/dist/Models/DatabaseModels/StatusPageSso.js +0 -4
  525. package/build/dist/Models/DatabaseModels/StatusPageSso.js.map +1 -1
  526. package/build/dist/Models/DatabaseModels/TeamComplianceSetting.js +49 -3
  527. package/build/dist/Models/DatabaseModels/TeamComplianceSetting.js.map +1 -1
  528. package/build/dist/Models/DatabaseModels/VMwareVCenter.js +12 -0
  529. package/build/dist/Models/DatabaseModels/VMwareVCenter.js.map +1 -1
  530. package/build/dist/Server/API/AIChatAPI.js +9 -103
  531. package/build/dist/Server/API/AIChatAPI.js.map +1 -1
  532. package/build/dist/Server/API/AIInvestigationAPI.js +3 -3
  533. package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
  534. package/build/dist/Server/API/AIInvestigationConversationAPI.js +162 -0
  535. package/build/dist/Server/API/AIInvestigationConversationAPI.js.map +1 -0
  536. package/build/dist/Server/API/IncidentFormAPI.js +245 -0
  537. package/build/dist/Server/API/IncidentFormAPI.js.map +1 -0
  538. package/build/dist/Server/API/ProjectOIDC.js +16 -24
  539. package/build/dist/Server/API/ProjectOIDC.js.map +1 -1
  540. package/build/dist/Server/API/ProjectSSO.js +16 -24
  541. package/build/dist/Server/API/ProjectSSO.js.map +1 -1
  542. package/build/dist/Server/API/StatusPageAPI.js +42 -75
  543. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  544. package/build/dist/Server/Enterprise/EnterpriseEdition.js +79 -25
  545. package/build/dist/Server/Enterprise/EnterpriseEdition.js.map +1 -1
  546. package/build/dist/Server/Enterprise/EnterpriseFeature.js +24 -3
  547. package/build/dist/Server/Enterprise/EnterpriseFeature.js.map +1 -1
  548. package/build/dist/Server/Enterprise/EnterpriseLicenseSnapshot.js +1 -1
  549. package/build/dist/Server/Enterprise/EnterpriseServerModule.js.map +1 -1
  550. package/build/dist/Server/EnvironmentConfig.js +1 -1
  551. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.js +63 -0
  552. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796400000000-AddIncidentForms.js.map +1 -0
  553. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.js +41 -0
  554. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796500000000-AddTeamComplianceRuleNotificationChannels.js.map +1 -0
  555. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.js +40 -0
  556. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796600000000-AddAIInvestigationConversationAndTimeLimits.js.map +1 -0
  557. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.js +183 -0
  558. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1796700000000-AddMessageQueueTables.js.map +1 -0
  559. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
  560. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  561. package/build/dist/Server/Middleware/IncidentFormRateLimit.js +559 -0
  562. package/build/dist/Server/Middleware/IncidentFormRateLimit.js.map +1 -0
  563. package/build/dist/Server/Middleware/UserAuthorization.js +11 -30
  564. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  565. package/build/dist/Server/Services/AIService.js +10 -13
  566. package/build/dist/Server/Services/AIService.js.map +1 -1
  567. package/build/dist/Server/Services/IncidentCustomFieldService.js +83 -0
  568. package/build/dist/Server/Services/IncidentCustomFieldService.js.map +1 -1
  569. package/build/dist/Server/Services/IncidentEpisodeMemberService.js +8 -4
  570. package/build/dist/Server/Services/IncidentEpisodeMemberService.js.map +1 -1
  571. package/build/dist/Server/Services/IncidentEpisodeService.js +10 -1
  572. package/build/dist/Server/Services/IncidentEpisodeService.js.map +1 -1
  573. package/build/dist/Server/Services/IncidentFormService.js +1202 -0
  574. package/build/dist/Server/Services/IncidentFormService.js.map +1 -0
  575. package/build/dist/Server/Services/IncidentFormSubmissionService.js +91 -0
  576. package/build/dist/Server/Services/IncidentFormSubmissionService.js.map +1 -0
  577. package/build/dist/Server/Services/IncidentGroupingEngineService.js +20 -8
  578. package/build/dist/Server/Services/IncidentGroupingEngineService.js.map +1 -1
  579. package/build/dist/Server/Services/IncidentService.js +106 -4
  580. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  581. package/build/dist/Server/Services/IncidentTemplateService.js +18 -0
  582. package/build/dist/Server/Services/IncidentTemplateService.js.map +1 -1
  583. package/build/dist/Server/Services/Index.js +14 -0
  584. package/build/dist/Server/Services/Index.js.map +1 -1
  585. package/build/dist/Server/Services/MessageQueueLabelRuleEngineService.js +262 -0
  586. package/build/dist/Server/Services/MessageQueueLabelRuleEngineService.js.map +1 -0
  587. package/build/dist/Server/Services/MessageQueueLabelRuleService.js +13 -0
  588. package/build/dist/Server/Services/MessageQueueLabelRuleService.js.map +1 -0
  589. package/build/dist/Server/Services/MessageQueueOwnerRuleEngineService.js +334 -0
  590. package/build/dist/Server/Services/MessageQueueOwnerRuleEngineService.js.map +1 -0
  591. package/build/dist/Server/Services/MessageQueueOwnerRuleService.js +13 -0
  592. package/build/dist/Server/Services/MessageQueueOwnerRuleService.js.map +1 -0
  593. package/build/dist/Server/Services/MessageQueueOwnerTeamService.js +62 -0
  594. package/build/dist/Server/Services/MessageQueueOwnerTeamService.js.map +1 -0
  595. package/build/dist/Server/Services/MessageQueueOwnerUserService.js +62 -0
  596. package/build/dist/Server/Services/MessageQueueOwnerUserService.js.map +1 -0
  597. package/build/dist/Server/Services/MessageQueueService.js +1140 -0
  598. package/build/dist/Server/Services/MessageQueueService.js.map +1 -0
  599. package/build/dist/Server/Services/OpenTelemetryIngestService.js +25 -4
  600. package/build/dist/Server/Services/OpenTelemetryIngestService.js.map +1 -1
  601. package/build/dist/Server/Services/ProjectService.js +0 -54
  602. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  603. package/build/dist/Server/Services/StatusPagePrivateUserService.js +1 -4
  604. package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
  605. package/build/dist/Server/Services/StatusPageService.js +0 -46
  606. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  607. package/build/dist/Server/Services/TeamComplianceSettingService.js +120 -31
  608. package/build/dist/Server/Services/TeamComplianceSettingService.js.map +1 -1
  609. package/build/dist/Server/Services/UserNotificationRuleService.js +8 -1
  610. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  611. package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js +12 -3
  612. package/build/dist/Server/Services/WorkspaceNotificationSummaryService.js.map +1 -1
  613. package/build/dist/Server/Types/Database/Permissions/CreatePermission.js +6 -3
  614. package/build/dist/Server/Types/Database/Permissions/CreatePermission.js.map +1 -1
  615. package/build/dist/Server/Types/Database/Permissions/EditionPermission.js +109 -37
  616. package/build/dist/Server/Types/Database/Permissions/EditionPermission.js.map +1 -1
  617. package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +16 -0
  618. package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
  619. package/build/dist/Server/Types/Database/Permissions/TablePermission.js +3 -3
  620. package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js +9 -6
  621. package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js.map +1 -1
  622. package/build/dist/Server/Utils/AI/Chat/AgentContextCompactor.js +128 -0
  623. package/build/dist/Server/Utils/AI/Chat/AgentContextCompactor.js.map +1 -0
  624. package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +192 -50
  625. package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
  626. package/build/dist/Server/Utils/AI/Chat/ChatRunCancellation.js +133 -0
  627. package/build/dist/Server/Utils/AI/Chat/ChatRunCancellation.js.map +1 -0
  628. package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js +53 -13
  629. package/build/dist/Server/Utils/AI/Chat/ObservabilityAssistant.js.map +1 -1
  630. package/build/dist/Server/Utils/AI/Chat/ObservabilityChatPrompt.js +1 -1
  631. package/build/dist/Server/Utils/AI/Chat/ToolOutputPager.js +206 -0
  632. package/build/dist/Server/Utils/AI/Chat/ToolOutputPager.js.map +1 -0
  633. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js +53 -26
  634. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlInvestigationToolkit.js.map +1 -1
  635. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js +4 -2
  636. package/build/dist/Server/Utils/AI/ClusterAccess/KubectlJobRunner.js.map +1 -1
  637. package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js +1 -29
  638. package/build/dist/Server/Utils/AI/CodeFix/CodeFixReadiness.js.map +1 -1
  639. package/build/dist/Server/Utils/AI/CodeFix/FixRunBudget.js +24 -24
  640. package/build/dist/Server/Utils/AI/CodeFix/FixRunBudget.js.map +1 -1
  641. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js +7 -2
  642. package/build/dist/Server/Utils/AI/Remediation/RemediationCommandTools.js.map +1 -1
  643. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js +29 -14
  644. package/build/dist/Server/Utils/AI/Remediation/RemediationExecutionRunner.js.map +1 -1
  645. package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js +38 -14
  646. package/build/dist/Server/Utils/AI/ResourceAccess/InfrastructureInvestigationToolkit.js.map +1 -1
  647. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js +2 -0
  648. package/build/dist/Server/Utils/AI/ResourceAccess/ResourceCommandJobRunner.js.map +1 -1
  649. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js +40 -10
  650. package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -1
  651. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js +19 -7
  652. package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -1
  653. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js +19 -7
  654. package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -1
  655. package/build/dist/Server/Utils/AI/SRE/InvestigationQueue.js +15 -18
  656. package/build/dist/Server/Utils/AI/SRE/InvestigationQueue.js.map +1 -1
  657. package/build/dist/Server/Utils/AI/SRE/InvestigationThread.js +412 -0
  658. package/build/dist/Server/Utils/AI/SRE/InvestigationThread.js.map +1 -0
  659. package/build/dist/Server/Utils/AI/SRE/InvestigationThreadService.js +495 -0
  660. package/build/dist/Server/Utils/AI/SRE/InvestigationThreadService.js.map +1 -0
  661. package/build/dist/Server/Utils/AI/Toolbox/Serializer.js +10 -3
  662. package/build/dist/Server/Utils/AI/Toolbox/Serializer.js.map +1 -1
  663. package/build/dist/Server/Utils/EditionEnforcement.js +20 -158
  664. package/build/dist/Server/Utils/EditionEnforcement.js.map +1 -1
  665. package/build/dist/Server/Utils/LLM/LLMService.js +193 -54
  666. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  667. package/build/dist/Server/Utils/RelaxedScimTeamLocksReport.js +160 -0
  668. package/build/dist/Server/Utils/RelaxedScimTeamLocksReport.js.map +1 -0
  669. package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js +25 -0
  670. package/build/dist/Server/Utils/Rules/RuleRun/RuleRunRegistry.js.map +1 -1
  671. package/build/dist/Server/Utils/SameOriginRequest.js +151 -0
  672. package/build/dist/Server/Utils/SameOriginRequest.js.map +1 -0
  673. package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js +2 -0
  674. package/build/dist/Server/Utils/TeamMember/ProjectLeaveResourceCleanup.js.map +1 -1
  675. package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +4 -1
  676. package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
  677. package/build/dist/Server/Utils/Telemetry/MessageQueueDiscovery.js +1015 -0
  678. package/build/dist/Server/Utils/Telemetry/MessageQueueDiscovery.js.map +1 -0
  679. package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js +4 -1
  680. package/build/dist/Server/Utils/Telemetry/ResourceEntityFilter.js.map +1 -1
  681. package/build/dist/Server/Utils/VendorAssets.js +3 -3
  682. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js +3 -1
  683. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/Incident.js.map +1 -1
  684. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js +3 -1
  685. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/Actions/IncidentEpisode.js.map +1 -1
  686. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +10 -1
  687. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  688. package/build/dist/Types/AI/AIAgentRunLimits.js +91 -0
  689. package/build/dist/Types/AI/AIAgentRunLimits.js.map +1 -0
  690. package/build/dist/Types/Code/CodeType.js +2 -0
  691. package/build/dist/Types/Code/CodeType.js.map +1 -1
  692. package/build/dist/Types/Code/JsonSyntax.js +604 -0
  693. package/build/dist/Types/Code/JsonSyntax.js.map +1 -0
  694. package/build/dist/Types/CustomField/CustomFieldCreateSettings.js +310 -0
  695. package/build/dist/Types/CustomField/CustomFieldCreateSettings.js.map +1 -0
  696. package/build/dist/Types/CustomField/CustomFieldMappingCatalog.js +38 -0
  697. package/build/dist/Types/CustomField/CustomFieldMappingCatalog.js.map +1 -1
  698. package/build/dist/Types/CustomField/CustomFieldValueValidator.js +10 -7
  699. package/build/dist/Types/CustomField/CustomFieldValueValidator.js.map +1 -1
  700. package/build/dist/Types/EnterpriseLicense/EnterpriseLicensePeriods.js +1 -1
  701. package/build/dist/Types/Icon/IconProp.js +2 -0
  702. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  703. package/build/dist/Types/Incident/IncidentFormIpAllowlist.js +119 -0
  704. package/build/dist/Types/Incident/IncidentFormIpAllowlist.js.map +1 -0
  705. package/build/dist/Types/Incident/IncidentFormPublic.js +678 -0
  706. package/build/dist/Types/Incident/IncidentFormPublic.js.map +1 -0
  707. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js +10 -3
  708. package/build/dist/Types/Kubernetes/KubernetesClusterAiAccess.js.map +1 -1
  709. package/build/dist/Types/MessageQueue/MessageQueueIdentity.js +184 -0
  710. package/build/dist/Types/MessageQueue/MessageQueueIdentity.js.map +1 -0
  711. package/build/dist/Types/MessageQueue/MessageQueueManualIdentity.js +190 -0
  712. package/build/dist/Types/MessageQueue/MessageQueueManualIdentity.js.map +1 -0
  713. package/build/dist/Types/MessageQueue/MessageQueueMetricCatalog.js +1057 -0
  714. package/build/dist/Types/MessageQueue/MessageQueueMetricCatalog.js.map +1 -0
  715. package/build/dist/Types/MessageQueue/MessagingSystem.js +394 -0
  716. package/build/dist/Types/MessageQueue/MessagingSystem.js.map +1 -0
  717. package/build/dist/Types/MessageQueue/MessagingTelemetryResolver.js +1768 -0
  718. package/build/dist/Types/MessageQueue/MessagingTelemetryResolver.js.map +1 -0
  719. package/build/dist/Types/Monitor/MessageQueueAlertTemplates.js +1207 -0
  720. package/build/dist/Types/Monitor/MessageQueueAlertTemplates.js.map +1 -0
  721. package/build/dist/Types/Permission.js +274 -0
  722. package/build/dist/Types/Permission.js.map +1 -1
  723. package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js +10 -4
  724. package/build/dist/Types/ResourceAiAgent/ResourceAiAccess.js.map +1 -1
  725. package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js +12 -0
  726. package/build/dist/Types/Rules/RuleCriteriaFieldRegistry.js.map +1 -1
  727. package/build/dist/Types/Rules/RuleRun.js +4 -0
  728. package/build/dist/Types/Rules/RuleRun.js.map +1 -1
  729. package/build/dist/Types/Team/ComplianceNotificationChannel.js +4 -3
  730. package/build/dist/Types/Team/ComplianceNotificationChannel.js.map +1 -1
  731. package/build/dist/Types/Team/ComplianceRule.js +48 -14
  732. package/build/dist/Types/Team/ComplianceRule.js.map +1 -1
  733. package/build/dist/Types/Team/ComplianceRuleType.js +2 -2
  734. package/build/dist/Types/Telemetry/EntityType.js +16 -0
  735. package/build/dist/Types/Telemetry/EntityType.js.map +1 -1
  736. package/build/dist/Types/XML.js +23 -0
  737. package/build/dist/Types/XML.js.map +1 -1
  738. package/build/dist/UI/Components/CodeEditor/CodeEditor.js +641 -266
  739. package/build/dist/UI/Components/CodeEditor/CodeEditor.js.map +1 -1
  740. package/build/dist/UI/Components/CodeEditor/CodeEditorCommands.js +464 -0
  741. package/build/dist/UI/Components/CodeEditor/CodeEditorCommands.js.map +1 -0
  742. package/build/dist/UI/Components/CodeEditor/CodeEditorHighlight.js +69 -0
  743. package/build/dist/UI/Components/CodeEditor/CodeEditorHighlight.js.map +1 -0
  744. package/build/dist/UI/Components/CodeEditor/CodeEditorLanguages.js +108 -0
  745. package/build/dist/UI/Components/CodeEditor/CodeEditorLanguages.js.map +1 -0
  746. package/build/dist/UI/Components/CodeEditor/YamlEditor.js +14 -186
  747. package/build/dist/UI/Components/CodeEditor/YamlEditor.js.map +1 -1
  748. package/build/dist/UI/Components/CopyTextButton/CopyTextButton.js +5 -1
  749. package/build/dist/UI/Components/CopyTextButton/CopyTextButton.js.map +1 -1
  750. package/build/dist/UI/Components/CustomFields/CustomFieldModelFormFields.js +5 -14
  751. package/build/dist/UI/Components/CustomFields/CustomFieldModelFormFields.js.map +1 -1
  752. package/build/dist/UI/Components/EditionLabel/EditionLabel.js +14 -13
  753. package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
  754. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js +1 -1
  755. package/build/dist/UI/Components/ErrorMessage/ErrorMessage.js.map +1 -1
  756. package/build/dist/UI/Components/Forms/Fields/FormField.js +8 -3
  757. package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
  758. package/build/dist/UI/Components/Icon/Icon.js +8 -0
  759. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  760. package/build/dist/UI/Components/Input/Input.js +11 -3
  761. package/build/dist/UI/Components/Input/Input.js.map +1 -1
  762. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +2 -1
  763. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  764. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +14 -4
  765. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
  766. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js +0 -0
  767. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js.map +1 -1
  768. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +710 -65
  769. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js.map +1 -1
  770. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditorHistory.js +238 -0
  771. package/build/dist/UI/Components/Markdown.tsx/MarkdownEditorHistory.js.map +1 -0
  772. package/build/dist/UI/Components/Markdown.tsx/MarkdownListEditing.js +1028 -0
  773. package/build/dist/UI/Components/Markdown.tsx/MarkdownListEditing.js.map +1 -0
  774. package/build/dist/UI/Components/Markdown.tsx/MarkdownPaste.js +1088 -0
  775. package/build/dist/UI/Components/Markdown.tsx/MarkdownPaste.js.map +1 -0
  776. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +70 -10
  777. package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
  778. package/build/dist/UI/Components/Markdown.tsx/MarkdownVisualEditing.js +887 -0
  779. package/build/dist/UI/Components/Markdown.tsx/MarkdownVisualEditing.js.map +1 -0
  780. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +57 -6
  781. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  782. package/build/dist/UI/Components/ResetObjectID/ResetObjectID.js +7 -5
  783. package/build/dist/UI/Components/ResetObjectID/ResetObjectID.js.map +1 -1
  784. package/build/dist/UI/Components/Table/EmptyTableMessage.js +51 -0
  785. package/build/dist/UI/Components/Table/EmptyTableMessage.js.map +1 -0
  786. package/build/dist/UI/Components/Table/Table.js +30 -11
  787. package/build/dist/UI/Components/Table/Table.js.map +1 -1
  788. package/build/dist/UI/Components/Table/TableRow.js +9 -2
  789. package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
  790. package/build/dist/UI/Components/TelemetryViewer/FacetVisibility.js +63 -1
  791. package/build/dist/UI/Components/TelemetryViewer/FacetVisibility.js.map +1 -1
  792. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +4 -2
  793. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
  794. package/build/dist/UI/Components/TelemetryViewer/components/LockedFilterChip.js +91 -10
  795. package/build/dist/UI/Components/TelemetryViewer/components/LockedFilterChip.js.map +1 -1
  796. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js +14 -4
  797. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryFacetSidebar.js.map +1 -1
  798. package/build/dist/UI/Components/TextArea/TextArea.js +9 -3
  799. package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
  800. package/build/dist/UI/Components/Workflow/ModelFieldPicker.js +1 -2
  801. package/build/dist/UI/Components/Workflow/ModelFieldPicker.js.map +1 -1
  802. package/build/dist/Utils/LabelRuleImportExport.js +2 -0
  803. package/build/dist/Utils/LabelRuleImportExport.js.map +1 -1
  804. package/build/dist/Utils/Markdown/UntrustedMarkdown.js +988 -0
  805. package/build/dist/Utils/Markdown/UntrustedMarkdown.js.map +1 -0
  806. package/build/dist/Utils/Monitor/IncomingEmailMonitorRequestUtil.js +34 -0
  807. package/build/dist/Utils/Monitor/IncomingEmailMonitorRequestUtil.js.map +1 -0
  808. package/build/dist/Utils/Monitor/MonitorLogSummaryUtil.js +148 -0
  809. package/build/dist/Utils/Monitor/MonitorLogSummaryUtil.js.map +1 -0
  810. package/build/dist/Utils/Telemetry/EntityKey.js +36 -0
  811. package/build/dist/Utils/Telemetry/EntityKey.js.map +1 -1
  812. package/package.json +1 -3
  813. package/Server/Utils/CommunityEditionSsoReport.ts +0 -361
  814. package/Tests/App/Accounts/LoginSsoEdition.test.tsx +0 -616
  815. package/Tests/App/AdminDashboard/AdminAuthenticationSsoEdition.test.tsx +0 -217
  816. package/Tests/App/AdminDashboard/GlobalSSOEnterpriseShells.test.tsx +0 -271
  817. package/Tests/App/Dashboard/CloudDocumentationMarkdown.test.ts +0 -215
  818. package/Tests/App/Dashboard/TelemetryResourceRetentionSettings.test.tsx +0 -784
  819. package/Tests/Server/Middleware/UserAuthorizationEditionEnforcement.test.ts +0 -518
  820. package/Tests/Server/Services/SsoRequirementReadMasking.test.ts +0 -419
  821. package/Tests/Server/Services/SsoRequirementWriteGuard.test.ts +0 -769
  822. package/Tests/UI/Components/CodeEditor.test.tsx +0 -638
  823. package/Tests/UI/Components/MonacoLoader.test.ts +0 -67
  824. package/Tests/UI/Components/MonacoRuntime.test.ts +0 -121
  825. package/Tests/UI/Components/Telemetry/TelemetryRetentionConfigForm.test.tsx +0 -329
  826. package/Tests/UI/Components/YamlEditor.test.tsx +0 -847
  827. package/UI/Components/CodeEditor/MonacoLoader.ts +0 -36
  828. package/UI/Components/Telemetry/TelemetryRetentionConfigForm.tsx +0 -319
  829. package/UI/Components/Telemetry/TelemetryRetentionConfigSummary.tsx +0 -223
  830. package/build/dist/Server/Utils/CommunityEditionSsoReport.js +0 -223
  831. package/build/dist/Server/Utils/CommunityEditionSsoReport.js.map +0 -1
  832. package/build/dist/UI/Components/CodeEditor/MonacoLoader.js +0 -34
  833. package/build/dist/UI/Components/CodeEditor/MonacoLoader.js.map +0 -1
  834. package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigForm.js +0 -171
  835. package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigForm.js.map +0 -1
  836. package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigSummary.js +0 -119
  837. package/build/dist/UI/Components/Telemetry/TelemetryRetentionConfigSummary.js.map +0 -1
@@ -0,0 +1,1768 @@
1
+ import { getMessagingBrokerScope, isExcludedMessagingSystem, normalizeMessagingSystem, } from "./MessagingSystem";
2
+ import { canonicalizeMessageQueueBrokerScope, getAzureNamespaceFromHost, hasControlCharacter, } from "./MessageQueueIdentity";
3
+ import { getMessageQueueMetricDescriptorsByName, MESSAGE_QUEUE_METRICS, MESSAGING_SDK_METRIC_SYSTEMS, } from "./MessageQueueMetricCatalog";
4
+ // A destination longer than this, after normalization, is not a queue name.
5
+ export const MESSAGE_QUEUE_DESTINATION_MAX_LENGTH = 255;
6
+ // Display-only values are clamped to this.
7
+ const DISPLAY_VALUE_MAX_LENGTH = 255;
8
+ /*
9
+ * The presence of ANY of these (non-blank) makes a span or datapoint a
10
+ * messaging candidate. Each is set by at least one instrumentation that
11
+ * sets none of the others: `messaging.destination` by pre-1.17 JS and
12
+ * Python instrumentations, `message_bus.destination` and `az.namespace` by
13
+ * the Azure SDKs' legacy mode, `aws.queue_url` by the .NET AWS
14
+ * instrumentation's legacy mode (no `messaging.system`), `aws.sns.topic.arn`
15
+ * by the Java agent's SNS spans (no `messaging.system` either).
16
+ */
17
+ export const MESSAGING_TRIGGER_ATTRIBUTES = [
18
+ "messaging.system",
19
+ "messaging.destination.name",
20
+ "messaging.destination",
21
+ "message_bus.destination",
22
+ "az.namespace",
23
+ "azure.resource_provider.namespace",
24
+ "aws.sqs.queue.url",
25
+ "aws.queue_url",
26
+ "aws.sns.topic.arn",
27
+ ];
28
+ export const MESSAGING_SYSTEM_ATTRIBUTE = "messaging.system";
29
+ /*
30
+ * The Azure resource provider namespace the Azure SDKs stamp on every span
31
+ * (`az.namespace`; the Java SDK dual-emits the newer name).
32
+ */
33
+ export const AZURE_RESOURCE_PROVIDER_ATTRIBUTES = [
34
+ "az.namespace",
35
+ "azure.resource_provider.namespace",
36
+ ];
37
+ /*
38
+ * The resource provider namespaces, among those keys' values, that name a
39
+ * messaging service — Service Bus's and Event Hubs' — and the system each
40
+ * one is. Compared trimmed and lowercased.
41
+ */
42
+ const AZURE_PROVIDER_SYSTEMS = new Map([
43
+ ["microsoft.servicebus", "servicebus"],
44
+ ["microsoft.eventhub", "eventhubs"],
45
+ ]);
46
+ /**
47
+ * Those namespaces, lowercase and sorted: the only values that make an Azure
48
+ * resource provider key a messaging trigger (see isTriggerValue). The
49
+ * discovery cron's span query admits a span on those keys for exactly these
50
+ * values, so it reads the Azure SDK spans ingest keys, and not the Storage,
51
+ * Key Vault or Cosmos DB spans that carry the same keys.
52
+ */
53
+ export const AZURE_MESSAGING_PROVIDER_NAMESPACES = Array.from(AZURE_PROVIDER_SYSTEMS.keys()).sort();
54
+ /*
55
+ * The Azure SDKs' legacy DiagnosticSource mode names the service in
56
+ * `component`, next to `message_bus.destination` and `peer.address`.
57
+ */
58
+ const AZURE_LEGACY_COMPONENT_ATTRIBUTE = "component";
59
+ const AZURE_LEGACY_COMPONENT_EVIDENCE = [
60
+ "message_bus.destination",
61
+ "peer.address",
62
+ ];
63
+ export const RPC_SYSTEM_ATTRIBUTES = [
64
+ "rpc.system",
65
+ "rpc.system.name",
66
+ ];
67
+ const RPC_SERVICE_ATTRIBUTE = "rpc.service";
68
+ /*
69
+ * Destination precedence: the low-cardinality template first, then the
70
+ * name, then the consumer-side names of spec 1.17-1.20 (the Azure JS SDK
71
+ * still uses `messaging.source.name` on receive), the pre-1.17 name, and
72
+ * the Azure SDKs' legacy key.
73
+ */
74
+ export const MESSAGING_DESTINATION_ATTRIBUTES = [
75
+ "messaging.destination.template",
76
+ "messaging.destination.name",
77
+ "messaging.source.template",
78
+ "messaging.source.name",
79
+ "messaging.destination",
80
+ "message_bus.destination",
81
+ ];
82
+ /*
83
+ * Booleans that mark a destination as temporary or anonymous (the source
84
+ * pair for spec 1.17-1.20 consumers). The pre-1.17
85
+ * `messaging.temp_destination` is deliberately NOT read: Python pika and
86
+ * aio-pika set it on every publish.
87
+ */
88
+ export const MESSAGING_TEMPORARY_FLAG_ATTRIBUTES = [
89
+ "messaging.destination.temporary",
90
+ "messaging.destination.anonymous",
91
+ "messaging.source.temporary",
92
+ "messaging.source.anonymous",
93
+ ];
94
+ /*
95
+ * Amazon SQS names its queue by URL (last path segment is the name) when no
96
+ * destination key does: the semconv key, then the .NET / Python botocore
97
+ * key.
98
+ */
99
+ export const SQS_QUEUE_URL_ATTRIBUTES = [
100
+ "aws.sqs.queue.url",
101
+ "aws.queue_url",
102
+ ];
103
+ /*
104
+ * Keys that hold an SQS queue URL only in some instrumentations, so they
105
+ * count only when they ARE a URL: `messaging.url` (Python boto3sqs,
106
+ * botocore), `server.address` (Go otelaws from v0.62.0) and `net.peer.name`
107
+ * (Go otelaws up to v0.61.0).
108
+ */
109
+ const SQS_QUEUE_URL_FALLBACK_ATTRIBUTES = [
110
+ "messaging.url",
111
+ "server.address",
112
+ "net.peer.name",
113
+ ];
114
+ export const SNS_TOPIC_ARN_ATTRIBUTES = [
115
+ "aws.sns.topic.arn",
116
+ ];
117
+ // The routing key a RabbitMQ message was published with (1.17+, then ≤1.16).
118
+ export const RABBITMQ_ROUTING_KEY_ATTRIBUTES = [
119
+ "messaging.rabbitmq.destination.routing_key",
120
+ "messaging.rabbitmq.routing_key",
121
+ ];
122
+ /*
123
+ * RabbitMQ.Client for .NET (v7) stamps `network.protocol.name` "amqp" on
124
+ * every span (a messaging attribute only up to semconv 1.25). It writes the
125
+ * 1.26+ operation keys, yet names the exchange alone, never semconv 1.30's
126
+ * joined `{exchange}:{routing key}:{queue}`; the Java agent's opt-in mode,
127
+ * which does join them, never sets it. See rabbitMqQueue.
128
+ */
129
+ export const MESSAGING_PROTOCOL_NAME_ATTRIBUTE = "network.protocol.name";
130
+ const RABBITMQ_DOTNET_CLIENT_PROTOCOL = "amqp";
131
+ /*
132
+ * Broker address precedence, display only: current, pre-1.21, 1.22+ peer,
133
+ * the socket keys of 1.13-1.21, the Azure legacy key, then `messaging.url`
134
+ * (removed in 1.17 but still emitted: a JSON list of bootstrap servers from
135
+ * kafka-python, a censored AMQP URL from amqplib).
136
+ */
137
+ export const MESSAGING_ADDRESS_ATTRIBUTES = [
138
+ { address: "server.address", port: "server.port" },
139
+ { address: "net.peer.name", port: "net.peer.port" },
140
+ { address: "network.peer.address", port: "network.peer.port" },
141
+ { address: "net.sock.peer.addr", port: null },
142
+ { address: "server.socket.address", port: null },
143
+ { address: "peer.address", port: null },
144
+ { address: "messaging.url", port: null },
145
+ ];
146
+ /*
147
+ * Where an Azure namespace-scoped span names its namespace host
148
+ * (`<namespace>.servicebus.windows.net`): .NET ActivitySource mode sets
149
+ * `server.address`, the JS and Python SDKs `net.peer.name`, the legacy mode
150
+ * `peer.address` (as `sb://…/`).
151
+ */
152
+ export const MESSAGING_BROKER_SCOPE_ADDRESS_ATTRIBUTES = ["server.address", "net.peer.name", "peer.address", "network.peer.address"];
153
+ const OPERATION_TYPE_ATTRIBUTE = "messaging.operation.type";
154
+ const LEGACY_OPERATION_ATTRIBUTE = "messaging.operation";
155
+ const OPERATION_NAME_ATTRIBUTE = "messaging.operation.name";
156
+ const RPC_METHOD_ATTRIBUTE = "rpc.method";
157
+ /*
158
+ * Direction evidence, strongest first (span kind sits between the first and
159
+ * the second — see resolveDirection).
160
+ */
161
+ export const MESSAGING_DIRECTION_ATTRIBUTES = [
162
+ OPERATION_TYPE_ATTRIBUTE,
163
+ LEGACY_OPERATION_ATTRIBUTE,
164
+ OPERATION_NAME_ATTRIBUTE,
165
+ RPC_METHOD_ATTRIBUTE,
166
+ ];
167
+ /*
168
+ * Consumer group / subscription precedence: 1.27+, then the Kafka keys of
169
+ * 1.17-1.26 (still the Java agent's default) and 1.16, RocketMQ's legacy
170
+ * key, Event Hubs', Service Bus's pre-1.27 subscription key, and the key
171
+ * the Azure SDK for Java's Service Bus metrics name the subscription by
172
+ * (azure-core-metrics-opentelemetry's rename of `subscriptionName`). The
173
+ * pre-1.17 `messaging.consumer_id` ("{group} - {client id}") is deliberately
174
+ * not read: it is per client instance, and the discovery cron groups by
175
+ * every key read here.
176
+ */
177
+ export const MESSAGING_CONSUMER_GROUP_ATTRIBUTES = [
178
+ "messaging.consumer.group.name",
179
+ "messaging.destination.subscription.name",
180
+ "messaging.kafka.consumer.group",
181
+ "messaging.kafka.consumer_group",
182
+ "messaging.rocketmq.client_group",
183
+ "messaging.eventhubs.consumer.group",
184
+ "messaging.servicebus.destination.subscription_name",
185
+ "messaging.servicebus.subscription_name",
186
+ ];
187
+ /*
188
+ * The reporting broker of a curated broker metric, when its source says so:
189
+ * a Prometheus scrape stamps the target it scraped (the Pulsar or RocketMQ
190
+ * broker itself) on the resource. Display only.
191
+ */
192
+ export const MESSAGE_QUEUE_METRIC_ADDRESS_ATTRIBUTES = [{ address: "resource.server.address", port: "resource.server.port" }];
193
+ function uniqueKeys(lists) {
194
+ const seen = new Set();
195
+ const keys = [];
196
+ for (const list of lists) {
197
+ for (const key of list) {
198
+ if (!seen.has(key)) {
199
+ seen.add(key);
200
+ keys.push(key);
201
+ }
202
+ }
203
+ }
204
+ return keys;
205
+ }
206
+ function addressKeys(attributes) {
207
+ const keys = [];
208
+ for (const attribute of attributes) {
209
+ keys.push(attribute.address);
210
+ if (attribute.port) {
211
+ keys.push(attribute.port);
212
+ }
213
+ }
214
+ return keys;
215
+ }
216
+ /**
217
+ * EVERY attribute key resolveMessagingSpan reads — and so what the discovery
218
+ * cron selects from each stored span and groups by, before handing the row
219
+ * back to the same resolver. Only keys that describe a destination, its
220
+ * broker or the direction: never a per-message or per-instance value
221
+ * (message ids, offsets, partitions, consumer or client ids), which would
222
+ * split one queue's spans into a group per message.
223
+ */
224
+ export const MESSAGING_RESOLVER_INPUT_ATTRIBUTES = uniqueKeys([
225
+ MESSAGING_TRIGGER_ATTRIBUTES,
226
+ [MESSAGING_SYSTEM_ATTRIBUTE],
227
+ AZURE_RESOURCE_PROVIDER_ATTRIBUTES,
228
+ [AZURE_LEGACY_COMPONENT_ATTRIBUTE],
229
+ AZURE_LEGACY_COMPONENT_EVIDENCE,
230
+ RPC_SYSTEM_ATTRIBUTES,
231
+ [RPC_SERVICE_ATTRIBUTE],
232
+ MESSAGING_DESTINATION_ATTRIBUTES,
233
+ MESSAGING_TEMPORARY_FLAG_ATTRIBUTES,
234
+ SQS_QUEUE_URL_ATTRIBUTES,
235
+ SQS_QUEUE_URL_FALLBACK_ATTRIBUTES,
236
+ SNS_TOPIC_ARN_ATTRIBUTES,
237
+ RABBITMQ_ROUTING_KEY_ATTRIBUTES,
238
+ [MESSAGING_PROTOCOL_NAME_ATTRIBUTE],
239
+ addressKeys(MESSAGING_ADDRESS_ATTRIBUTES),
240
+ MESSAGING_BROKER_SCOPE_ADDRESS_ATTRIBUTES,
241
+ MESSAGING_DIRECTION_ATTRIBUTES,
242
+ MESSAGING_CONSUMER_GROUP_ATTRIBUTES,
243
+ ]);
244
+ /**
245
+ * EVERY attribute key resolveMessagingMetricDatapoint reads to find a
246
+ * datapoint's queue: the span keys (a messaging-client datapoint resolves
247
+ * like a span), plus each curated broker metric's destination, scope and
248
+ * required keys and the reporting broker's address. The discovery cron
249
+ * groups by exactly these.
250
+ */
251
+ export const MESSAGING_METRIC_RESOLVER_INPUT_ATTRIBUTES = uniqueKeys([
252
+ MESSAGING_RESOLVER_INPUT_ATTRIBUTES,
253
+ ...MESSAGE_QUEUE_METRICS.map((descriptor) => {
254
+ return [
255
+ ...descriptor.destinationAttributes,
256
+ ...(descriptor.scopeAttributes || []),
257
+ ...Object.keys(descriptor.requiredAttributes || {}),
258
+ ];
259
+ }),
260
+ addressKeys(MESSAGE_QUEUE_METRIC_ADDRESS_ATTRIBUTES),
261
+ ]);
262
+ /**
263
+ * The keys that mark a curated metric's finer-grained repeat
264
+ * (excludeSeriesWithAttributes): the metric resolver also reads these, but
265
+ * only to DROP a datapoint, and they are deliberately not in
266
+ * MESSAGING_METRIC_RESOLVER_INPUT_ATTRIBUTES. They are per instance
267
+ * (Pulsar's consumer name and id), so grouping the discovery query by them
268
+ * would split a topic's rows per consumer. Leaving them out cannot change
269
+ * which queues discovery finds: Pulsar writes a consumer's copy only inside
270
+ * a subscription whose own series names the same topic.
271
+ */
272
+ export const MESSAGE_QUEUE_METRIC_EXCLUDED_SERIES_ATTRIBUTES = uniqueKeys(MESSAGE_QUEUE_METRICS.map((descriptor) => {
273
+ return descriptor.excludeSeriesWithAttributes || [];
274
+ }));
275
+ // ---- reading attributes --------------------------------------------------
276
+ /*
277
+ * Exactly the characters String.prototype.trim removes (ECMAScript
278
+ * WhiteSpace and LineTerminator), so the allocation-free blank check below
279
+ * agrees with readText, which trims.
280
+ */
281
+ function isWhitespaceCode(code) {
282
+ return (code === 0x20 ||
283
+ (code >= 0x09 && code <= 0x0d) ||
284
+ code === 0xa0 ||
285
+ code === 0x1680 ||
286
+ (code >= 0x2000 && code <= 0x200a) ||
287
+ code === 0x2028 ||
288
+ code === 0x2029 ||
289
+ code === 0x202f ||
290
+ code === 0x205f ||
291
+ code === 0x3000 ||
292
+ code === 0xfeff);
293
+ }
294
+ /*
295
+ * Whether a value is present with something in it, without allocating:
296
+ * a string with a non-whitespace character, a finite number, a boolean, an
297
+ * array (stored as its JSON text, never blank).
298
+ */
299
+ function isNonBlankValue(value) {
300
+ if (typeof value === "string") {
301
+ for (let index = 0; index < value.length; index++) {
302
+ if (!isWhitespaceCode(value.charCodeAt(index))) {
303
+ return true;
304
+ }
305
+ }
306
+ return false;
307
+ }
308
+ if (typeof value === "number") {
309
+ return Number.isFinite(value);
310
+ }
311
+ if (typeof value === "boolean" || typeof value === "bigint") {
312
+ return true;
313
+ }
314
+ return Array.isArray(value);
315
+ }
316
+ /*
317
+ * The text a value is stored as in a ClickHouse String column — an
318
+ * attribute map's values (Map(String, String)) and the span kind alike: a
319
+ * string as it is, a number or boolean as its String() form, an array as
320
+ * its JSON text — so an ingest-time row (typed values) and the same row read
321
+ * back from the table (strings) resolve alike. Anything else is absent.
322
+ */
323
+ function storedText(value) {
324
+ if (typeof value === "string") {
325
+ return value;
326
+ }
327
+ if (typeof value === "number") {
328
+ return Number.isFinite(value) ? String(value) : null;
329
+ }
330
+ if (typeof value === "boolean" || typeof value === "bigint") {
331
+ return String(value);
332
+ }
333
+ if (Array.isArray(value)) {
334
+ try {
335
+ return JSON.stringify(value);
336
+ }
337
+ catch (_a) {
338
+ return null;
339
+ }
340
+ }
341
+ return null;
342
+ }
343
+ // The attribute's stored text, trimmed; null when absent or blank.
344
+ function readText(getAttribute, key) {
345
+ const text = storedText(getAttribute(key));
346
+ if (text === null) {
347
+ return null;
348
+ }
349
+ const trimmed = text.trim();
350
+ return trimmed.length > 0 ? trimmed : null;
351
+ }
352
+ // The first of `keys` readText finds, in list order.
353
+ function readFirstText(getAttribute, keys) {
354
+ for (const key of keys) {
355
+ const text = readText(getAttribute, key);
356
+ if (text !== null) {
357
+ return text;
358
+ }
359
+ }
360
+ return null;
361
+ }
362
+ /*
363
+ * The Azure SDKs stamp their resource provider namespace on EVERY client
364
+ * span — Storage, Cosmos DB and Key Vault as much as Service Bus — so those
365
+ * two trigger keys admit a span only when they name a messaging provider
366
+ * (AZURE_PROVIDER_SYSTEMS). Otherwise every Azure SDK span paid a full
367
+ * resolve for a guaranteed "no queue": about 1 µs a row against 0.07 µs for
368
+ * plain HTTP in the ingest benchmark. The comparison is resolveSystem's own
369
+ * (stored text, trimmed, lowercased), so the gate never refuses a span the
370
+ * resolver would place, and the discovery SQL admits the same values
371
+ * (AZURE_MESSAGING_PROVIDER_NAMESPACES).
372
+ */
373
+ const AZURE_RESOURCE_PROVIDER_TRIGGERS = new Set(AZURE_RESOURCE_PROVIDER_ATTRIBUTES);
374
+ // Longer than any provider namespace in AZURE_PROVIDER_SYSTEMS.
375
+ const AZURE_PROVIDER_TRIGGER_MAX_LENGTH = 32;
376
+ function isTriggerValue(key, value) {
377
+ if (!AZURE_RESOURCE_PROVIDER_TRIGGERS.has(key)) {
378
+ return isNonBlankValue(value);
379
+ }
380
+ const text = storedText(value);
381
+ if (text === null) {
382
+ return false;
383
+ }
384
+ const trimmed = text.trim();
385
+ return (trimmed.length <= AZURE_PROVIDER_TRIGGER_MAX_LENGTH &&
386
+ AZURE_PROVIDER_SYSTEMS.has(trimmed.toLowerCase()));
387
+ }
388
+ /*
389
+ * Cached once: under Jest's vm context every lookup of the global `Object`
390
+ * goes through the sandbox's interceptors, which made this gate ~20× slower
391
+ * there than in plain Node.
392
+ */
393
+ const HAS_OWN_PROPERTY = Object.prototype.hasOwnProperty;
394
+ function hasTrigger(getAttribute) {
395
+ for (let index = 0; index < MESSAGING_TRIGGER_ATTRIBUTES.length; index++) {
396
+ const key = MESSAGING_TRIGGER_ATTRIBUTES[index];
397
+ if (key !== undefined && isTriggerValue(key, getAttribute(key))) {
398
+ return true;
399
+ }
400
+ }
401
+ return false;
402
+ }
403
+ /**
404
+ * Whether a row's flattened attributes carry any messaging trigger
405
+ * (MESSAGING_TRIGGER_ATTRIBUTES) with a non-blank value — the Azure resource
406
+ * provider keys only when they name Service Bus or Event Hubs — the cheap
407
+ * gate ingest runs on every span before anything else. Own keys only; it
408
+ * never enumerates the map, and allocates only to compare an Azure provider
409
+ * value, so it is safe on every row.
410
+ */
411
+ export function hasMessagingTrigger(attributes) {
412
+ if (!attributes || typeof attributes !== "object") {
413
+ return false;
414
+ }
415
+ for (let index = 0; index < MESSAGING_TRIGGER_ATTRIBUTES.length; index++) {
416
+ const key = MESSAGING_TRIGGER_ATTRIBUTES[index];
417
+ if (key !== undefined &&
418
+ HAS_OWN_PROPERTY.call(attributes, key) &&
419
+ isTriggerValue(key, attributes[key])) {
420
+ return true;
421
+ }
422
+ }
423
+ return false;
424
+ }
425
+ /*
426
+ * The stored SpanKind strings ("SPAN_KIND_PRODUCER", …), the bare names,
427
+ * and OTLP's numbers (1 internal … 5 consumer). Compared as literals: the
428
+ * SpanKind enum lives in the Span analytics model, which a Types module does
429
+ * not pull in (the tests pin the two against each other).
430
+ */
431
+ const SPAN_KIND_BY_NAME = new Map([
432
+ ["INTERNAL", "INTERNAL"],
433
+ ["SERVER", "SERVER"],
434
+ ["CLIENT", "CLIENT"],
435
+ ["PRODUCER", "PRODUCER"],
436
+ ["CONSUMER", "CONSUMER"],
437
+ ]);
438
+ const SPAN_KIND_BY_OTLP_NUMBER = new Map([
439
+ [1, "INTERNAL"],
440
+ [2, "SERVER"],
441
+ [3, "CLIENT"],
442
+ [4, "PRODUCER"],
443
+ [5, "CONSUMER"],
444
+ ]);
445
+ const SPAN_KIND_PREFIX = "SPAN_KIND_";
446
+ // One or more ASCII digits, and nothing else.
447
+ function isAsciiDigits(value) {
448
+ if (value.length === 0) {
449
+ return false;
450
+ }
451
+ for (let index = 0; index < value.length; index++) {
452
+ const code = value.charCodeAt(index);
453
+ if (code < 0x30 || code > 0x39) {
454
+ return false;
455
+ }
456
+ }
457
+ return true;
458
+ }
459
+ /*
460
+ * A span's kind, read from the text ClickHouse keeps for it (storedText),
461
+ * so that the stamper, which sees the value a row carries, and the
462
+ * discovery cron, which reads the kind column back, read every kind alike.
463
+ * The two can differ: ingest stores the SpanKind string, but a trace
464
+ * pipeline's Span Kind Remapper writes its mapping's kind as it is, and a
465
+ * configuration saved through the API may hold a NUMBER. The stamper then
466
+ * sees 2 while the column keeps the JSON text "2"; read as a name, "2"
467
+ * would be no kind, and the cron would create a queue for SERVER spans
468
+ * ingest never keyed. So a trimmed run of ASCII digits is the OTLP number
469
+ * it names, read as Number() reads it: leading zeros count for nothing
470
+ * ("02" is 2, SERVER, as OtelTracesIngestService.mapSpanKind's parseInt
471
+ * reads an OTLP kind). Any other text is a name ("SPAN_KIND_" optional, any
472
+ * case). A number OTLP does not define, and numeric text that is not plain
473
+ * digits ("-2", "2.5", "+2", "1e+21"), is no kind.
474
+ */
475
+ function normalizeSpanKind(kind) {
476
+ const text = storedText(kind);
477
+ if (text === null) {
478
+ return null;
479
+ }
480
+ const trimmed = text.trim();
481
+ if (isAsciiDigits(trimmed)) {
482
+ return SPAN_KIND_BY_OTLP_NUMBER.get(Number(trimmed)) || null;
483
+ }
484
+ let name = trimmed.toUpperCase();
485
+ if (name.startsWith(SPAN_KIND_PREFIX)) {
486
+ name = name.substring(SPAN_KIND_PREFIX.length);
487
+ }
488
+ return SPAN_KIND_BY_NAME.get(name) || null;
489
+ }
490
+ // ---- system ------------------------------------------------------------------
491
+ const AZURE_LEGACY_COMPONENT_SYSTEMS = new Map([
492
+ ["servicebus", "servicebus"],
493
+ ["eventhubs", "eventhubs"],
494
+ ]);
495
+ const AWS_RPC_SYSTEM = "aws-api";
496
+ const AWS_RPC_SERVICE_SYSTEMS = new Map([
497
+ ["sqs", "aws_sqs"],
498
+ ["amazonsqs", "aws_sqs"],
499
+ ["sns", "aws.sns"],
500
+ ["amazonsns", "aws.sns"],
501
+ ]);
502
+ /*
503
+ * Which system, in this order: `messaging.system`; the Azure resource
504
+ * provider namespace; the Azure legacy `component` (only beside its other
505
+ * legacy keys); an AWS SDK RPC span naming SQS or SNS (the Java agent's SNS
506
+ * spans carry no `messaging.system`); the SQS queue URL / SNS topic ARN
507
+ * keys. An excluded `messaging.system` (in-process channels) stops here; a
508
+ * malformed one falls through to the other evidence. Celery sets no
509
+ * messaging system and is not detected (its broker is unknown).
510
+ */
511
+ function resolveSystem(getAttribute) {
512
+ const rawSystem = readText(getAttribute, MESSAGING_SYSTEM_ATTRIBUTE);
513
+ if (rawSystem !== null) {
514
+ if (isExcludedMessagingSystem(rawSystem)) {
515
+ return null;
516
+ }
517
+ const normalized = normalizeMessagingSystem(rawSystem);
518
+ if (normalized) {
519
+ return normalized;
520
+ }
521
+ }
522
+ const provider = readFirstText(getAttribute, AZURE_RESOURCE_PROVIDER_ATTRIBUTES);
523
+ const providerSystem = provider
524
+ ? AZURE_PROVIDER_SYSTEMS.get(provider.toLowerCase())
525
+ : undefined;
526
+ if (providerSystem) {
527
+ return providerSystem;
528
+ }
529
+ const component = readText(getAttribute, AZURE_LEGACY_COMPONENT_ATTRIBUTE);
530
+ const componentSystem = component
531
+ ? AZURE_LEGACY_COMPONENT_SYSTEMS.get(component.toLowerCase())
532
+ : undefined;
533
+ if (componentSystem &&
534
+ readFirstText(getAttribute, AZURE_LEGACY_COMPONENT_EVIDENCE) !== null) {
535
+ return componentSystem;
536
+ }
537
+ const rpcSystem = readFirstText(getAttribute, RPC_SYSTEM_ATTRIBUTES);
538
+ if (rpcSystem !== null && rpcSystem.toLowerCase() === AWS_RPC_SYSTEM) {
539
+ const rpcService = readText(getAttribute, RPC_SERVICE_ATTRIBUTE);
540
+ const awsSystem = rpcService
541
+ ? AWS_RPC_SERVICE_SYSTEMS.get(rpcService.toLowerCase())
542
+ : undefined;
543
+ if (awsSystem) {
544
+ return awsSystem;
545
+ }
546
+ }
547
+ if (readFirstText(getAttribute, SQS_QUEUE_URL_ATTRIBUTES) !== null) {
548
+ return "aws_sqs";
549
+ }
550
+ if (readFirstText(getAttribute, SNS_TOPIC_ARN_ATTRIBUTES) !== null) {
551
+ return "aws.sns";
552
+ }
553
+ return null;
554
+ }
555
+ // ---- temporary destinations ------------------------------------------------
556
+ function isTrueFlag(value) {
557
+ if (value === true) {
558
+ return true;
559
+ }
560
+ return typeof value === "string" && value.trim().toLowerCase() === "true";
561
+ }
562
+ function hasTemporaryFlag(getAttribute) {
563
+ for (const key of MESSAGING_TEMPORARY_FLAG_ATTRIBUTES) {
564
+ if (isTrueFlag(getAttribute(key))) {
565
+ return true;
566
+ }
567
+ }
568
+ return false;
569
+ }
570
+ /*
571
+ * Names instrumentations emit INSTEAD of a real destination:
572
+ * - "(temporary)": Java JMS temporary queues (and pika span names);
573
+ * - "(anonymous)": the spec's own placeholder up to 1.26;
574
+ * - "<generated>", "<default>": the Java agent's legacy RabbitMQ names
575
+ * ("<default>" is the default exchange; RabbitMQ resolves it through
576
+ * the routing key before this check);
577
+ * - "unknown": the Java agent's null destination (a Kafka batch spanning
578
+ * several topics) and JS / Python SNS spans without an ARN;
579
+ * - "aws:sqs": the Java agent's legacy Lambda SQS event source;
580
+ * - "-namespaceonlymetric-": Azure Monitor's EntityName for a
581
+ * namespace-level value.
582
+ */
583
+ const PLACEHOLDER_DESTINATIONS = new Set([
584
+ "(temporary)",
585
+ "(anonymous)",
586
+ "<generated>",
587
+ "<default>",
588
+ "unknown",
589
+ "aws:sqs",
590
+ "-namespaceonlymetric-",
591
+ ]);
592
+ /*
593
+ * SNS SMS publishes: the Python botocore instrumentation names the
594
+ * destination "phone_number:**" (the number censored) and its span
595
+ * "phone_number send". Exact values, for SNS only: a Kafka topic or an SQS
596
+ * queue called "phone_numbers" is a real destination.
597
+ */
598
+ const SNS_PHONE_NUMBER_PLACEHOLDER = "phone_number";
599
+ const SNS_PHONE_NUMBER_PLACEHOLDER_PREFIX = "phone_number:";
600
+ /*
601
+ * What OneUptime's own scrubbers leave when they replace a WHOLE value: the
602
+ * trace scrubber's "[REDACTED]" and "[HASHED:<first 8 hex of the SHA-256>]",
603
+ * its mask of a short value ("***"), and a metric pipeline's default
604
+ * "[REDACTED]". Nothing of the name is left, so there is no queue to find
605
+ * (and every scrubbed destination must not merge into one queue). A value
606
+ * scrubbed only in part ("orders-[REDACTED]") keeps its queue: the rest
607
+ * still names it, and every scrubbed variant folds into it, as a templated
608
+ * UUID does.
609
+ */
610
+ const SCRUBBED_VALUE = "[redacted]";
611
+ const SCRUBBED_HASH_PATTERN = /^\[hashed:[0-9a-f]+\]$/;
612
+ const MASK_CHARACTER = "*";
613
+ function isScrubbedValue(lower) {
614
+ if (lower === SCRUBBED_VALUE || SCRUBBED_HASH_PATTERN.test(lower)) {
615
+ return true;
616
+ }
617
+ for (let index = 0; index < lower.length; index++) {
618
+ if (lower.charAt(index) !== MASK_CHARACTER) {
619
+ return false;
620
+ }
621
+ }
622
+ return lower.length > 0;
623
+ }
624
+ /*
625
+ * JMS temporary destinations as ActiveMQ prints them
626
+ * ("temp-queue://ID:host-1234-…").
627
+ */
628
+ const JMS_TEMPORARY_PREFIXES = [
629
+ "temp-queue://",
630
+ "temp-topic://",
631
+ ];
632
+ const CANONICAL_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
633
+ const UUID_SUBSTRING_PATTERN = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
634
+ /*
635
+ * The Java agent's generated-RabbitMQ-queue heuristic: server-named
636
+ * `amq.gen-…`, Spring AMQP's `spring.gen-…`, and Spring Cloud Stream's
637
+ * anonymous queues `<destination>.anonymous.<22 base64url characters>`
638
+ * (plus the bare UUID, checked for every system). Direct reply-to uses the
639
+ * `amq.rabbitmq.reply-to` pseudo-queue and `amq.rabbitmq.reply-to.<suffix>`.
640
+ */
641
+ const RABBITMQ_GENERATED_PREFIXES = [
642
+ "amq.gen-",
643
+ "spring.gen-",
644
+ "amq.rabbitmq.reply-to",
645
+ ];
646
+ const RABBITMQ_ANONYMOUS_QUEUE_PATTERN = /\.anonymous\.[A-Za-z0-9_-]{22}$/;
647
+ /*
648
+ * MassTransit's per-process endpoints, on each broker it runs on (RabbitMQ,
649
+ * ActiveMQ, Azure Service Bus, Amazon SQS). Every process names its own,
650
+ * deleted once the process is gone, so each start of a process would be a
651
+ * new queue; MassTransit's own diagnostics fold them into "bus",
652
+ * "endpoint", "signalr" and "instance" (its send spans name those, which
653
+ * are left alone: a real queue may be called that). Two shapes, where {id}
654
+ * is a NewId in lowercase z-base-32 (26 characters):
655
+ * - a temporary endpoint (DefaultEndpointNameFormatter
656
+ * .GetTemporaryQueueName), `{machine}_{process}_{tag}_{id}`: the machine
657
+ * and process names cut down to ASCII letters and digits, and the tag
658
+ * "bus" (the bus endpoint, where a request client's responses arrive),
659
+ * "endpoint", "response", "signalr_{hub}" or the application's own;
660
+ * - a service's instance endpoint (InstanceEndpointDefinition),
661
+ * `Instance_{id}`, or `instance_{id}` / `instance-{id}` under the snake-
662
+ * and kebab-case endpoint name formatters.
663
+ * Matched on the lowercased name. MassTransit caps these names at 72
664
+ * characters; a name longer than a queue name may be is not tested, which
665
+ * bounds the pattern's cost on any attribute value.
666
+ */
667
+ const MASSTRANSIT_TEMPORARY_ENDPOINT_PATTERN = /^[a-z0-9]+_[a-z0-9]+_.+_[ybndrfg8ejkmcpqxot1uwisza345h769]{26}$/;
668
+ const MASSTRANSIT_INSTANCE_ENDPOINT_PATTERN = /^instance[_-][ybndrfg8ejkmcpqxot1uwisza345h769]{26}$/;
669
+ function isMassTransitProcessEndpoint(lower) {
670
+ return (lower.length <= MESSAGE_QUEUE_DESTINATION_MAX_LENGTH &&
671
+ (MASSTRANSIT_TEMPORARY_ENDPOINT_PATTERN.test(lower) ||
672
+ MASSTRANSIT_INSTANCE_ENDPOINT_PATTERN.test(lower)));
673
+ }
674
+ // TIBCO's temporary destinations; ActiveMQ's advisory topics.
675
+ const JMS_GENERATED_PREFIXES = [
676
+ "$tmp$",
677
+ "activemq.advisory.",
678
+ ];
679
+ /*
680
+ * NATS request/reply inboxes (`_INBOX.<id>`; the Java agent's template is
681
+ * the prefix itself) and JetStream acknowledgement subjects (`$JS.ACK.…`,
682
+ * templated as `$JS.ACK`).
683
+ */
684
+ const NATS_GENERATED_NAMES = ["_inbox", "$js.ack"];
685
+ // Pulsar's system topics: `__change_events`, `__transaction_*`, `…/__…`.
686
+ const PULSAR_SYSTEM_TOPIC_MARKER = "/__";
687
+ const PULSAR_SYSTEM_TOPICS = ["__change_events"];
688
+ const PULSAR_SYSTEM_TOPIC_PREFIXES = ["__transaction_"];
689
+ // An SNS SMS publish names the phone number (E.164) as its destination.
690
+ const SNS_PHONE_NUMBER_PATTERN = /^\+[0-9][0-9 ().-]{4,}$/;
691
+ function startsWithAny(value, prefixes) {
692
+ for (const prefix of prefixes) {
693
+ if (value.startsWith(prefix)) {
694
+ return true;
695
+ }
696
+ }
697
+ return false;
698
+ }
699
+ function isNameOrChild(value, names) {
700
+ for (const name of names) {
701
+ if (value === name || value.startsWith(`${name}.`)) {
702
+ return true;
703
+ }
704
+ }
705
+ return false;
706
+ }
707
+ /**
708
+ * Whether a destination name (already normalized for its system) is
709
+ * temporary, generated or a placeholder rather than a queue: the
710
+ * placeholders above, a value a scrubber replaced whole, a bare UUID, a JMS
711
+ * temporary destination, and per system — RabbitMQ's generated and
712
+ * reply-to queues, JMS / ActiveMQ's `$TMP$` and advisory topics,
713
+ * MassTransit's per-process endpoints on the brokers it runs on, NATS
714
+ * inboxes and JetStream ack subjects, Pulsar's system topics, SNS phone
715
+ * numbers and their placeholders. Case-insensitive; true for a blank or
716
+ * non-string name too (never a queue).
717
+ */
718
+ export function isTemporaryMessagingDestination(system, destination) {
719
+ if (typeof destination !== "string") {
720
+ return true;
721
+ }
722
+ const value = destination.trim();
723
+ if (!value) {
724
+ return true;
725
+ }
726
+ const lower = value.toLowerCase();
727
+ if (PLACEHOLDER_DESTINATIONS.has(lower) ||
728
+ isScrubbedValue(lower) ||
729
+ CANONICAL_UUID_PATTERN.test(value) ||
730
+ startsWithAny(lower, JMS_TEMPORARY_PREFIXES)) {
731
+ return true;
732
+ }
733
+ switch (normalizeMessagingSystem(system)) {
734
+ case "rabbitmq":
735
+ return (startsWithAny(lower, RABBITMQ_GENERATED_PREFIXES) ||
736
+ RABBITMQ_ANONYMOUS_QUEUE_PATTERN.test(value) ||
737
+ isMassTransitProcessEndpoint(lower));
738
+ case "jms":
739
+ case "activemq":
740
+ return (startsWithAny(lower, JMS_GENERATED_PREFIXES) ||
741
+ isMassTransitProcessEndpoint(lower));
742
+ case "servicebus":
743
+ case "aws_sqs":
744
+ return isMassTransitProcessEndpoint(lower);
745
+ case "nats":
746
+ return isNameOrChild(lower, NATS_GENERATED_NAMES);
747
+ case "pulsar":
748
+ return (lower.includes(PULSAR_SYSTEM_TOPIC_MARKER) ||
749
+ PULSAR_SYSTEM_TOPICS.includes(lower) ||
750
+ startsWithAny(lower, PULSAR_SYSTEM_TOPIC_PREFIXES));
751
+ case "aws.sns":
752
+ return (lower === SNS_PHONE_NUMBER_PLACEHOLDER ||
753
+ lower.startsWith(SNS_PHONE_NUMBER_PLACEHOLDER_PREFIX) ||
754
+ SNS_PHONE_NUMBER_PATTERN.test(value));
755
+ default:
756
+ return false;
757
+ }
758
+ }
759
+ // A value naming several destinations at once (a batch): never one queue.
760
+ function isListText(value) {
761
+ return value.startsWith("[") && value.endsWith("]");
762
+ }
763
+ function hasScheme(value) {
764
+ return value.indexOf("://") > 0;
765
+ }
766
+ /*
767
+ * The last non-empty path segment of a URL (`https://sqs.us-east-1.
768
+ * amazonaws.com/123456789012/orders` → "orders"), or null for a value that
769
+ * is not a URL or has no path.
770
+ */
771
+ function lastUrlPathSegment(value) {
772
+ const schemeEnd = value.indexOf("://");
773
+ if (schemeEnd <= 0) {
774
+ return null;
775
+ }
776
+ let rest = value.substring(schemeEnd + 3);
777
+ for (const terminator of ["?", "#"]) {
778
+ const index = rest.indexOf(terminator);
779
+ if (index >= 0) {
780
+ rest = rest.substring(0, index);
781
+ }
782
+ }
783
+ const pathStart = rest.indexOf("/");
784
+ if (pathStart < 0) {
785
+ return null;
786
+ }
787
+ const segments = rest
788
+ .substring(pathStart + 1)
789
+ .split("/")
790
+ .filter((segment) => {
791
+ return segment.trim().length > 0;
792
+ });
793
+ const last = segments[segments.length - 1];
794
+ return last ? last.trim() : null;
795
+ }
796
+ const ARN_PREFIX = "arn:";
797
+ function isArn(value) {
798
+ return value.toLowerCase().startsWith(ARN_PREFIX);
799
+ }
800
+ /*
801
+ * `arn:partition:service:region:account:resource` → the resource (for an
802
+ * SQS queue or SNS topic, its name), or null for anything else — a
803
+ * truncated ARN included. An SNS subscription ARN
804
+ * (`…:topic:subscription-id`) names its topic.
805
+ */
806
+ function arnResource(value) {
807
+ if (!isArn(value)) {
808
+ return null;
809
+ }
810
+ const parts = value.split(":");
811
+ const resource = parts[5];
812
+ return resource && resource.trim() ? resource.trim() : null;
813
+ }
814
+ /*
815
+ * SQS: a queue URL or ARN → the queue name; a plain name stays. An ARN cut
816
+ * short of its resource names nothing (an SQS name cannot contain ":").
817
+ */
818
+ function sqsQueueName(value) {
819
+ if (hasScheme(value)) {
820
+ return lastUrlPathSegment(value) || "";
821
+ }
822
+ if (isArn(value)) {
823
+ return arnResource(value) || "";
824
+ }
825
+ return value;
826
+ }
827
+ /*
828
+ * SNS: a topic ARN → the topic name; a plain name stays. A topic name is
829
+ * only ASCII letters, digits, "_" and "-" (plus FIFO's ".fifo", per SNS's
830
+ * CreateTopic), so a truncated ARN names nothing, and a "/" means a
831
+ * mobile-push platform endpoint or application (one per device), not a
832
+ * topic — whether the ARN is whole (the Java agent, JS
833
+ * messaging.destination.name) or cut after its last ":" (Go otelaws, JS
834
+ * messaging.destination: `endpoint/GCM/<app>/<id>`).
835
+ */
836
+ function snsTopicName(value) {
837
+ const name = isArn(value) ? arnResource(value) || "" : value;
838
+ return name.includes("/") ? "" : name;
839
+ }
840
+ /*
841
+ * Pub/Sub: a full resource name (`projects/<p>/topics/<t>`,
842
+ * `projects/<p>/subscriptions/<s>`, optionally after
843
+ * `//pubsub.googleapis.com/`) → the short id the client libraries report.
844
+ */
845
+ const PUBSUB_RESOURCE_NAME_PATTERN = /(?:^|\/)projects\/[^/]+\/(?:topics|subscriptions)\/([^/]+)$/;
846
+ function pubSubResourceId(value) {
847
+ const match = PUBSUB_RESOURCE_NAME_PATTERN.exec(value);
848
+ return match && match[1] ? match[1] : value;
849
+ }
850
+ /*
851
+ * Service Bus / Event Hubs entity paths, split case-insensitively: the .NET
852
+ * and JS SDKs say `{topic}/Subscriptions/{sub}` and `/$DeadLetterQueue`,
853
+ * Java `/subscriptions/` and `/$deadletterqueue`, transfer dead-letter
854
+ * queues add `/$Transfer/$DeadLetterQueue`, and an Event Hubs receiver's
855
+ * path is `{hub}/ConsumerGroups/{group}/Partitions/{n}`. The entity (queue,
856
+ * topic or event hub) is the destination; the subscription or consumer
857
+ * group is display only, and so is the partition, which is dropped.
858
+ */
859
+ const AZURE_DEAD_LETTER_MARKERS = [
860
+ "/$transfer/$deadletterqueue",
861
+ "/$deadletterqueue",
862
+ ];
863
+ const AZURE_CONSUMER_MARKERS = [
864
+ "/subscriptions/",
865
+ "/consumergroups/",
866
+ ];
867
+ function splitAzureEntityPath(value) {
868
+ let entity = value;
869
+ let isDeadLetter = false;
870
+ let consumerGroup = null;
871
+ for (const marker of AZURE_DEAD_LETTER_MARKERS) {
872
+ const index = entity.toLowerCase().indexOf(marker);
873
+ if (index >= 0) {
874
+ entity = entity.substring(0, index);
875
+ isDeadLetter = true;
876
+ break;
877
+ }
878
+ }
879
+ for (const marker of AZURE_CONSUMER_MARKERS) {
880
+ const index = entity.toLowerCase().indexOf(marker);
881
+ if (index >= 0) {
882
+ const rest = entity.substring(index + marker.length);
883
+ const end = rest.indexOf("/");
884
+ const group = (end >= 0 ? rest.substring(0, end) : rest).trim();
885
+ consumerGroup = group || null;
886
+ entity = entity.substring(0, index);
887
+ break;
888
+ }
889
+ }
890
+ return { destination: entity, consumerGroup, isDeadLetter };
891
+ }
892
+ /*
893
+ * Pulsar: a partition folds into its topic (`orders-partition-3` →
894
+ * `orders`), and a name without a domain is expanded the way Pulsar itself
895
+ * does — a short name into the default tenant and namespace
896
+ * (`persistent://public/default/orders`), `tenant/namespace/topic` into the
897
+ * persistent domain — so the Java agent's names as given join the brokers'
898
+ * fully-qualified metric labels.
899
+ */
900
+ const PULSAR_PARTITION_SUFFIX_PATTERN = /-partition-\d+$/;
901
+ function pulsarTopic(value) {
902
+ const topic = value.replace(PULSAR_PARTITION_SUFFIX_PATTERN, "");
903
+ if (topic.includes("://")) {
904
+ return topic;
905
+ }
906
+ if (!topic.includes("/")) {
907
+ return `persistent://public/default/${topic}`;
908
+ }
909
+ const parts = topic.split("/");
910
+ if (parts.length === 3 &&
911
+ parts.every((part) => {
912
+ return part.length > 0;
913
+ })) {
914
+ return `persistent://${topic}`;
915
+ }
916
+ return topic;
917
+ }
918
+ // JMS / ActiveMQ: "queue://orders" and "topic://orders" name "orders".
919
+ const JMS_DESTINATION_PREFIXES = [
920
+ "queue://",
921
+ "topic://",
922
+ ];
923
+ function stripJmsPrefix(value) {
924
+ const lower = value.toLowerCase();
925
+ for (const prefix of JMS_DESTINATION_PREFIXES) {
926
+ if (lower.startsWith(prefix)) {
927
+ return value.substring(prefix.length);
928
+ }
929
+ }
930
+ return value;
931
+ }
932
+ // ActiveMQ's shared DLQ, and the individual ones' default `DLQ.` prefix.
933
+ function isActiveMqDeadLetterQueue(value) {
934
+ const lower = value.toLowerCase();
935
+ return lower === "activemq.dlq" || lower.startsWith("dlq.");
936
+ }
937
+ // RocketMQ names a consumer group's dead-letter topic `%DLQ%<group>`.
938
+ const ROCKETMQ_DEAD_LETTER_PREFIX = "%dlq%";
939
+ /*
940
+ * RabbitMQ's default exchange, as instrumentations spell it: "" (JS
941
+ * amqplib; absent once stored), "amq.default" (semconv, the .NET client)
942
+ * and "<default>" (the Java agent's legacy mode).
943
+ */
944
+ const RABBITMQ_DEFAULT_EXCHANGES = new Set([
945
+ "",
946
+ "amq.default",
947
+ "<default>",
948
+ ]);
949
+ function isRabbitMqDefaultExchange(value) {
950
+ return RABBITMQ_DEFAULT_EXCHANGES.has(value.trim().toLowerCase());
951
+ }
952
+ // The exchange / routing key / queue parts of a joined name, trimmed.
953
+ function splitJoinedRabbitMqName(value) {
954
+ return value.split(":").map((part) => {
955
+ return part.trim();
956
+ });
957
+ }
958
+ /*
959
+ * aio-pika's publish name `{exchange},{routing key}` (it sets no routing-key
960
+ * attribute): the exchange, or the routing key when the exchange is the
961
+ * default one. Anything else with a comma is a name as given.
962
+ */
963
+ function rabbitMqCommaName(value, routingKey) {
964
+ const parts = value.split(",");
965
+ if (parts.length !== 2) {
966
+ return value;
967
+ }
968
+ const exchange = (parts[0] || "").trim();
969
+ const key = (parts[1] || "").trim();
970
+ if (routingKey !== null && key.length > 0 && key !== routingKey) {
971
+ return value;
972
+ }
973
+ return isRabbitMqDefaultExchange(exchange)
974
+ ? key || routingKey || ""
975
+ : exchange;
976
+ }
977
+ /*
978
+ * Whether a three-part RabbitMQ name, `middle` its second part, is semconv
979
+ * 1.30's consumer name `{exchange}:{routing key}:{queue}`, so its third part
980
+ * is the queue. Only a consumer's or a settlement's can be. With the
981
+ * routing-key attribute, the routing key must be the middle part. Without
982
+ * it, the name is also an exchange named with a colon, its empty routing
983
+ * key left out (`Namespace:Type:{queue}`), when it is written to the joining
984
+ * conventions (hasJoinedNaming) — a datapoint's as much as a span's. One
985
+ * that is not is one name, as the same consumer's span is read: the older
986
+ * conventions name the exchange, MassTransit's Fault<T> exchange
987
+ * (`MassTransit:Fault--Namespace:Type--`) among them.
988
+ */
989
+ function isJoinedRabbitMqConsumerName(middle, naming) {
990
+ if (!naming.consumerSide) {
991
+ return false;
992
+ }
993
+ if (naming.routingKey !== null) {
994
+ return naming.routingKey === middle;
995
+ }
996
+ return naming.hasJoinedNaming();
997
+ }
998
+ /*
999
+ * RabbitMQ destinations, where two naming conventions meet:
1000
+ * - most instrumentations put ONE name in the key — the exchange (the
1001
+ * Java agent's default mode, amqplib, pika, RabbitMQ.Client for .NET,
1002
+ * MassTransit's own spans), "" / "<default>" / "amq.default" for the
1003
+ * default exchange (whose routing key IS the queue name), or the
1004
+ * routing key (pika, Spring Rabbit) — and that name may itself contain
1005
+ * ":" (MassTransit names each message type's exchange
1006
+ * `Namespace:Type` and publishes to it with an empty routing key);
1007
+ * - semconv 1.30 joins the parts with ":", leaving empty ones out:
1008
+ * `{exchange}:{routing key}` on a producer, and
1009
+ * `{exchange}:{routing key}:{queue}` on a consumer, which also leaves
1010
+ * the queue out when it equals the routing key. So on a consumer
1011
+ * `direct_logs:warning` is the queue `warning`, and `logs:logs-audit`
1012
+ * (a fanout exchange's empty routing key left out) the queue
1013
+ * `logs-audit`. The Java agent's opt-in mode emits these.
1014
+ * A consumer resolves to its queue, which is what the broker's own metrics
1015
+ * are keyed by; a producer to its exchange (a publisher names no queue).
1016
+ *
1017
+ * Three parts are a joined name only on the consuming side: semconv joins
1018
+ * three nowhere else (a producer's is `{exchange}:{routing key}`). On a
1019
+ * producer, or with no direction, three parts are one exchange name —
1020
+ * MassTransit names a generic message type's exchange, a Fault<T>'s among
1021
+ * them, with two colons (`MassTransit:Fault--Sample.Contracts:SubmitOrder--`)
1022
+ * and publishes to it with an empty routing key. See
1023
+ * isJoinedRabbitMqConsumerName for when a consumer's three parts name its
1024
+ * queue. An empty third part leaves two parts.
1025
+ *
1026
+ * For two parts, the routing-key attribute tells the conventions apart:
1027
+ * semconv requires it whenever the key is non-empty, so a joined name with a
1028
+ * routing key in it comes with the attribute, in the place the joined form
1029
+ * puts it — on a consumer the second part is the queue (after the exchange,
1030
+ * or after the routing key of a default-exchange delivery); on a producer
1031
+ * the first is the exchange when the routing key is the second; otherwise
1032
+ * the name is one name. Without the attribute:
1033
+ * - a producer SPAN's two parts are one exchange name, colon and all;
1034
+ * - a consumer's two parts are `{exchange}:{queue}` only when it is
1035
+ * written to the joining conventions (see RabbitMqNaming), else one
1036
+ * name;
1037
+ * - a DATAPOINT never carries the key, so a producer's two joined parts
1038
+ * split to their exchange on the same condition. Without the key,
1039
+ * `{exchange}:{routing key}` — how the Java agent names every publish
1040
+ * that has one — and an exchange named with a colon, published to with
1041
+ * an empty routing key, look alike; a datapoint takes the first.
1042
+ * A default-exchange marker as the first part (`:orders`,
1043
+ * `amq.default:orders`) can only be a split name: its second part is the
1044
+ * queue. The default exchange alone names the routing key, else nothing.
1045
+ */
1046
+ function rabbitMqQueue(value, naming) {
1047
+ const routingKey = naming.routingKey;
1048
+ if (isRabbitMqDefaultExchange(value)) {
1049
+ return routingKey || "";
1050
+ }
1051
+ if (!value.includes(":")) {
1052
+ return rabbitMqCommaName(value, routingKey);
1053
+ }
1054
+ let parts = splitJoinedRabbitMqName(value);
1055
+ if (parts.length === 3) {
1056
+ const exchange = parts[0] || "";
1057
+ const key = parts[1] || "";
1058
+ const queue = parts[2] || "";
1059
+ if (queue) {
1060
+ return isJoinedRabbitMqConsumerName(key, naming) ? queue : value;
1061
+ }
1062
+ // `exchange:key:` — no queue part: read what is left as two parts.
1063
+ parts = [exchange, key];
1064
+ }
1065
+ if (parts.length !== 2) {
1066
+ return value;
1067
+ }
1068
+ const first = parts[0] || "";
1069
+ const second = parts[1] || "";
1070
+ if (!second) {
1071
+ // `exchange:` names the exchange alone (the default one: its key).
1072
+ return isRabbitMqDefaultExchange(first) ? routingKey || "" : first;
1073
+ }
1074
+ if (isRabbitMqDefaultExchange(first)) {
1075
+ return routingKey === null || routingKey === second ? second : value;
1076
+ }
1077
+ if (routingKey !== null) {
1078
+ if (naming.consumerSide) {
1079
+ return routingKey === second || routingKey === first ? second : value;
1080
+ }
1081
+ return routingKey === second ? first : value;
1082
+ }
1083
+ if (naming.consumerSide) {
1084
+ return naming.hasJoinedNaming() ? second : value;
1085
+ }
1086
+ if (naming.routingKeyReported) {
1087
+ return value;
1088
+ }
1089
+ return naming.hasJoinedNaming() ? first : value;
1090
+ }
1091
+ function normalizeDestinationForSystem(system, raw,
1092
+ // RabbitMQ only; null when the value is a name as given (see rabbitMqQueue).
1093
+ rabbitMqNaming) {
1094
+ let value = raw.trim();
1095
+ if (!value || isListText(value) || isScrubbedValue(value.toLowerCase())) {
1096
+ return null;
1097
+ }
1098
+ let consumerGroup = null;
1099
+ let isDeadLetter = false;
1100
+ switch (system) {
1101
+ case "rabbitmq":
1102
+ if (rabbitMqNaming) {
1103
+ value = rabbitMqQueue(value, rabbitMqNaming);
1104
+ }
1105
+ break;
1106
+ case "aws_sqs":
1107
+ value = sqsQueueName(value);
1108
+ break;
1109
+ case "aws.sns":
1110
+ value = snsTopicName(value);
1111
+ break;
1112
+ case "gcp_pubsub":
1113
+ value = pubSubResourceId(value);
1114
+ break;
1115
+ case "servicebus":
1116
+ case "eventhubs": {
1117
+ const path = splitAzureEntityPath(value);
1118
+ value = path.destination;
1119
+ consumerGroup = path.consumerGroup;
1120
+ isDeadLetter = path.isDeadLetter;
1121
+ break;
1122
+ }
1123
+ case "pulsar":
1124
+ value = pulsarTopic(value);
1125
+ break;
1126
+ case "activemq":
1127
+ case "jms":
1128
+ value = stripJmsPrefix(value);
1129
+ isDeadLetter = isActiveMqDeadLetterQueue(value.trim());
1130
+ break;
1131
+ case "rocketmq":
1132
+ isDeadLetter = value
1133
+ .toLowerCase()
1134
+ .startsWith(ROCKETMQ_DEAD_LETTER_PREFIX);
1135
+ break;
1136
+ default:
1137
+ break;
1138
+ }
1139
+ value = value.trim();
1140
+ if (!value) {
1141
+ return null;
1142
+ }
1143
+ return { destination: value, consumerGroup, isDeadLetter };
1144
+ }
1145
+ // Each UUID → "{uuid}", so a per-request queue name keys one queue.
1146
+ function templateDestination(destination) {
1147
+ return destination.replace(UUID_SUBSTRING_PATTERN, "{uuid}");
1148
+ }
1149
+ /*
1150
+ * A display-only value (broker address, consumer group), trimmed and
1151
+ * clamped; null when blank, and when it holds a control character it
1152
+ * could not be stored or shown with.
1153
+ */
1154
+ function clampDisplay(value) {
1155
+ if (value === null) {
1156
+ return null;
1157
+ }
1158
+ const trimmed = value.trim();
1159
+ if (!trimmed || hasControlCharacter(trimmed)) {
1160
+ return null;
1161
+ }
1162
+ return trimmed.length > DISPLAY_VALUE_MAX_LENGTH
1163
+ ? trimmed.substring(0, DISPLAY_VALUE_MAX_LENGTH)
1164
+ : trimmed;
1165
+ }
1166
+ /*
1167
+ * The FIRST present destination key wins — a placeholder there means no
1168
+ * queue, never "try the next key" — then, only when none is present, the
1169
+ * system's own keys: SQS queue URLs, the SNS topic ARN, and RabbitMQ's
1170
+ * routing key (no destination at all is the default exchange, whose routing
1171
+ * key is the queue name).
1172
+ */
1173
+ function selectDestination(system, getAttribute) {
1174
+ const generic = readFirstText(getAttribute, MESSAGING_DESTINATION_ATTRIBUTES);
1175
+ if (generic !== null) {
1176
+ return { value: generic, parseRabbitMqAddressing: true };
1177
+ }
1178
+ if (system === "aws_sqs") {
1179
+ const queueUrl = readFirstText(getAttribute, SQS_QUEUE_URL_ATTRIBUTES);
1180
+ if (queueUrl !== null) {
1181
+ return { value: queueUrl, parseRabbitMqAddressing: false };
1182
+ }
1183
+ for (const key of SQS_QUEUE_URL_FALLBACK_ATTRIBUTES) {
1184
+ const candidate = readText(getAttribute, key);
1185
+ if (candidate !== null &&
1186
+ hasScheme(candidate) &&
1187
+ lastUrlPathSegment(candidate) !== null) {
1188
+ return { value: candidate, parseRabbitMqAddressing: false };
1189
+ }
1190
+ }
1191
+ return null;
1192
+ }
1193
+ if (system === "aws.sns") {
1194
+ const topicArn = readFirstText(getAttribute, SNS_TOPIC_ARN_ATTRIBUTES);
1195
+ return topicArn !== null
1196
+ ? { value: topicArn, parseRabbitMqAddressing: false }
1197
+ : null;
1198
+ }
1199
+ if (system === "rabbitmq") {
1200
+ const routingKey = readFirstText(getAttribute, RABBITMQ_ROUTING_KEY_ATTRIBUTES);
1201
+ return routingKey !== null
1202
+ ? { value: routingKey, parseRabbitMqAddressing: false }
1203
+ : null;
1204
+ }
1205
+ return null;
1206
+ }
1207
+ // A port 1-65535, without leading zeros; null for anything else.
1208
+ function validPort(value) {
1209
+ if (value === null) {
1210
+ return null;
1211
+ }
1212
+ const trimmed = value.trim();
1213
+ if (!trimmed || trimmed.length > 5) {
1214
+ return null;
1215
+ }
1216
+ for (let index = 0; index < trimmed.length; index++) {
1217
+ const code = trimmed.charCodeAt(index);
1218
+ if (code < 0x30 || code > 0x39) {
1219
+ return null;
1220
+ }
1221
+ }
1222
+ const port = Number(trimmed);
1223
+ return port >= 1 && port <= 65535 ? String(port) : null;
1224
+ }
1225
+ function stripQuotes(value) {
1226
+ let text = value.trim();
1227
+ const first = text.charAt(0);
1228
+ if ((first === '"' || first === "'") && text.endsWith(first)) {
1229
+ text = text.substring(1, text.length - 1);
1230
+ }
1231
+ return text.trim();
1232
+ }
1233
+ // `["b1:9092", "b2:9092"]` (JSON) or `['b1:9092']` (Python) — not `[::1]`.
1234
+ function isAddressList(value) {
1235
+ if (!value.startsWith("[")) {
1236
+ return false;
1237
+ }
1238
+ const next = value.substring(1).trim().charAt(0);
1239
+ return next === '"' || next === "'" || next === "]";
1240
+ }
1241
+ /*
1242
+ * host[:port] out of whatever an instrumentation put in an address key: a
1243
+ * JSON or Python list of bootstrap servers (the first), a comma-separated
1244
+ * list (the first), a URL (its authority, credentials stripped:
1245
+ * `amqp://user:***@rabbit:5672/vhost` → `rabbit:5672`), `host:port/path`,
1246
+ * a bracketed IPv6 literal.
1247
+ */
1248
+ function parseAddress(raw) {
1249
+ let value = raw.trim();
1250
+ if (isAddressList(value)) {
1251
+ const inner = value.substring(1, value.endsWith("]") ? value.length - 1 : value.length);
1252
+ value = stripQuotes(inner.split(",")[0] || "");
1253
+ }
1254
+ const schemeEnd = value.indexOf("://");
1255
+ if (schemeEnd > 0) {
1256
+ value = value.substring(schemeEnd + 3);
1257
+ for (const terminator of ["/", "?", "#"]) {
1258
+ const index = value.indexOf(terminator);
1259
+ if (index >= 0) {
1260
+ value = value.substring(0, index);
1261
+ }
1262
+ }
1263
+ }
1264
+ else {
1265
+ if (value.includes(",")) {
1266
+ value = value.split(",")[0] || "";
1267
+ }
1268
+ const slash = value.indexOf("/");
1269
+ if (slash >= 0) {
1270
+ value = value.substring(0, slash);
1271
+ }
1272
+ }
1273
+ const at = value.lastIndexOf("@");
1274
+ if (at >= 0) {
1275
+ value = value.substring(at + 1);
1276
+ }
1277
+ value = value.trim();
1278
+ if (!value) {
1279
+ return null;
1280
+ }
1281
+ if (value.startsWith("[")) {
1282
+ const close = value.indexOf("]");
1283
+ if (close <= 1) {
1284
+ return null;
1285
+ }
1286
+ const rest = value.substring(close + 1);
1287
+ return {
1288
+ host: value.substring(0, close + 1),
1289
+ port: rest.startsWith(":") ? validPort(rest.substring(1)) : null,
1290
+ };
1291
+ }
1292
+ const firstColon = value.indexOf(":");
1293
+ if (firstColon >= 0 && firstColon === value.lastIndexOf(":")) {
1294
+ const host = value.substring(0, firstColon).trim();
1295
+ return host
1296
+ ? { host, port: validPort(value.substring(firstColon + 1)) }
1297
+ : null;
1298
+ }
1299
+ // No port, or a bare IPv6 literal (several colons).
1300
+ return { host: value, port: null };
1301
+ }
1302
+ function formatAddress(host, port) {
1303
+ if (!port) {
1304
+ return host;
1305
+ }
1306
+ return host.includes(":") && !host.startsWith("[")
1307
+ ? `[${host}]:${port}`
1308
+ : `${host}:${port}`;
1309
+ }
1310
+ function resolveBrokerAddress(getAttribute, attributes) {
1311
+ for (const attribute of attributes) {
1312
+ const raw = readText(getAttribute, attribute.address);
1313
+ if (raw === null) {
1314
+ continue;
1315
+ }
1316
+ const parsed = parseAddress(raw);
1317
+ if (!parsed) {
1318
+ continue;
1319
+ }
1320
+ const port = parsed.port ||
1321
+ (attribute.port
1322
+ ? validPort(readText(getAttribute, attribute.port))
1323
+ : null);
1324
+ return clampDisplay(formatAddress(parsed.host, port));
1325
+ }
1326
+ return null;
1327
+ }
1328
+ /*
1329
+ * The Azure namespace a namespace-scoped system's span was sent to: the
1330
+ * first address whose host is `<namespace>.servicebus.windows.net` (or a
1331
+ * sovereign cloud's). "" for every other system, and when no address names
1332
+ * a namespace (the local emulator, a custom domain).
1333
+ */
1334
+ function resolveBrokerScope(system, getAttribute) {
1335
+ if (getMessagingBrokerScope(system) !== "azure-namespace") {
1336
+ return "";
1337
+ }
1338
+ for (const key of MESSAGING_BROKER_SCOPE_ADDRESS_ATTRIBUTES) {
1339
+ const raw = readText(getAttribute, key);
1340
+ if (raw === null) {
1341
+ continue;
1342
+ }
1343
+ const parsed = parseAddress(raw);
1344
+ const namespace = parsed
1345
+ ? getAzureNamespaceFromHost(parsed.host)
1346
+ : null;
1347
+ if (namespace) {
1348
+ return namespace;
1349
+ }
1350
+ }
1351
+ return "";
1352
+ }
1353
+ // ---- direction -------------------------------------------------------------------
1354
+ /*
1355
+ * `messaging.operation.type` (1.26+) and the legacy `messaging.operation`:
1356
+ * send / publish / create produce (publish became send in 1.28), receive /
1357
+ * process / deliver consume (deliver was 1.23-1.24's process), settle
1358
+ * acknowledges.
1359
+ */
1360
+ const OPERATION_TYPE_DIRECTIONS = new Map([
1361
+ ["send", "publish"],
1362
+ ["publish", "publish"],
1363
+ ["create", "publish"],
1364
+ ["receive", "consume"],
1365
+ ["process", "consume"],
1366
+ ["deliver", "consume"],
1367
+ ["settle", "settle"],
1368
+ ]);
1369
+ // `messaging.operation.name`: system-specific, from the semconv refinements.
1370
+ const OPERATION_NAME_DIRECTIONS = new Map([
1371
+ ["send", "publish"],
1372
+ ["publish", "publish"],
1373
+ ["schedule", "publish"],
1374
+ ["publish_input", "publish"],
1375
+ ["publish_batch_input", "publish"],
1376
+ ["create", "publish"],
1377
+ ["event", "publish"],
1378
+ ["poll", "consume"],
1379
+ ["receive", "consume"],
1380
+ ["fetch", "consume"],
1381
+ ["fetch (empty)", "consume"],
1382
+ ["peek", "consume"],
1383
+ ["receive_deferred", "consume"],
1384
+ ["subscribe", "consume"],
1385
+ ["deliver", "consume"],
1386
+ ["consume", "consume"],
1387
+ ["process", "consume"],
1388
+ ["ack", "settle"],
1389
+ ["nack", "settle"],
1390
+ ["modack", "settle"],
1391
+ ["reject", "settle"],
1392
+ ["complete", "settle"],
1393
+ ["abandon", "settle"],
1394
+ ["defer", "settle"],
1395
+ ["dead_letter", "settle"],
1396
+ ["delete", "settle"],
1397
+ ["commit", "settle"],
1398
+ ["checkpoint", "settle"],
1399
+ ["term", "settle"],
1400
+ ["nak", "settle"],
1401
+ ["in-progress", "settle"],
1402
+ ]);
1403
+ /*
1404
+ * AWS SDK operations (`rpc.method`; Go writes `SQS/SendMessage`): only for
1405
+ * SQS and SNS spans.
1406
+ */
1407
+ const AWS_RPC_METHOD_DIRECTIONS = new Map([
1408
+ ["sendmessage", "publish"],
1409
+ ["sendmessagebatch", "publish"],
1410
+ ["publish", "publish"],
1411
+ ["publishbatch", "publish"],
1412
+ ["receivemessage", "consume"],
1413
+ ["deletemessage", "settle"],
1414
+ ["deletemessagebatch", "settle"],
1415
+ ["changemessagevisibility", "settle"],
1416
+ ["changemessagevisibilitybatch", "settle"],
1417
+ ]);
1418
+ function lookupDirection(map, value) {
1419
+ if (value === null) {
1420
+ return null;
1421
+ }
1422
+ return map.get(value.toLowerCase()) || null;
1423
+ }
1424
+ /*
1425
+ * Direction, strongest evidence first: `messaging.operation.type`; the span
1426
+ * kind (PRODUCER publishes, CONSUMER consumes) — ahead of the legacy
1427
+ * `messaging.operation`, which Python confluent-kafka up to v0.62b1 wrote
1428
+ * as "receive" on its PRODUCER spans, and which producers must not set at
1429
+ * all up to spec 1.16; then the legacy key, which some clients fill with an
1430
+ * operation NAME rather than a type (the Google Cloud Pub/Sub clients write
1431
+ * "ack", "modack" and "nack" there: OpenTelemetryPubsubTracer); then
1432
+ * `messaging.operation.name`; and, for SQS / SNS, the AWS SDK operation.
1433
+ */
1434
+ function resolveDirection(getAttribute, system, kind) {
1435
+ const operationType = lookupDirection(OPERATION_TYPE_DIRECTIONS, readText(getAttribute, OPERATION_TYPE_ATTRIBUTE));
1436
+ if (operationType) {
1437
+ return operationType;
1438
+ }
1439
+ if (kind === "PRODUCER") {
1440
+ return "publish";
1441
+ }
1442
+ if (kind === "CONSUMER") {
1443
+ return "consume";
1444
+ }
1445
+ const legacyOperationText = readText(getAttribute, LEGACY_OPERATION_ATTRIBUTE);
1446
+ const legacyOperation = lookupDirection(OPERATION_TYPE_DIRECTIONS, legacyOperationText) ||
1447
+ lookupDirection(OPERATION_NAME_DIRECTIONS, legacyOperationText);
1448
+ if (legacyOperation) {
1449
+ return legacyOperation;
1450
+ }
1451
+ const operationName = lookupDirection(OPERATION_NAME_DIRECTIONS, readText(getAttribute, OPERATION_NAME_ATTRIBUTE));
1452
+ if (operationName) {
1453
+ return operationName;
1454
+ }
1455
+ if (system === "aws_sqs" || system === "aws.sns") {
1456
+ const method = readText(getAttribute, RPC_METHOD_ATTRIBUTE);
1457
+ const operation = method
1458
+ ? method.substring(method.lastIndexOf("/") + 1)
1459
+ : null;
1460
+ const awsDirection = lookupDirection(AWS_RPC_METHOD_DIRECTIONS, operation);
1461
+ if (awsDirection) {
1462
+ return awsDirection;
1463
+ }
1464
+ }
1465
+ return "unknown";
1466
+ }
1467
+ // The words of a metric name that say which way its messages go.
1468
+ const METRIC_NAME_PUBLISH_WORDS = new Set([
1469
+ "sent",
1470
+ "send",
1471
+ "publish",
1472
+ "published",
1473
+ ]);
1474
+ const METRIC_NAME_CONSUME_WORDS = new Set([
1475
+ "consumed",
1476
+ "consume",
1477
+ "receive",
1478
+ "received",
1479
+ "receiver",
1480
+ "process",
1481
+ "processed",
1482
+ ]);
1483
+ const METRIC_NAME_SETTLE_WORDS = new Set([
1484
+ "settle",
1485
+ "settlement",
1486
+ ]);
1487
+ const METRIC_NAME_WORD_SEPARATOR = /[._/]/;
1488
+ /*
1489
+ * messaging.client.sent.messages → publish; messaging.process.duration and
1490
+ * messaging.servicebus.receiver.lag → consume;
1491
+ * messaging.servicebus.settlement.request.duration → settle.
1492
+ */
1493
+ function directionFromMetricName(metricName) {
1494
+ for (const word of metricName.split(METRIC_NAME_WORD_SEPARATOR)) {
1495
+ if (METRIC_NAME_PUBLISH_WORDS.has(word)) {
1496
+ return "publish";
1497
+ }
1498
+ if (METRIC_NAME_CONSUME_WORDS.has(word)) {
1499
+ return "consume";
1500
+ }
1501
+ if (METRIC_NAME_SETTLE_WORDS.has(word)) {
1502
+ return "settle";
1503
+ }
1504
+ }
1505
+ return "unknown";
1506
+ }
1507
+ function directionFromSignal(signal) {
1508
+ if (signal === "published") {
1509
+ return "publish";
1510
+ }
1511
+ if (signal === "consumed") {
1512
+ return "consume";
1513
+ }
1514
+ return "unknown";
1515
+ }
1516
+ // ---- consumer group ----------------------------------------------------------------
1517
+ /*
1518
+ * The consumer group or subscription: the attribute keys, then what the
1519
+ * Azure entity path named, then — for Pub/Sub — the destination itself, as
1520
+ * a consumer's destination IS its subscription.
1521
+ */
1522
+ function resolveConsumerGroup(data) {
1523
+ const fromAttribute = readFirstText(data.getAttribute, MESSAGING_CONSUMER_GROUP_ATTRIBUTES);
1524
+ if (fromAttribute !== null) {
1525
+ return clampDisplay(fromAttribute);
1526
+ }
1527
+ if (data.fromPath !== null) {
1528
+ return clampDisplay(data.fromPath);
1529
+ }
1530
+ if (data.system === "gcp_pubsub" &&
1531
+ (data.direction === "consume" || data.direction === "settle")) {
1532
+ return clampDisplay(data.destination);
1533
+ }
1534
+ return null;
1535
+ }
1536
+ // ---- resolution ----------------------------------------------------------------------
1537
+ /*
1538
+ * A normalized destination's last checks: not temporary, no control
1539
+ * character (see hasControlCharacter), UUIDs templated, not overlong. Null
1540
+ * when it is no queue.
1541
+ */
1542
+ function finishDestination(system, normalized) {
1543
+ if (!normalized ||
1544
+ hasControlCharacter(normalized.destination) ||
1545
+ isTemporaryMessagingDestination(system, normalized.destination)) {
1546
+ return null;
1547
+ }
1548
+ const destination = templateDestination(normalized.destination);
1549
+ return destination.length <= MESSAGE_QUEUE_DESTINATION_MAX_LENGTH
1550
+ ? destination
1551
+ : null;
1552
+ }
1553
+ /*
1554
+ * The 1.26+ operation keys that show a RabbitMQ span or datapoint is written
1555
+ * to the conventions that join its names, as each signal carries them. A
1556
+ * span, `messaging.operation.type`, which those conventions set on the span
1557
+ * of every messaging operation. A datapoint, the operation name too —
1558
+ * semconv puts the type on
1559
+ * messaging.client.operation.duration alone and the name on all four
1560
+ * messaging client metrics, and so does the Java agent
1561
+ * (MessagingMetricsAdvice), whose sent-messages, consumed-messages and
1562
+ * process-duration datapoints show their conventions by the name alone.
1563
+ * The agent is the one instrumentation found recording RabbitMQ client
1564
+ * metrics (rabbitmq-2.7 and spring-rabbit-1.0, from 2.31.0), and only in
1565
+ * its opt-in mode, which joins names — so its span and every metric of the
1566
+ * same operation key one queue.
1567
+ */
1568
+ const JOINED_RABBITMQ_NAMING_EVIDENCE = {
1569
+ span: [OPERATION_TYPE_ATTRIBUTE],
1570
+ datapoint: [OPERATION_TYPE_ATTRIBUTE, OPERATION_NAME_ATTRIBUTE],
1571
+ };
1572
+ /*
1573
+ * Whether a RabbitMQ span or datapoint is written to the conventions that
1574
+ * join exchange, routing key and queue with ":" (semconv 1.30): it carries
1575
+ * a 1.26+ operation key (JOINED_RABBITMQ_NAMING_EVIDENCE), and it is not
1576
+ * RabbitMQ.Client for .NET's, which writes those keys but names the
1577
+ * exchange alone (see MESSAGING_PROTOCOL_NAME_ATTRIBUTE). The older
1578
+ * conventions — the Java agent's default mode, amqplib, pika, MassTransit's
1579
+ * own spans — name one thing and carry neither key.
1580
+ */
1581
+ function hasJoinedRabbitMqNaming(getAttribute, signal) {
1582
+ if (readFirstText(getAttribute, JOINED_RABBITMQ_NAMING_EVIDENCE[signal]) ===
1583
+ null) {
1584
+ return false;
1585
+ }
1586
+ const protocol = readText(getAttribute, MESSAGING_PROTOCOL_NAME_ATTRIBUTE);
1587
+ return (protocol === null ||
1588
+ protocol.toLowerCase() !== RABBITMQ_DOTNET_CLIENT_PROTOCOL);
1589
+ }
1590
+ function resolveFromAttributes(getAttribute, resolution) {
1591
+ if (!hasTrigger(getAttribute)) {
1592
+ return null;
1593
+ }
1594
+ const system = resolveSystem(getAttribute) ||
1595
+ (resolution.systemHint !== null &&
1596
+ readText(getAttribute, MESSAGING_SYSTEM_ATTRIBUTE) === null
1597
+ ? resolution.systemHint
1598
+ : null);
1599
+ if (!system || hasTemporaryFlag(getAttribute)) {
1600
+ return null;
1601
+ }
1602
+ const selected = selectDestination(system, getAttribute);
1603
+ if (!selected) {
1604
+ return null;
1605
+ }
1606
+ const direction = resolution.directionHint !== "unknown"
1607
+ ? resolution.directionHint
1608
+ : resolveDirection(getAttribute, system, resolution.kind);
1609
+ const normalized = normalizeDestinationForSystem(system, selected.value, system === "rabbitmq" && selected.parseRabbitMqAddressing
1610
+ ? {
1611
+ routingKey: readFirstText(getAttribute, RABBITMQ_ROUTING_KEY_ATTRIBUTES),
1612
+ consumerSide: direction === "consume" || direction === "settle",
1613
+ routingKeyReported: resolution.source === "span",
1614
+ hasJoinedNaming: () => {
1615
+ return hasJoinedRabbitMqNaming(getAttribute, resolution.source);
1616
+ },
1617
+ }
1618
+ : null);
1619
+ const destination = finishDestination(system, normalized);
1620
+ if (destination === null || !normalized) {
1621
+ return null;
1622
+ }
1623
+ return {
1624
+ system,
1625
+ destination,
1626
+ brokerScope: resolveBrokerScope(system, getAttribute),
1627
+ brokerAddress: resolveBrokerAddress(getAttribute, MESSAGING_ADDRESS_ATTRIBUTES),
1628
+ direction,
1629
+ consumerGroup: resolveConsumerGroup({
1630
+ getAttribute,
1631
+ system,
1632
+ direction,
1633
+ destination,
1634
+ fromPath: normalized.consumerGroup,
1635
+ }),
1636
+ isDeadLetter: normalized.isDeadLetter,
1637
+ };
1638
+ }
1639
+ /**
1640
+ * The destination a messaging span publishes to, consumes from or settles
1641
+ * on, or null. SERVER spans never resolve (a messaging operation is never
1642
+ * served), and neither does a span with no messaging trigger — checked
1643
+ * first, without allocating, so this is cheap on every span. `kind` is the
1644
+ * span's kind as stored: the SpanKind string ("SPAN_KIND_PRODUCER"), or
1645
+ * whatever a Span Kind Remapper wrote — a bare name, or OTLP's number as a
1646
+ * number or as its digits, read alike (see normalizeSpanKind). SERVER is
1647
+ * refused in every spelling; any other kind only decides the direction.
1648
+ */
1649
+ export function resolveMessagingSpan(input) {
1650
+ if (!input || typeof input.getAttribute !== "function") {
1651
+ return null;
1652
+ }
1653
+ const kind = normalizeSpanKind(input.kind);
1654
+ if (kind === "SERVER") {
1655
+ return null;
1656
+ }
1657
+ return resolveFromAttributes(input.getAttribute, {
1658
+ kind,
1659
+ directionHint: "unknown",
1660
+ source: "span",
1661
+ systemHint: null,
1662
+ });
1663
+ }
1664
+ // Whether every required attribute is present with an accepted value.
1665
+ function matchesRequiredAttributes(descriptor, getAttribute) {
1666
+ const required = descriptor.requiredAttributes;
1667
+ if (!required) {
1668
+ return true;
1669
+ }
1670
+ for (const key of Object.keys(required)) {
1671
+ const accepted = required[key];
1672
+ const value = readText(getAttribute, key);
1673
+ if (!accepted || value === null) {
1674
+ return false;
1675
+ }
1676
+ const lower = value.toLowerCase();
1677
+ if (!accepted.some((candidate) => {
1678
+ return candidate.toLowerCase() === lower;
1679
+ })) {
1680
+ return false;
1681
+ }
1682
+ }
1683
+ return true;
1684
+ }
1685
+ function resolveCatalogDatapoint(descriptor, getAttribute) {
1686
+ if (!matchesRequiredAttributes(descriptor, getAttribute)) {
1687
+ return null;
1688
+ }
1689
+ // A finer-grained repeat of the metric counts toward no queue.
1690
+ if (descriptor.excludeSeriesWithAttributes &&
1691
+ readFirstText(getAttribute, descriptor.excludeSeriesWithAttributes) !== null) {
1692
+ return null;
1693
+ }
1694
+ const raw = readFirstText(getAttribute, descriptor.destinationAttributes);
1695
+ if (raw === null) {
1696
+ return null;
1697
+ }
1698
+ // A broker names its queues exactly: no RabbitMQ exchange:key parsing.
1699
+ const normalized = normalizeDestinationForSystem(descriptor.system, raw, null);
1700
+ const destination = finishDestination(descriptor.system, normalized);
1701
+ if (destination === null || !normalized) {
1702
+ return null;
1703
+ }
1704
+ const brokerScope = (descriptor.scopeAttributes
1705
+ ? canonicalizeMessageQueueBrokerScope(descriptor.system, readFirstText(getAttribute, descriptor.scopeAttributes))
1706
+ : "") || "";
1707
+ return {
1708
+ system: descriptor.system,
1709
+ destination,
1710
+ brokerScope,
1711
+ brokerAddress: resolveBrokerAddress(getAttribute, MESSAGE_QUEUE_METRIC_ADDRESS_ATTRIBUTES),
1712
+ direction: directionFromSignal(descriptor.signal),
1713
+ consumerGroup: clampDisplay(normalized.consumerGroup),
1714
+ isDeadLetter: normalized.isDeadLetter,
1715
+ };
1716
+ }
1717
+ /**
1718
+ * The destination a metric datapoint describes, or null. `getAttribute`
1719
+ * reads the STORED flattened map: datapoint keys bare, resource keys
1720
+ * `resource.`-prefixed.
1721
+ *
1722
+ * - A curated broker metric (MESSAGE_QUEUE_METRICS; the name is trimmed and
1723
+ * lowercased first) tries each of its entries: required attributes match,
1724
+ * then the destination (normalized, filtered and templated like a span's)
1725
+ * and the Azure namespace from the entry's keys. The direction follows
1726
+ * the entry's signal. A curated name that none of its entries resolves is
1727
+ * null — it never falls through to the attribute path below.
1728
+ * A datapoint carrying one of the entry's excludeSeriesWithAttributes is
1729
+ * a repeat of a coarser series (Pulsar's per-consumer copy) and is null.
1730
+ * - Anything else resolves like a span without a kind — the messaging
1731
+ * CLIENT metrics, and any application gauge that carries
1732
+ * `messaging.system` and a destination (OneUptime's own BullMQ
1733
+ * `queue.size`) — with the direction the metric name states ("sent",
1734
+ * "consumed", "process", "settlement", …), else the one its attributes
1735
+ * state. A messaging SDK metric that names no system (the Azure SDK for
1736
+ * Java's `messaging.servicebus.*`) gets the one its name implies
1737
+ * (MESSAGING_SDK_METRIC_SYSTEMS). A datapoint never carries RabbitMQ's
1738
+ * routing key, which decides how its joined names split (rabbitMqQueue);
1739
+ * its operation keys show whether they are joined at all
1740
+ * (JOINED_RABBITMQ_NAMING_EVIDENCE).
1741
+ */
1742
+ export function resolveMessagingMetricDatapoint(input) {
1743
+ if (!input || typeof input.getAttribute !== "function") {
1744
+ return null;
1745
+ }
1746
+ const metricName = typeof input.metricName === "string"
1747
+ ? input.metricName.trim().toLowerCase()
1748
+ : "";
1749
+ const descriptors = metricName
1750
+ ? getMessageQueueMetricDescriptorsByName(metricName)
1751
+ : [];
1752
+ if (descriptors.length > 0) {
1753
+ for (const descriptor of descriptors) {
1754
+ const resolved = resolveCatalogDatapoint(descriptor, input.getAttribute);
1755
+ if (resolved) {
1756
+ return resolved;
1757
+ }
1758
+ }
1759
+ return null;
1760
+ }
1761
+ return resolveFromAttributes(input.getAttribute, {
1762
+ kind: null,
1763
+ directionHint: directionFromMetricName(metricName),
1764
+ source: "datapoint",
1765
+ systemHint: MESSAGING_SDK_METRIC_SYSTEMS.get(metricName) || null,
1766
+ });
1767
+ }
1768
+ //# sourceMappingURL=MessagingTelemetryResolver.js.map