@oneuptime/common 14.0.106 → 14.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/AuditLog.js +1 -1
- package/Models/AnalyticsModels/Index.js +3 -0
- package/Models/AnalyticsModels/RumProductAnalyticsEvent.d.mts +5 -0
- package/Models/AnalyticsModels/RumProductAnalyticsEvent.d.ts +5 -0
- package/Models/AnalyticsModels/RumProductAnalyticsEvent.js +300 -0
- package/Models/AnalyticsModels/RumProductAnalyticsEvent.mjs +3 -0
- package/Models/DatabaseModels/CallLog.d.mts +4 -0
- package/Models/DatabaseModels/CallLog.d.ts +4 -0
- package/Models/DatabaseModels/CallLog.js +85 -0
- package/Models/DatabaseModels/DataBiConnection.d.mts +3 -0
- package/Models/DatabaseModels/DataBiConnection.d.ts +3 -0
- package/Models/DatabaseModels/DataBiConnection.js +47 -1
- package/Models/DatabaseModels/DataDashboard.d.mts +10 -0
- package/Models/DatabaseModels/DataDashboard.d.ts +10 -0
- package/Models/DatabaseModels/DataDashboard.js +129 -2
- package/Models/DatabaseModels/Index.js +6 -0
- package/Models/DatabaseModels/NetworkDevice.d.mts +1 -0
- package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
- package/Models/DatabaseModels/NetworkDevice.js +55 -0
- package/Models/DatabaseModels/NetworkDeviceNamingRule.d.mts +26 -0
- package/Models/DatabaseModels/NetworkDeviceNamingRule.d.ts +26 -0
- package/Models/DatabaseModels/NetworkDeviceNamingRule.js +536 -0
- package/Models/DatabaseModels/NetworkDeviceNamingRule.mjs +2 -0
- package/Models/DatabaseModels/NetworkSite.d.mts +1 -0
- package/Models/DatabaseModels/NetworkSite.d.ts +1 -0
- package/Models/DatabaseModels/NetworkSite.js +51 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.d.mts +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.d.ts +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +41 -0
- package/Models/DatabaseModels/ProjectCallSMSConfig.d.mts +2 -0
- package/Models/DatabaseModels/ProjectCallSMSConfig.d.ts +2 -0
- package/Models/DatabaseModels/ProjectCallSMSConfig.js +80 -1
- package/Models/DatabaseModels/RumApplication.d.mts +2 -0
- package/Models/DatabaseModels/RumApplication.d.ts +2 -0
- package/Models/DatabaseModels/RumApplication.js +108 -0
- package/Models/DatabaseModels/Team.js +10 -2
- package/Models/DatabaseModels/TeamComplianceSetting.js +8 -1
- package/Models/DatabaseModels/TeamCustomRole.js +9 -1
- package/Models/DatabaseModels/TeamMember.js +15 -1
- package/Models/DatabaseModels/TeamOwnerTeam.d.mts +17 -0
- package/Models/DatabaseModels/TeamOwnerTeam.d.ts +17 -0
- package/Models/DatabaseModels/TeamOwnerTeam.js +325 -0
- package/Models/DatabaseModels/TeamOwnerTeam.mjs +2 -0
- package/Models/DatabaseModels/TeamOwnerUser.d.mts +17 -0
- package/Models/DatabaseModels/TeamOwnerUser.d.ts +17 -0
- package/Models/DatabaseModels/TeamOwnerUser.js +331 -0
- package/Models/DatabaseModels/TeamOwnerUser.mjs +2 -0
- package/Models/DatabaseModels/TeamPermission.js +12 -1
- package/Models/DatabaseModels/TelemetryUsageBilling.d.mts +1 -0
- package/Models/DatabaseModels/TelemetryUsageBilling.d.ts +1 -0
- package/Models/DatabaseModels/TelemetryUsageBilling.js +34 -0
- package/Types/AI/AIActionWords.d.mts +1 -0
- package/Types/AI/AIActionWords.d.ts +1 -0
- package/Types/AI/AIActionWords.js +15 -4
- package/Types/AI/AIChatRecordSeen.d.mts +3 -0
- package/Types/AI/AIChatRecordSeen.d.ts +3 -0
- package/Types/AI/AIChatRecordSeen.js +28 -3
- package/Types/AI/AIChatRecordSeen.mjs +1 -0
- package/Types/AnalyticsDatabase/AnalyticsTableName.d.mts +2 -1
- package/Types/AnalyticsDatabase/AnalyticsTableName.d.ts +2 -1
- package/Types/AnalyticsDatabase/AnalyticsTableName.js +7 -0
- package/Types/AuditLog/AuditLogRetention.d.mts +10 -0
- package/Types/AuditLog/AuditLogRetention.d.ts +10 -0
- package/Types/AuditLog/AuditLogRetention.js +91 -0
- package/Types/AuditLog/AuditLogRetention.mjs +8 -0
- package/Types/CallAndSMS/TwilioConfigDefaults.d.mts +37 -0
- package/Types/CallAndSMS/TwilioConfigDefaults.d.ts +37 -0
- package/Types/CallAndSMS/TwilioConfigDefaults.js +224 -0
- package/Types/CallAndSMS/TwilioConfigDefaults.mjs +3 -0
- package/Types/CodeRepository/CodeFileSeen.d.mts +3 -0
- package/Types/CodeRepository/CodeFileSeen.d.ts +3 -0
- package/Types/CodeRepository/CodeFileSeen.js +61 -3
- package/Types/DataObservability/DataDashboardActivity.d.mts +40 -0
- package/Types/DataObservability/DataDashboardActivity.d.ts +40 -0
- package/Types/DataObservability/DataDashboardActivity.js +119 -0
- package/Types/DataObservability/DataDashboardActivity.mjs +12 -0
- package/Types/DataObservability/DataObservabilityApiTypes.d.mts +7 -0
- package/Types/DataObservability/DataObservabilityApiTypes.d.ts +7 -0
- package/Types/DataObservability/DataObservabilityApiTypes.js +2 -0
- package/Types/DataObservability/DataTableLineage.d.mts +87 -0
- package/Types/DataObservability/DataTableLineage.d.ts +87 -0
- package/Types/DataObservability/DataTableLineage.js +111 -0
- package/Types/DataObservability/DataTableLineage.mjs +19 -0
- package/Types/DataSecurity/DataStoreKind.d.mts +1 -0
- package/Types/DataSecurity/DataStoreKind.d.ts +1 -0
- package/Types/DataSecurity/DataStoreKind.js +3 -0
- package/Types/Database/AccessControl/PermissionScopeNarrowing.js +6 -0
- package/Types/DatabaseServer/DatabaseServerMetricCatalog.js +71 -82
- package/Types/Date.d.mts +4 -0
- package/Types/Date.d.ts +4 -0
- package/Types/Date.js +47 -2
- package/Types/Date.mjs +2 -0
- package/Types/DateLanguage.d.mts +9 -0
- package/Types/DateLanguage.d.ts +9 -0
- package/Types/DateLanguage.js +79 -1
- package/Types/DateLanguage.mjs +4 -0
- package/Types/MessageQueue/MessageQueueMetricCatalog.js +61 -61
- package/Types/Monitor/CriteriaFilterTerms.d.mts +4 -0
- package/Types/Monitor/CriteriaFilterTerms.d.ts +4 -0
- package/Types/Monitor/CriteriaFilterTerms.js +166 -0
- package/Types/Monitor/CriteriaFilterTerms.mjs +4 -0
- package/Types/Monitor/EvaluationSentence.d.mts +37 -0
- package/Types/Monitor/EvaluationSentence.d.ts +37 -0
- package/Types/Monitor/EvaluationSentence.js +298 -0
- package/Types/Monitor/EvaluationSentence.mjs +12 -0
- package/Types/Monitor/MonitorCriteria.d.mts +2 -0
- package/Types/Monitor/MonitorCriteria.d.ts +2 -0
- package/Types/Monitor/MonitorCriteria.js +8 -0
- package/Types/Monitor/MonitorCriteriaInstance.d.mts +5 -0
- package/Types/Monitor/MonitorCriteriaInstance.d.ts +5 -0
- package/Types/Monitor/MonitorCriteriaInstance.js +243 -194
- package/Types/Monitor/MonitorEvaluationDetails.d.mts +2 -0
- package/Types/Monitor/MonitorEvaluationDetails.d.ts +2 -0
- package/Types/Monitor/MonitorEvaluationSummary.d.mts +4 -0
- package/Types/Monitor/MonitorEvaluationSummary.d.ts +4 -0
- package/Types/Monitor/MonitorStep.d.mts +2 -0
- package/Types/Monitor/MonitorStep.d.ts +2 -0
- package/Types/Monitor/MonitorSteps.d.mts +2 -0
- package/Types/Monitor/MonitorSteps.d.ts +2 -0
- package/Types/Monitor/MonitorType.d.mts +1 -0
- package/Types/Monitor/MonitorType.d.ts +1 -0
- package/Types/Monitor/MonitorType.js +12 -0
- package/Types/Monitor/TelemetryObservation.d.mts +15 -0
- package/Types/Monitor/TelemetryObservation.d.ts +15 -0
- package/Types/Monitor/TelemetryObservation.js +28 -0
- package/Types/Monitor/TelemetryObservation.mjs +2 -0
- package/Types/NetworkDevice/DeviceNaming.d.mts +87 -0
- package/Types/NetworkDevice/DeviceNaming.d.ts +87 -0
- package/Types/NetworkDevice/DeviceNaming.js +279 -0
- package/Types/NetworkDevice/DeviceNaming.mjs +24 -0
- package/Types/NetworkDevice/DiscoveredDevice.d.mts +1 -0
- package/Types/NetworkDevice/DiscoveredDevice.d.ts +1 -0
- package/Types/NetworkDevice/DiscoveredDevice.js +4 -0
- package/Types/OnCallDutyPolicy/OnCallPageChannel.d.mts +68 -0
- package/Types/OnCallDutyPolicy/OnCallPageChannel.d.ts +68 -0
- package/Types/OnCallDutyPolicy/OnCallPageChannel.js +351 -0
- package/Types/OnCallDutyPolicy/OnCallPageChannel.mjs +15 -0
- package/Types/Permission.d.mts +5 -0
- package/Types/Permission.d.ts +5 -0
- package/Types/Permission.js +61 -5
- package/Types/Rules/RuleCriteriaFieldRegistry.js +12 -0
- package/Types/Rules/RuleCriteriaSubject.js +1 -0
- package/Types/Rum/ProductAnalyticsEventReads.d.mts +115 -0
- package/Types/Rum/ProductAnalyticsEventReads.d.ts +115 -0
- package/Types/Rum/ProductAnalyticsEventReads.js +166 -0
- package/Types/Rum/ProductAnalyticsEventReads.mjs +27 -0
- package/Types/Rum/ProductAnalyticsEvents.d.mts +121 -0
- package/Types/Rum/ProductAnalyticsEvents.d.ts +121 -0
- package/Types/Rum/ProductAnalyticsEvents.js +477 -0
- package/Types/Rum/ProductAnalyticsEvents.mjs +40 -0
- package/Types/Rum/SessionReplay.d.mts +4 -0
- package/Types/Rum/SessionReplay.d.ts +4 -0
- package/Types/Rum/SessionReplayHealth.js +1 -1
- package/Types/ServiceLevelObjective/SloErrorBudgetPolicyChange.d.mts +10 -0
- package/Types/ServiceLevelObjective/SloErrorBudgetPolicyChange.d.ts +10 -0
- package/Types/ServiceLevelObjective/SloErrorBudgetPolicyChange.js +51 -0
- package/Types/ServiceLevelObjective/SloErrorBudgetPolicyChange.mjs +4 -0
- package/Types/Team/BuiltInTeam.d.mts +1 -0
- package/Types/Team/BuiltInTeam.d.ts +1 -0
- package/Types/Team/BuiltInTeam.js +14 -1
- package/Types/Team/BuiltInTeam.mjs +1 -0
- package/Types/Telemetry/TelemetryUsage.d.mts +7 -2
- package/Types/Telemetry/TelemetryUsage.d.ts +7 -2
- package/Types/Telemetry/TelemetryUsage.js +24 -5
- package/Types/Telemetry/TelemetryUsage.mjs +3 -0
- package/Types/UserNotification/UserNotificationStatus.d.mts +2 -1
- package/Types/UserNotification/UserNotificationStatus.d.ts +2 -1
- package/Types/UserNotification/UserNotificationStatus.js +8 -0
- package/Types/Workspace/NotificationRules/EventType.d.mts +2 -1
- package/Types/Workspace/NotificationRules/EventType.d.ts +2 -1
- package/Types/Workspace/NotificationRules/EventType.js +8 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +7 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +7 -1
- package/Types/Workspace/NotificationRules/NotificationRuleInvites.js +5 -1
- package/Types/Workspace/NotificationRules/NotificationRuleTypes/ServiceLevelObjectiveNotificationRule.d.mts +4 -0
- package/Types/Workspace/NotificationRules/NotificationRuleTypes/ServiceLevelObjectiveNotificationRule.d.ts +4 -0
- package/Types/Workspace/NotificationRules/NotificationRuleTypes/ServiceLevelObjectiveNotificationRule.js +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleTypes/ServiceLevelObjectiveNotificationRule.mjs +1 -0
- package/Utils/AI/InvestigationReport.js +93 -21
- package/Utils/AI/InvestigationReportLanguages.d.mts +25 -0
- package/Utils/AI/InvestigationReportLanguages.d.ts +25 -0
- package/Utils/AI/InvestigationReportLanguages.js +603 -0
- package/Utils/AI/InvestigationReportLanguages.mjs +11 -0
- package/Utils/Dashboard/TableThresholds.js +5 -2
- package/Utils/Monitor/MonitorLogSummaryUtil.d.mts +8 -0
- package/Utils/Monitor/MonitorLogSummaryUtil.d.ts +8 -0
- package/Utils/Monitor/MonitorLogSummaryUtil.js +170 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.mts +17 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +17 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +242 -0
- package/Utils/Monitor/MonitorRootCauseWording.mjs +2 -0
- package/Utils/Monitor/MonitorSummarySnapshotUtil.d.mts +3 -0
- package/Utils/Monitor/MonitorSummarySnapshotUtil.d.ts +3 -0
- package/Utils/Monitor/MonitorSummarySnapshotUtil.js +5 -2
- package/Utils/NetworkDevice/Naming/DeviceNamingPlanner.d.mts +75 -0
- package/Utils/NetworkDevice/Naming/DeviceNamingPlanner.d.ts +75 -0
- package/Utils/NetworkDevice/Naming/DeviceNamingPlanner.js +303 -0
- package/Utils/NetworkDevice/Naming/DeviceNamingPlanner.mjs +8 -0
- package/Utils/NetworkDevice/Naming/NamePattern.d.mts +122 -0
- package/Utils/NetworkDevice/Naming/NamePattern.d.ts +122 -0
- package/Utils/NetworkDevice/Naming/NamePattern.js +649 -0
- package/Utils/NetworkDevice/Naming/NamePattern.mjs +22 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.d.mts +77 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.d.ts +77 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.js +467 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.mjs +14 -0
- package/Utils/NetworkDevice/Naming/NamingRuleMatcher.d.mts +26 -0
- package/Utils/NetworkDevice/Naming/NamingRuleMatcher.d.ts +26 -0
- package/Utils/NetworkDevice/Naming/NamingRuleMatcher.js +327 -0
- package/Utils/NetworkDevice/Naming/NamingRuleMatcher.mjs +7 -0
- package/Utils/NetworkDiscovery/DiscoveredNameUpgrade.d.mts +1 -0
- package/Utils/NetworkDiscovery/DiscoveredNameUpgrade.d.ts +1 -0
- package/Utils/NetworkDiscovery/DiscoveredNameUpgrade.js +8 -0
- package/Utils/NetworkDiscovery/PingMonitorBuilder.d.mts +2 -0
- package/Utils/NetworkDiscovery/PingMonitorBuilder.d.ts +2 -0
- package/Utils/NetworkDiscovery/PingMonitorBuilder.js +1 -0
- package/Utils/{Rum → SessionReplay}/SessionReplayHealth.d.mts +7 -6
- package/Utils/{Rum → SessionReplay}/SessionReplayHealth.d.ts +7 -6
- package/Utils/SessionReplay/SessionReplayHealth.js +703 -0
- package/Utils/Slo/SloErrorBudgetPolicy.d.mts +7 -0
- package/Utils/Slo/SloErrorBudgetPolicy.d.ts +7 -0
- package/Utils/Slo/SloErrorBudgetPolicy.js +39 -0
- package/Utils/Slo/SloErrorBudgetPolicy.mjs +1 -0
- package/Utils/Slo/SloFeedMarkdown.d.mts +19 -4
- package/Utils/Slo/SloFeedMarkdown.d.ts +19 -4
- package/Utils/Slo/SloFeedMarkdown.js +64 -17
- package/Utils/Slo/SloFeedMarkdown.mjs +4 -0
- package/Utils/StatusPage/ResourceExplorer.js +9 -8
- package/Utils/TotpSetupKey.d.mts +3 -0
- package/Utils/TotpSetupKey.d.ts +3 -0
- package/Utils/TotpSetupKey.js +72 -0
- package/Utils/TotpSetupKey.mjs +4 -0
- package/Utils/Workspace/WorkspaceChannelName.js +5 -1
- package/package.json +1 -1
- package/Utils/Rum/SessionReplayHealth.js +0 -558
- /package/Utils/{Rum → SessionReplay}/SessionReplayHealth.mjs +0 -0
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Product analytics, part two (issue #6444): the application's own events
|
|
4
|
+
* and metrics, sent by the RUM recorders from EVERY session - recorded or
|
|
5
|
+
* not - and read back as event trends, funnels and retention.
|
|
6
|
+
*
|
|
7
|
+
* Part one (ProductAnalytics.ts) counts the sessions Session Replay
|
|
8
|
+
* records. This part adds a second, light channel beside the recordings: a
|
|
9
|
+
* small JSON batch of events (a session started, a page was viewed, the page
|
|
10
|
+
* called track()) and metric points (metric()) that the recorders post to
|
|
11
|
+
* PRODUCT_ANALYTICS_EVENTS_PATH whatever the replay sample decided. The
|
|
12
|
+
* events land in RumProductAnalyticsEventV1, kept for
|
|
13
|
+
* PRODUCT_ANALYTICS_RETENTION_MONTHS like part one's tables; the metric
|
|
14
|
+
* points land in the metric store under the RUM application, where charts,
|
|
15
|
+
* dashboards and Metrics monitors already read.
|
|
16
|
+
*
|
|
17
|
+
* Isomorphic and dependency-free, like everything else in this directory:
|
|
18
|
+
* the browser recorder inlines it into the script served on customers'
|
|
19
|
+
* pages (the React Native recorder sends no events yet; when it does, it
|
|
20
|
+
* mirrors this file as it mirrors the replay contract), and the ingest
|
|
21
|
+
* worker runs the SAME parser over the bytes the recorder sent, so "the
|
|
22
|
+
* server keeps exactly what the client sent" holds by construction.
|
|
23
|
+
* Nothing here may touch Node, the DOM, or a module outside
|
|
24
|
+
* Common/Types/Rum and Common/Utils/Rum. The reads (routes, limits,
|
|
25
|
+
* answers) live in ProductAnalyticsEventReads.ts, so the script on
|
|
26
|
+
* customers' pages carries none of them.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.PRODUCT_ANALYTICS_EVENT_KINDS = exports.ProductAnalyticsEventKind = exports.PRODUCT_ANALYTICS_DERIVED_METRIC_INTERVAL_MS = exports.PRODUCT_ANALYTICS_DEVICE_TYPE_ATTRIBUTE = exports.PRODUCT_ANALYTICS_EVENT_NAME_ATTRIBUTE = exports.PRODUCT_ANALYTICS_DERIVED_METRICS = exports.ProductAnalyticsDerivedMetric = exports.PRODUCT_ANALYTICS_DERIVED_METRIC_PREFIX = exports.PRODUCT_ANALYTICS_RESERVED_METRIC_PREFIX = exports.PRODUCT_ANALYTICS_MAX_METRIC_NAME_LENGTH = exports.PRODUCT_ANALYTICS_MAX_ITEMS_PER_PROJECT_PER_MINUTE = exports.PRODUCT_ANALYTICS_MAX_EVENT_AGE_MS = exports.PRODUCT_ANALYTICS_MAX_CONTEXT_VALUE_LENGTH = exports.PRODUCT_ANALYTICS_MAX_PAGE_LENGTH = exports.PRODUCT_ANALYTICS_USER_PROPERTY_LIMITS = exports.PRODUCT_ANALYTICS_PROPERTY_LIMITS = exports.PRODUCT_ANALYTICS_MAX_EVENT_NAME_LENGTH = exports.PRODUCT_ANALYTICS_MAX_PENDING_EVENTS = exports.PRODUCT_ANALYTICS_FLUSH_INTERVAL_MS = exports.PRODUCT_ANALYTICS_TARGET_BATCH_BYTES = exports.PRODUCT_ANALYTICS_MAX_BATCH_BYTES = exports.PRODUCT_ANALYTICS_MAX_METRICS_PER_BATCH = exports.PRODUCT_ANALYTICS_MAX_EVENTS_PER_BATCH = exports.PRODUCT_ANALYTICS_CONTENT_TYPE = exports.PRODUCT_ANALYTICS_WIRE_VERSION = exports.PRODUCT_ANALYTICS_EVENTS_PATH = exports.PRODUCT_ANALYTICS_EVENTS_ROUTE = void 0;
|
|
30
|
+
exports.isProductAnalyticsDerivedMetricName = isProductAnalyticsDerivedMetricName;
|
|
31
|
+
exports.getProductAnalyticsDerivedMetricDescription = getProductAnalyticsDerivedMetricDescription;
|
|
32
|
+
exports.isProductAnalyticsMetricName = isProductAnalyticsMetricName;
|
|
33
|
+
exports.isProductAnalyticsEventKind = isProductAnalyticsEventKind;
|
|
34
|
+
exports.isProductAnalyticsId = isProductAnalyticsId;
|
|
35
|
+
exports.toProductAnalyticsEventName = toProductAnalyticsEventName;
|
|
36
|
+
exports.toProductAnalyticsPage = toProductAnalyticsPage;
|
|
37
|
+
exports.toProductAnalyticsContext = toProductAnalyticsContext;
|
|
38
|
+
exports.normalizeProductAnalyticsUserPropertyKeys = normalizeProductAnalyticsUserPropertyKeys;
|
|
39
|
+
exports.pickProductAnalyticsUserProperties = pickProductAnalyticsUserProperties;
|
|
40
|
+
exports.parseProductAnalyticsBatch = parseProductAnalyticsBatch;
|
|
41
|
+
exports.readProductAnalyticsRecorderConfig = readProductAnalyticsRecorderConfig;
|
|
42
|
+
const SessionReplayStringMap_1 = require("../../Utils/Rum/SessionReplayStringMap");
|
|
43
|
+
const SessionReplay_1 = require("./SessionReplay");
|
|
44
|
+
/* ---- Where the recorders post. ---- */
|
|
45
|
+
/*
|
|
46
|
+
* The ingest route as the Telemetry router declares it (mounted under every
|
|
47
|
+
* telemetry prefix, like the chunk route), and the path the recorders call,
|
|
48
|
+
* which carries the /telemetry prefix a deployment's reverse proxy routes on.
|
|
49
|
+
*/
|
|
50
|
+
exports.PRODUCT_ANALYTICS_EVENTS_ROUTE = "/session-replay/v1/events";
|
|
51
|
+
exports.PRODUCT_ANALYTICS_EVENTS_PATH = `/telemetry${exports.PRODUCT_ANALYTICS_EVENTS_ROUTE}`;
|
|
52
|
+
/* The batch's wire version. Additive changes keep it; anything else bumps it. */
|
|
53
|
+
exports.PRODUCT_ANALYTICS_WIRE_VERSION = 1;
|
|
54
|
+
exports.PRODUCT_ANALYTICS_CONTENT_TYPE = "application/json";
|
|
55
|
+
/* ---- What one batch may hold. Enforced on both sides of the wire. ---- */
|
|
56
|
+
/*
|
|
57
|
+
* A batch is one tab's events of one session, sent every few seconds and
|
|
58
|
+
* when the tab is hidden. Small on purpose: the tab's last batch goes out
|
|
59
|
+
* as a keepalive request, and a page's keepalive requests share 64 KB.
|
|
60
|
+
*/
|
|
61
|
+
exports.PRODUCT_ANALYTICS_MAX_EVENTS_PER_BATCH = 100;
|
|
62
|
+
exports.PRODUCT_ANALYTICS_MAX_METRICS_PER_BATCH = 100;
|
|
63
|
+
exports.PRODUCT_ANALYTICS_MAX_BATCH_BYTES = 64 * 1024;
|
|
64
|
+
/*
|
|
65
|
+
* How many bytes a recorder lets a batch grow to before it sends it, well
|
|
66
|
+
* under the server's cap so the one keepalive request of a closing tab is
|
|
67
|
+
* never refused for its size.
|
|
68
|
+
*/
|
|
69
|
+
exports.PRODUCT_ANALYTICS_TARGET_BATCH_BYTES = 24 * 1024;
|
|
70
|
+
/* How often a recorder sends what it has, in milliseconds. */
|
|
71
|
+
exports.PRODUCT_ANALYTICS_FLUSH_INTERVAL_MS = 5000;
|
|
72
|
+
/*
|
|
73
|
+
* Events a recorder holds while it cannot send them yet (consent not given,
|
|
74
|
+
* the network down): past this, the oldest are dropped.
|
|
75
|
+
*/
|
|
76
|
+
exports.PRODUCT_ANALYTICS_MAX_PENDING_EVENTS = 500;
|
|
77
|
+
/* An event's name, and its properties: the caps track() already has. */
|
|
78
|
+
exports.PRODUCT_ANALYTICS_MAX_EVENT_NAME_LENGTH = SessionReplay_1.SESSION_REPLAY_MAX_CUSTOM_EVENT_NAME_LENGTH;
|
|
79
|
+
exports.PRODUCT_ANALYTICS_PROPERTY_LIMITS = {
|
|
80
|
+
maxKeys: SessionReplay_1.SESSION_REPLAY_MAX_CUSTOM_EVENT_PROPERTY_KEYS,
|
|
81
|
+
maxKeyLength: SessionReplay_1.SESSION_REPLAY_MAX_TRAIT_KEY_LENGTH,
|
|
82
|
+
maxValueLength: SessionReplay_1.SESSION_REPLAY_MAX_TRAIT_VALUE_LENGTH,
|
|
83
|
+
};
|
|
84
|
+
/*
|
|
85
|
+
* The user properties an event carries: the identify() traits the
|
|
86
|
+
* application chose to keep for analytics, under the trait caps.
|
|
87
|
+
*/
|
|
88
|
+
exports.PRODUCT_ANALYTICS_USER_PROPERTY_LIMITS = {
|
|
89
|
+
maxKeys: SessionReplay_1.SESSION_REPLAY_MAX_TRAIT_KEYS,
|
|
90
|
+
maxKeyLength: SessionReplay_1.SESSION_REPLAY_MAX_TRAIT_KEY_LENGTH,
|
|
91
|
+
maxValueLength: SessionReplay_1.SESSION_REPLAY_MAX_TRAIT_VALUE_LENGTH,
|
|
92
|
+
};
|
|
93
|
+
/* A page's path, without its query or fragment. */
|
|
94
|
+
exports.PRODUCT_ANALYTICS_MAX_PAGE_LENGTH = 512;
|
|
95
|
+
/* The device, browser, system and version a batch says it came from. */
|
|
96
|
+
exports.PRODUCT_ANALYTICS_MAX_CONTEXT_VALUE_LENGTH = 64;
|
|
97
|
+
/*
|
|
98
|
+
* Events this old when they arrive are dropped: a recorder that queued them
|
|
99
|
+
* for longer (a phone offline for days) sends history nobody asked about,
|
|
100
|
+
* and a range already read would change under its reader.
|
|
101
|
+
*/
|
|
102
|
+
exports.PRODUCT_ANALYTICS_MAX_EVENT_AGE_MS = 3 * 24 * 60 * 60 * 1000;
|
|
103
|
+
/*
|
|
104
|
+
* Events and metric points a project may send in one minute, all its
|
|
105
|
+
* applications together. Over it, the batch is refused with a 429 and the
|
|
106
|
+
* recorder waits for the next minute.
|
|
107
|
+
*/
|
|
108
|
+
exports.PRODUCT_ANALYTICS_MAX_ITEMS_PER_PROJECT_PER_MINUTE = 60000;
|
|
109
|
+
/* ---- Metric names. ---- */
|
|
110
|
+
/*
|
|
111
|
+
* A metric's name: a letter, then letters, digits, "_", ".", "-" or "/",
|
|
112
|
+
* at most PRODUCT_ANALYTICS_MAX_METRIC_NAME_LENGTH long - the OpenTelemetry
|
|
113
|
+
* instrument name rules, so the same name reads the same in every chart.
|
|
114
|
+
*/
|
|
115
|
+
exports.PRODUCT_ANALYTICS_MAX_METRIC_NAME_LENGTH = 100;
|
|
116
|
+
const METRIC_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_./-]{0,99}$/;
|
|
117
|
+
/*
|
|
118
|
+
* Names in OneUptime's own namespace. A recorder's metric() refuses them all,
|
|
119
|
+
* so nothing a page sends can pass for a series OneUptime writes.
|
|
120
|
+
*/
|
|
121
|
+
exports.PRODUCT_ANALYTICS_RESERVED_METRIC_PREFIX = "oneuptime.";
|
|
122
|
+
/*
|
|
123
|
+
* The series the event pipeline writes itself, counted per minute, so an
|
|
124
|
+
* application's events can be charted, put on a dashboard and alerted on
|
|
125
|
+
* through the metric store. Their prefix is refused at OTLP ingest too
|
|
126
|
+
* (isProductAnalyticsDerivedMetricName) and left out of telemetry billing.
|
|
127
|
+
*/
|
|
128
|
+
exports.PRODUCT_ANALYTICS_DERIVED_METRIC_PREFIX = "oneuptime.rum.product.";
|
|
129
|
+
var ProductAnalyticsDerivedMetric;
|
|
130
|
+
(function (ProductAnalyticsDerivedMetric) {
|
|
131
|
+
/* track() events, by event.name. */
|
|
132
|
+
ProductAnalyticsDerivedMetric["Events"] = "oneuptime.rum.product.events";
|
|
133
|
+
/* Sessions started, by device.type. */
|
|
134
|
+
ProductAnalyticsDerivedMetric["Sessions"] = "oneuptime.rum.product.sessions";
|
|
135
|
+
/* Pages viewed, by device.type (never by path: one series per page would not end). */
|
|
136
|
+
ProductAnalyticsDerivedMetric["PageViews"] = "oneuptime.rum.product.page.views";
|
|
137
|
+
})(ProductAnalyticsDerivedMetric || (exports.ProductAnalyticsDerivedMetric = ProductAnalyticsDerivedMetric = {}));
|
|
138
|
+
exports.PRODUCT_ANALYTICS_DERIVED_METRICS = [
|
|
139
|
+
ProductAnalyticsDerivedMetric.Events,
|
|
140
|
+
ProductAnalyticsDerivedMetric.Sessions,
|
|
141
|
+
ProductAnalyticsDerivedMetric.PageViews,
|
|
142
|
+
];
|
|
143
|
+
/* The attributes the derived series carry. */
|
|
144
|
+
exports.PRODUCT_ANALYTICS_EVENT_NAME_ATTRIBUTE = "event.name";
|
|
145
|
+
exports.PRODUCT_ANALYTICS_DEVICE_TYPE_ATTRIBUTE = "device.type";
|
|
146
|
+
/* The minute the derived series count over, in milliseconds. */
|
|
147
|
+
exports.PRODUCT_ANALYTICS_DERIVED_METRIC_INTERVAL_MS = 60000;
|
|
148
|
+
function isProductAnalyticsDerivedMetricName(name) {
|
|
149
|
+
return (typeof name === "string" &&
|
|
150
|
+
name
|
|
151
|
+
.trim()
|
|
152
|
+
.toLowerCase()
|
|
153
|
+
.startsWith(exports.PRODUCT_ANALYTICS_DERIVED_METRIC_PREFIX));
|
|
154
|
+
}
|
|
155
|
+
const DERIVED_METRIC_DESCRIPTIONS = {
|
|
156
|
+
[ProductAnalyticsDerivedMetric.Events]: "Events the application sent with track(), counted per minute, by event.name.",
|
|
157
|
+
[ProductAnalyticsDerivedMetric.Sessions]: "Sessions that started, counted per minute, by device.type.",
|
|
158
|
+
[ProductAnalyticsDerivedMetric.PageViews]: "Pages viewed, counted per minute, by device.type.",
|
|
159
|
+
};
|
|
160
|
+
function getProductAnalyticsDerivedMetricDescription(metric) {
|
|
161
|
+
return DERIVED_METRIC_DESCRIPTIONS[metric];
|
|
162
|
+
}
|
|
163
|
+
/*
|
|
164
|
+
* A name a recorder may send with metric(): the instrument name shape, and
|
|
165
|
+
* not in OneUptime's namespace.
|
|
166
|
+
*/
|
|
167
|
+
function isProductAnalyticsMetricName(value) {
|
|
168
|
+
return (typeof value === "string" &&
|
|
169
|
+
METRIC_NAME_PATTERN.test(value) &&
|
|
170
|
+
!value.toLowerCase().startsWith(exports.PRODUCT_ANALYTICS_RESERVED_METRIC_PREFIX));
|
|
171
|
+
}
|
|
172
|
+
/* ---- Events. ---- */
|
|
173
|
+
var ProductAnalyticsEventKind;
|
|
174
|
+
(function (ProductAnalyticsEventKind) {
|
|
175
|
+
/* A session started; named "". */
|
|
176
|
+
ProductAnalyticsEventKind["Session"] = "session";
|
|
177
|
+
/* A page (a mobile app's screen) was viewed; named by its path. */
|
|
178
|
+
ProductAnalyticsEventKind["Page"] = "page";
|
|
179
|
+
/* The application called track(); named as it said. */
|
|
180
|
+
ProductAnalyticsEventKind["Custom"] = "custom";
|
|
181
|
+
})(ProductAnalyticsEventKind || (exports.ProductAnalyticsEventKind = ProductAnalyticsEventKind = {}));
|
|
182
|
+
exports.PRODUCT_ANALYTICS_EVENT_KINDS = [
|
|
183
|
+
ProductAnalyticsEventKind.Session,
|
|
184
|
+
ProductAnalyticsEventKind.Page,
|
|
185
|
+
ProductAnalyticsEventKind.Custom,
|
|
186
|
+
];
|
|
187
|
+
function isProductAnalyticsEventKind(value) {
|
|
188
|
+
return exports.PRODUCT_ANALYTICS_EVENT_KINDS.includes(value);
|
|
189
|
+
}
|
|
190
|
+
const HEX_32_PATTERN = /^[0-9a-f]{32}$/;
|
|
191
|
+
/* Where a page's query or fragment begins. */
|
|
192
|
+
const QUERY_OR_FRAGMENT_PATTERN = /[?#]/;
|
|
193
|
+
function isProductAnalyticsId(value) {
|
|
194
|
+
return typeof value === "string" && HEX_32_PATTERN.test(value);
|
|
195
|
+
}
|
|
196
|
+
/*
|
|
197
|
+
* A custom event's name as stored: trimmed, at most
|
|
198
|
+
* PRODUCT_ANALYTICS_MAX_EVENT_NAME_LENGTH long, or null when nothing is left.
|
|
199
|
+
* Control characters are dropped, so a name always prints on one line.
|
|
200
|
+
*/
|
|
201
|
+
function toProductAnalyticsEventName(value) {
|
|
202
|
+
if (typeof value !== "string") {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
let name = "";
|
|
206
|
+
for (const character of value) {
|
|
207
|
+
const code = character.charCodeAt(0);
|
|
208
|
+
if (code < 32 || code === 127) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
name += character;
|
|
212
|
+
}
|
|
213
|
+
name = name.trim().slice(0, exports.PRODUCT_ANALYTICS_MAX_EVENT_NAME_LENGTH).trim();
|
|
214
|
+
return name.length > 0 ? name : null;
|
|
215
|
+
}
|
|
216
|
+
/*
|
|
217
|
+
* A page as stored: its path, from the first "/", without a query or a
|
|
218
|
+
* fragment. A mobile app's screen name ("Checkout") becomes "/Checkout",
|
|
219
|
+
* the path part one files its sessions' pages under. "" when there is none.
|
|
220
|
+
*/
|
|
221
|
+
function toProductAnalyticsPage(value) {
|
|
222
|
+
if (typeof value !== "string") {
|
|
223
|
+
return "";
|
|
224
|
+
}
|
|
225
|
+
let page = value.trim();
|
|
226
|
+
const schemeIndex = page.indexOf("://");
|
|
227
|
+
if (schemeIndex >= 0) {
|
|
228
|
+
const pathIndex = page.indexOf("/", schemeIndex + 3);
|
|
229
|
+
page = pathIndex >= 0 ? page.slice(pathIndex) : "/";
|
|
230
|
+
}
|
|
231
|
+
const queryIndex = page.search(QUERY_OR_FRAGMENT_PATTERN);
|
|
232
|
+
if (queryIndex >= 0) {
|
|
233
|
+
page = page.slice(0, queryIndex);
|
|
234
|
+
}
|
|
235
|
+
if (page.length === 0) {
|
|
236
|
+
return "";
|
|
237
|
+
}
|
|
238
|
+
if (!page.startsWith("/")) {
|
|
239
|
+
page = `/${page}`;
|
|
240
|
+
}
|
|
241
|
+
return page.slice(0, exports.PRODUCT_ANALYTICS_MAX_PAGE_LENGTH);
|
|
242
|
+
}
|
|
243
|
+
function toContextValue(value) {
|
|
244
|
+
return typeof value === "string"
|
|
245
|
+
? value.trim().slice(0, exports.PRODUCT_ANALYTICS_MAX_CONTEXT_VALUE_LENGTH)
|
|
246
|
+
: "";
|
|
247
|
+
}
|
|
248
|
+
const DEVICE_TYPES = ["desktop", "mobile", "tablet"];
|
|
249
|
+
function toProductAnalyticsContext(value) {
|
|
250
|
+
const record = value !== null && typeof value === "object" && !Array.isArray(value)
|
|
251
|
+
? value
|
|
252
|
+
: {};
|
|
253
|
+
const deviceType = toContextValue(record["deviceType"]);
|
|
254
|
+
return {
|
|
255
|
+
deviceType: DEVICE_TYPES.includes(deviceType) ? deviceType : "",
|
|
256
|
+
browserName: toContextValue(record["browserName"]),
|
|
257
|
+
osName: toContextValue(record["osName"]),
|
|
258
|
+
appVersion: toContextValue(record["appVersion"]),
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/*
|
|
262
|
+
* The application's list of identify() traits it keeps for analytics, as
|
|
263
|
+
* stored and served: trimmed, without duplicates (ignoring case), at most
|
|
264
|
+
* PRODUCT_ANALYTICS_USER_PROPERTY_LIMITS.maxKeys keys of at most maxKeyLength.
|
|
265
|
+
*/
|
|
266
|
+
function normalizeProductAnalyticsUserPropertyKeys(value) {
|
|
267
|
+
if (!Array.isArray(value)) {
|
|
268
|
+
return [];
|
|
269
|
+
}
|
|
270
|
+
const keys = [];
|
|
271
|
+
const seen = new Set();
|
|
272
|
+
for (const entry of value) {
|
|
273
|
+
if (typeof entry !== "string") {
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
const key = entry
|
|
277
|
+
.trim()
|
|
278
|
+
.slice(0, exports.PRODUCT_ANALYTICS_USER_PROPERTY_LIMITS.maxKeyLength);
|
|
279
|
+
if (key.length === 0 || key === "__proto__") {
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (seen.has(key.toLowerCase())) {
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
seen.add(key.toLowerCase());
|
|
286
|
+
keys.push(key);
|
|
287
|
+
if (keys.length >= exports.PRODUCT_ANALYTICS_USER_PROPERTY_LIMITS.maxKeys) {
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return keys;
|
|
292
|
+
}
|
|
293
|
+
/*
|
|
294
|
+
* The traits an event may carry: those the application listed, matched as
|
|
295
|
+
* written, under the trait caps. Any other trait never leaves the page, and
|
|
296
|
+
* the server drops it again if a recorder sent it.
|
|
297
|
+
*/
|
|
298
|
+
function pickProductAnalyticsUserProperties(traits, allowedKeys) {
|
|
299
|
+
const sanitized = (0, SessionReplayStringMap_1.sanitizeSessionReplayStringMap)(traits, exports.PRODUCT_ANALYTICS_USER_PROPERTY_LIMITS);
|
|
300
|
+
const picked = {};
|
|
301
|
+
for (const key of allowedKeys) {
|
|
302
|
+
if (Object.prototype.hasOwnProperty.call(sanitized, key)) {
|
|
303
|
+
picked[key] = sanitized[key];
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return picked;
|
|
307
|
+
}
|
|
308
|
+
function isFiniteNumber(value) {
|
|
309
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
310
|
+
}
|
|
311
|
+
/*
|
|
312
|
+
* The batch as the server keeps it. A batch whose ids or size are wrong is
|
|
313
|
+
* refused whole (the recorder that sent it is broken, and the next one will
|
|
314
|
+
* be too); an event or a metric point that is wrong is left out alone and
|
|
315
|
+
* counted, so one bad call on a page does not cost the rest of its batch.
|
|
316
|
+
*
|
|
317
|
+
* Times move by the gap between the recorder's clock and the server's
|
|
318
|
+
* (receivedAt - sentAt), so a phone whose clock is a day out still files
|
|
319
|
+
* its events when they happened; none lands in the future, and one older
|
|
320
|
+
* than PRODUCT_ANALYTICS_MAX_EVENT_AGE_MS is dropped.
|
|
321
|
+
*
|
|
322
|
+
* userProperties keep only allowedUserPropertyKeys; with no userRef (the
|
|
323
|
+
* application does not capture identity, or nobody signed in) there are
|
|
324
|
+
* none at all.
|
|
325
|
+
*/
|
|
326
|
+
function parseProductAnalyticsBatch(input, options) {
|
|
327
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) {
|
|
328
|
+
return { isValid: false, error: "not-an-object" };
|
|
329
|
+
}
|
|
330
|
+
const body = input;
|
|
331
|
+
if (body["v"] !== exports.PRODUCT_ANALYTICS_WIRE_VERSION) {
|
|
332
|
+
return { isValid: false, error: "unsupported-version" };
|
|
333
|
+
}
|
|
334
|
+
if (!isProductAnalyticsId(body["batchId"])) {
|
|
335
|
+
return { isValid: false, error: "invalid-batch-id" };
|
|
336
|
+
}
|
|
337
|
+
if (!isProductAnalyticsId(body["sessionId"])) {
|
|
338
|
+
return { isValid: false, error: "invalid-session-id" };
|
|
339
|
+
}
|
|
340
|
+
const rawVisitorId = body["visitorId"];
|
|
341
|
+
if (rawVisitorId !== undefined &&
|
|
342
|
+
rawVisitorId !== "" &&
|
|
343
|
+
!(typeof rawVisitorId === "string" &&
|
|
344
|
+
SessionReplay_1.SESSION_REPLAY_VISITOR_ID_PATTERN.test(rawVisitorId))) {
|
|
345
|
+
return { isValid: false, error: "invalid-visitor-id" };
|
|
346
|
+
}
|
|
347
|
+
const rawEvents = Array.isArray(body["events"])
|
|
348
|
+
? body["events"]
|
|
349
|
+
: [];
|
|
350
|
+
const rawMetrics = Array.isArray(body["metrics"])
|
|
351
|
+
? body["metrics"]
|
|
352
|
+
: [];
|
|
353
|
+
if (rawEvents.length > exports.PRODUCT_ANALYTICS_MAX_EVENTS_PER_BATCH) {
|
|
354
|
+
return { isValid: false, error: "too-many-events" };
|
|
355
|
+
}
|
|
356
|
+
if (rawMetrics.length > exports.PRODUCT_ANALYTICS_MAX_METRICS_PER_BATCH) {
|
|
357
|
+
return { isValid: false, error: "too-many-metrics" };
|
|
358
|
+
}
|
|
359
|
+
const receivedAt = options.receivedAtUnixMs;
|
|
360
|
+
const sentAt = body["sentAt"];
|
|
361
|
+
const skew = isFiniteNumber(sentAt) ? receivedAt - sentAt : 0;
|
|
362
|
+
const oldest = receivedAt - exports.PRODUCT_ANALYTICS_MAX_EVENT_AGE_MS;
|
|
363
|
+
let droppedTooOld = 0;
|
|
364
|
+
/* null for a time too old to keep; never later than the server's now. */
|
|
365
|
+
const toServerTime = (at) => {
|
|
366
|
+
const time = isFiniteNumber(at)
|
|
367
|
+
? Math.round(Math.min(at + skew, receivedAt))
|
|
368
|
+
: receivedAt;
|
|
369
|
+
if (time < oldest) {
|
|
370
|
+
droppedTooOld++;
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
return time;
|
|
374
|
+
};
|
|
375
|
+
const events = [];
|
|
376
|
+
let droppedEvents = 0;
|
|
377
|
+
for (const rawEvent of rawEvents) {
|
|
378
|
+
if (rawEvent === null ||
|
|
379
|
+
typeof rawEvent !== "object" ||
|
|
380
|
+
Array.isArray(rawEvent)) {
|
|
381
|
+
droppedEvents++;
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
const event = rawEvent;
|
|
385
|
+
const kind = event["kind"];
|
|
386
|
+
if (!isProductAnalyticsEventKind(kind)) {
|
|
387
|
+
droppedEvents++;
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
const page = toProductAnalyticsPage(event["page"]);
|
|
391
|
+
let name;
|
|
392
|
+
if (kind === ProductAnalyticsEventKind.Session) {
|
|
393
|
+
name = "";
|
|
394
|
+
}
|
|
395
|
+
else if (kind === ProductAnalyticsEventKind.Page) {
|
|
396
|
+
name = toProductAnalyticsPage(event["name"]) || page || null;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
name = toProductAnalyticsEventName(event["name"]);
|
|
400
|
+
}
|
|
401
|
+
if (name === null) {
|
|
402
|
+
droppedEvents++;
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
const time = toServerTime(event["at"]);
|
|
406
|
+
if (time === null) {
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
events.push({
|
|
410
|
+
kind: kind,
|
|
411
|
+
name: name,
|
|
412
|
+
time: time,
|
|
413
|
+
page: kind === ProductAnalyticsEventKind.Page ? name : page,
|
|
414
|
+
properties: kind === ProductAnalyticsEventKind.Custom
|
|
415
|
+
? (0, SessionReplayStringMap_1.sanitizeSessionReplayStringMap)(event["properties"], exports.PRODUCT_ANALYTICS_PROPERTY_LIMITS)
|
|
416
|
+
: {},
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
const metrics = [];
|
|
420
|
+
let droppedMetrics = 0;
|
|
421
|
+
for (const rawMetric of rawMetrics) {
|
|
422
|
+
if (rawMetric === null ||
|
|
423
|
+
typeof rawMetric !== "object" ||
|
|
424
|
+
Array.isArray(rawMetric)) {
|
|
425
|
+
droppedMetrics++;
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
const metric = rawMetric;
|
|
429
|
+
if (!isProductAnalyticsMetricName(metric["name"]) ||
|
|
430
|
+
!isFiniteNumber(metric["value"])) {
|
|
431
|
+
droppedMetrics++;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
const time = toServerTime(metric["at"]);
|
|
435
|
+
if (time === null) {
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
metrics.push({
|
|
439
|
+
name: metric["name"],
|
|
440
|
+
value: metric["value"],
|
|
441
|
+
time: time,
|
|
442
|
+
attributes: (0, SessionReplayStringMap_1.sanitizeSessionReplayStringMap)(metric["attributes"], exports.PRODUCT_ANALYTICS_PROPERTY_LIMITS),
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
const rawUserRef = body["userRef"];
|
|
446
|
+
const userRef = typeof rawUserRef === "string"
|
|
447
|
+
? rawUserRef.trim().slice(0, SessionReplay_1.SESSION_REPLAY_MAX_USER_REF_LENGTH)
|
|
448
|
+
: "";
|
|
449
|
+
return {
|
|
450
|
+
isValid: true,
|
|
451
|
+
batch: {
|
|
452
|
+
batchId: body["batchId"],
|
|
453
|
+
sessionId: body["sessionId"],
|
|
454
|
+
visitorId: typeof rawVisitorId === "string" ? rawVisitorId : "",
|
|
455
|
+
userRef: userRef,
|
|
456
|
+
userProperties: userRef
|
|
457
|
+
? pickProductAnalyticsUserProperties(body["userProperties"], options.allowedUserPropertyKeys)
|
|
458
|
+
: {},
|
|
459
|
+
context: toProductAnalyticsContext(body["context"]),
|
|
460
|
+
events: events,
|
|
461
|
+
metrics: metrics,
|
|
462
|
+
droppedEvents: droppedEvents,
|
|
463
|
+
droppedMetrics: droppedMetrics,
|
|
464
|
+
droppedTooOld: droppedTooOld,
|
|
465
|
+
},
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
function readProductAnalyticsRecorderConfig(value) {
|
|
469
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
470
|
+
return { enabled: false, userPropertyKeys: [] };
|
|
471
|
+
}
|
|
472
|
+
const record = value;
|
|
473
|
+
return {
|
|
474
|
+
enabled: record["enabled"] === true,
|
|
475
|
+
userPropertyKeys: normalizeProductAnalyticsUserPropertyKeys(record["userPropertyKeys"]),
|
|
476
|
+
};
|
|
477
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import commonJsModule from "./ProductAnalyticsEvents.js";
|
|
2
|
+
export const PRODUCT_ANALYTICS_CONTENT_TYPE = commonJsModule.PRODUCT_ANALYTICS_CONTENT_TYPE;
|
|
3
|
+
export const PRODUCT_ANALYTICS_DERIVED_METRICS = commonJsModule.PRODUCT_ANALYTICS_DERIVED_METRICS;
|
|
4
|
+
export const PRODUCT_ANALYTICS_DERIVED_METRIC_INTERVAL_MS = commonJsModule.PRODUCT_ANALYTICS_DERIVED_METRIC_INTERVAL_MS;
|
|
5
|
+
export const PRODUCT_ANALYTICS_DERIVED_METRIC_PREFIX = commonJsModule.PRODUCT_ANALYTICS_DERIVED_METRIC_PREFIX;
|
|
6
|
+
export const PRODUCT_ANALYTICS_DEVICE_TYPE_ATTRIBUTE = commonJsModule.PRODUCT_ANALYTICS_DEVICE_TYPE_ATTRIBUTE;
|
|
7
|
+
export const PRODUCT_ANALYTICS_EVENTS_PATH = commonJsModule.PRODUCT_ANALYTICS_EVENTS_PATH;
|
|
8
|
+
export const PRODUCT_ANALYTICS_EVENTS_ROUTE = commonJsModule.PRODUCT_ANALYTICS_EVENTS_ROUTE;
|
|
9
|
+
export const PRODUCT_ANALYTICS_EVENT_KINDS = commonJsModule.PRODUCT_ANALYTICS_EVENT_KINDS;
|
|
10
|
+
export const PRODUCT_ANALYTICS_EVENT_NAME_ATTRIBUTE = commonJsModule.PRODUCT_ANALYTICS_EVENT_NAME_ATTRIBUTE;
|
|
11
|
+
export const PRODUCT_ANALYTICS_FLUSH_INTERVAL_MS = commonJsModule.PRODUCT_ANALYTICS_FLUSH_INTERVAL_MS;
|
|
12
|
+
export const PRODUCT_ANALYTICS_MAX_BATCH_BYTES = commonJsModule.PRODUCT_ANALYTICS_MAX_BATCH_BYTES;
|
|
13
|
+
export const PRODUCT_ANALYTICS_MAX_CONTEXT_VALUE_LENGTH = commonJsModule.PRODUCT_ANALYTICS_MAX_CONTEXT_VALUE_LENGTH;
|
|
14
|
+
export const PRODUCT_ANALYTICS_MAX_EVENTS_PER_BATCH = commonJsModule.PRODUCT_ANALYTICS_MAX_EVENTS_PER_BATCH;
|
|
15
|
+
export const PRODUCT_ANALYTICS_MAX_EVENT_AGE_MS = commonJsModule.PRODUCT_ANALYTICS_MAX_EVENT_AGE_MS;
|
|
16
|
+
export const PRODUCT_ANALYTICS_MAX_EVENT_NAME_LENGTH = commonJsModule.PRODUCT_ANALYTICS_MAX_EVENT_NAME_LENGTH;
|
|
17
|
+
export const PRODUCT_ANALYTICS_MAX_ITEMS_PER_PROJECT_PER_MINUTE = commonJsModule.PRODUCT_ANALYTICS_MAX_ITEMS_PER_PROJECT_PER_MINUTE;
|
|
18
|
+
export const PRODUCT_ANALYTICS_MAX_METRICS_PER_BATCH = commonJsModule.PRODUCT_ANALYTICS_MAX_METRICS_PER_BATCH;
|
|
19
|
+
export const PRODUCT_ANALYTICS_MAX_METRIC_NAME_LENGTH = commonJsModule.PRODUCT_ANALYTICS_MAX_METRIC_NAME_LENGTH;
|
|
20
|
+
export const PRODUCT_ANALYTICS_MAX_PAGE_LENGTH = commonJsModule.PRODUCT_ANALYTICS_MAX_PAGE_LENGTH;
|
|
21
|
+
export const PRODUCT_ANALYTICS_MAX_PENDING_EVENTS = commonJsModule.PRODUCT_ANALYTICS_MAX_PENDING_EVENTS;
|
|
22
|
+
export const PRODUCT_ANALYTICS_PROPERTY_LIMITS = commonJsModule.PRODUCT_ANALYTICS_PROPERTY_LIMITS;
|
|
23
|
+
export const PRODUCT_ANALYTICS_RESERVED_METRIC_PREFIX = commonJsModule.PRODUCT_ANALYTICS_RESERVED_METRIC_PREFIX;
|
|
24
|
+
export const PRODUCT_ANALYTICS_TARGET_BATCH_BYTES = commonJsModule.PRODUCT_ANALYTICS_TARGET_BATCH_BYTES;
|
|
25
|
+
export const PRODUCT_ANALYTICS_USER_PROPERTY_LIMITS = commonJsModule.PRODUCT_ANALYTICS_USER_PROPERTY_LIMITS;
|
|
26
|
+
export const PRODUCT_ANALYTICS_WIRE_VERSION = commonJsModule.PRODUCT_ANALYTICS_WIRE_VERSION;
|
|
27
|
+
export const ProductAnalyticsDerivedMetric = commonJsModule.ProductAnalyticsDerivedMetric;
|
|
28
|
+
export const ProductAnalyticsEventKind = commonJsModule.ProductAnalyticsEventKind;
|
|
29
|
+
export const getProductAnalyticsDerivedMetricDescription = commonJsModule.getProductAnalyticsDerivedMetricDescription;
|
|
30
|
+
export const isProductAnalyticsDerivedMetricName = commonJsModule.isProductAnalyticsDerivedMetricName;
|
|
31
|
+
export const isProductAnalyticsEventKind = commonJsModule.isProductAnalyticsEventKind;
|
|
32
|
+
export const isProductAnalyticsId = commonJsModule.isProductAnalyticsId;
|
|
33
|
+
export const isProductAnalyticsMetricName = commonJsModule.isProductAnalyticsMetricName;
|
|
34
|
+
export const normalizeProductAnalyticsUserPropertyKeys = commonJsModule.normalizeProductAnalyticsUserPropertyKeys;
|
|
35
|
+
export const parseProductAnalyticsBatch = commonJsModule.parseProductAnalyticsBatch;
|
|
36
|
+
export const pickProductAnalyticsUserProperties = commonJsModule.pickProductAnalyticsUserProperties;
|
|
37
|
+
export const readProductAnalyticsRecorderConfig = commonJsModule.readProductAnalyticsRecorderConfig;
|
|
38
|
+
export const toProductAnalyticsContext = commonJsModule.toProductAnalyticsContext;
|
|
39
|
+
export const toProductAnalyticsEventName = commonJsModule.toProductAnalyticsEventName;
|
|
40
|
+
export const toProductAnalyticsPage = commonJsModule.toProductAnalyticsPage;
|
|
@@ -182,6 +182,10 @@ export interface SessionReplayConfigResponse {
|
|
|
182
182
|
slowRequestBudgetMs?: number;
|
|
183
183
|
isTargeted?: boolean;
|
|
184
184
|
frustrationSignals?: SessionReplayFrustrationSignalsConfig;
|
|
185
|
+
productAnalytics?: {
|
|
186
|
+
enabled: boolean;
|
|
187
|
+
userPropertyKeys: Array<string>;
|
|
188
|
+
};
|
|
185
189
|
respectDoNotTrack: boolean;
|
|
186
190
|
configEpoch: number;
|
|
187
191
|
directive: SessionReplayDirective;
|
|
@@ -182,6 +182,10 @@ export interface SessionReplayConfigResponse {
|
|
|
182
182
|
slowRequestBudgetMs?: number;
|
|
183
183
|
isTargeted?: boolean;
|
|
184
184
|
frustrationSignals?: SessionReplayFrustrationSignalsConfig;
|
|
185
|
+
productAnalytics?: {
|
|
186
|
+
enabled: boolean;
|
|
187
|
+
userPropertyKeys: Array<string>;
|
|
188
|
+
};
|
|
185
189
|
respectDoNotTrack: boolean;
|
|
186
190
|
configEpoch: number;
|
|
187
191
|
directive: SessionReplayDirective;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* that POST /telemetry/rum/session-replay/ingest-status answers today
|
|
8
8
|
* plus its additive fields, every new one optional. RecordingHealthStatus
|
|
9
9
|
* is the normalised object the Dashboard builds from it (see
|
|
10
|
-
* parseRecordingHealthStatus in Common/Utils/
|
|
10
|
+
* parseRecordingHealthStatus in Common/Utils/SessionReplay/SessionReplayHealth.ts)
|
|
11
11
|
* and the only input diagnoseRecordingHealth takes. Keeping the two apart
|
|
12
12
|
* is what lets the diagnosis be exhaustively tested against a stable
|
|
13
13
|
* shape while the wire grows a field at a time.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare enum SloErrorBudgetPolicyChange {
|
|
2
|
+
EnteredMoreSevereTier = "Entered a more severe tier",
|
|
3
|
+
RecoveredToLessSevereTier = "Recovered to a less severe tier",
|
|
4
|
+
LeftEveryTier = "Left every tier",
|
|
5
|
+
DeploymentsFrozen = "Deployments frozen",
|
|
6
|
+
DeploymentsAllowed = "Deployments allowed again"
|
|
7
|
+
}
|
|
8
|
+
export declare const SLO_ERROR_BUDGET_POLICY_CHANGES: ReadonlyArray<SloErrorBudgetPolicyChange>;
|
|
9
|
+
export declare function isSloErrorBudgetPolicyChange(value: unknown): value is SloErrorBudgetPolicyChange;
|
|
10
|
+
export default SloErrorBudgetPolicyChange;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare enum SloErrorBudgetPolicyChange {
|
|
2
|
+
EnteredMoreSevereTier = "Entered a more severe tier",
|
|
3
|
+
RecoveredToLessSevereTier = "Recovered to a less severe tier",
|
|
4
|
+
LeftEveryTier = "Left every tier",
|
|
5
|
+
DeploymentsFrozen = "Deployments frozen",
|
|
6
|
+
DeploymentsAllowed = "Deployments allowed again"
|
|
7
|
+
}
|
|
8
|
+
export declare const SLO_ERROR_BUDGET_POLICY_CHANGES: ReadonlyArray<SloErrorBudgetPolicyChange>;
|
|
9
|
+
export declare function isSloErrorBudgetPolicyChange(value: unknown): value is SloErrorBudgetPolicyChange;
|
|
10
|
+
export default SloErrorBudgetPolicyChange;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SLO_ERROR_BUDGET_POLICY_CHANGES = void 0;
|
|
4
|
+
exports.isSloErrorBudgetPolicyChange = isSloErrorBudgetPolicyChange;
|
|
5
|
+
/*
|
|
6
|
+
* WHAT AN EVALUATION DID TO AN SLO'S ERROR BUDGET POLICY.
|
|
7
|
+
*
|
|
8
|
+
* The evaluation worker moves an SLO between the tiers of its error budget
|
|
9
|
+
* policy and answers its deploy gate from the tier it is in
|
|
10
|
+
* (Utils/Slo/SloErrorBudgetPolicy). Each change it commits is one of these,
|
|
11
|
+
* or two at once - a tier change that also froze deployments, or allowed
|
|
12
|
+
* them again:
|
|
13
|
+
*
|
|
14
|
+
* - the SLO entered a tier, from none or from a less severe one;
|
|
15
|
+
* - it recovered to a less severe tier;
|
|
16
|
+
* - it left every tier, its budget above them all again;
|
|
17
|
+
* - its deployments were frozen;
|
|
18
|
+
* - its deployments were allowed again.
|
|
19
|
+
*
|
|
20
|
+
* The SLO's feed says each in its own words (SloFeedMarkdown). The Slack,
|
|
21
|
+
* Microsoft Teams and Mattermost rules for SLOs pick which of them they post
|
|
22
|
+
* with their Error Budget Policy Change condition
|
|
23
|
+
* (NotificationRuleConditionCheckOn.SloErrorBudgetPolicyChange); a rule
|
|
24
|
+
* without one posts them all.
|
|
25
|
+
*
|
|
26
|
+
* The values are what a rule's condition stores and what its dropdown
|
|
27
|
+
* shows, so they never change. A rule matches them with Contains Any, which
|
|
28
|
+
* finds one value inside another (WorkspaceNotificationRuleUtil), so none of
|
|
29
|
+
* them is a part of another.
|
|
30
|
+
*/
|
|
31
|
+
var SloErrorBudgetPolicyChange;
|
|
32
|
+
(function (SloErrorBudgetPolicyChange) {
|
|
33
|
+
SloErrorBudgetPolicyChange["EnteredMoreSevereTier"] = "Entered a more severe tier";
|
|
34
|
+
SloErrorBudgetPolicyChange["RecoveredToLessSevereTier"] = "Recovered to a less severe tier";
|
|
35
|
+
SloErrorBudgetPolicyChange["LeftEveryTier"] = "Left every tier";
|
|
36
|
+
SloErrorBudgetPolicyChange["DeploymentsFrozen"] = "Deployments frozen";
|
|
37
|
+
SloErrorBudgetPolicyChange["DeploymentsAllowed"] = "Deployments allowed again";
|
|
38
|
+
})(SloErrorBudgetPolicyChange || (SloErrorBudgetPolicyChange = {}));
|
|
39
|
+
// Every change, in the order a rule's dropdown lists them.
|
|
40
|
+
exports.SLO_ERROR_BUDGET_POLICY_CHANGES = [
|
|
41
|
+
SloErrorBudgetPolicyChange.EnteredMoreSevereTier,
|
|
42
|
+
SloErrorBudgetPolicyChange.RecoveredToLessSevereTier,
|
|
43
|
+
SloErrorBudgetPolicyChange.LeftEveryTier,
|
|
44
|
+
SloErrorBudgetPolicyChange.DeploymentsFrozen,
|
|
45
|
+
SloErrorBudgetPolicyChange.DeploymentsAllowed,
|
|
46
|
+
];
|
|
47
|
+
function isSloErrorBudgetPolicyChange(value) {
|
|
48
|
+
return (typeof value === "string" &&
|
|
49
|
+
exports.SLO_ERROR_BUDGET_POLICY_CHANGES.includes(value));
|
|
50
|
+
}
|
|
51
|
+
exports.default = SloErrorBudgetPolicyChange;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import commonJsModule from "./SloErrorBudgetPolicyChange.js";
|
|
2
|
+
export default commonJsModule.default;
|
|
3
|
+
export const SLO_ERROR_BUDGET_POLICY_CHANGES = commonJsModule.SLO_ERROR_BUDGET_POLICY_CHANGES;
|
|
4
|
+
export const isSloErrorBudgetPolicyChange = commonJsModule.isSloErrorBudgetPolicyChange;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BUILT_IN_TEAM_DELETE_MESSAGE = void 0;
|
|
3
|
+
exports.BUILT_IN_TEAM_OWNERS_MESSAGE = exports.BUILT_IN_TEAM_DELETE_MESSAGE = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Why a team that comes with every project (Owners and Admin, whose
|
|
6
6
|
* isTeamDeleteable is false) is never deleted. The server refuses with it
|
|
@@ -12,3 +12,16 @@ exports.BUILT_IN_TEAM_DELETE_MESSAGE = void 0;
|
|
|
12
12
|
* error dialog of the team's own Delete page.
|
|
13
13
|
*/
|
|
14
14
|
exports.BUILT_IN_TEAM_DELETE_MESSAGE = "This team comes with every project and can't be deleted.";
|
|
15
|
+
/*
|
|
16
|
+
* Why Owners and Admin (whose isTeamEditable is false) have no owners of
|
|
17
|
+
* their own: their members are the project's owners and admins, and only
|
|
18
|
+
* the permissions that come with those roles change who is in them - never a
|
|
19
|
+
* team permission scoped to the teams someone owns. The server refuses an
|
|
20
|
+
* owner for them with it (TeamOwnerUserService, TeamOwnerTeamService), and
|
|
21
|
+
* such a team's page says it where other teams list their owners: the
|
|
22
|
+
* Dashboard holds the same English as a translation key
|
|
23
|
+
* (BUILT_IN_TEAM_OWNERS_REASON in Components/Team/BuiltInTeamOwners.ts, on
|
|
24
|
+
* the team's page and the Teams list's Add Owner and Remove Owner; a test keeps
|
|
25
|
+
* the two equal).
|
|
26
|
+
*/
|
|
27
|
+
exports.BUILT_IN_TEAM_OWNERS_MESSAGE = "This team comes with every project and can't have owners.";
|