1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Static configuration for the native `AnalyticsService`: entity message names,
//! the proto-declared outbox topic + event types, read/aggregation caps, and the
//! resolve-once rollup-window env knob (never a per-request env read).
use OnceLock;
pub const PMS_MSG: &str = "udb.core.analytics.entity.v1.PipelineMetricSnapshot";
pub const EPS_MSG: &str = "udb.core.analytics.entity.v1.ExecutorPerformanceSummary";
pub const RAS_MSG: &str = "udb.core.analytics.entity.v1.ReconciliationAnalyticsSummary";
/// Outbox topic + event types exactly as the proto `method_event_contract`
/// declares them on the two mutating RPCs (`analytics_service.proto`); the
/// contract this service must actually fulfil.
pub const TOPIC_ANALYTICS_EVENTS: &str = "analytics.events";
pub const EVENT_TYPE_PIPELINE_METRIC_RECORDED: &str = "analytics.RecordPipelineMetric";
pub const EVENT_TYPE_SNAPSHOT_TRIGGERED: &str = "analytics.TriggerSnapshot";
pub const MAX_ANALYTICS_READ_ROWS: u32 = 10_000;
/// Denominator for the online `throughput_rps` derivation (requests per hourly
/// bucket).
pub const SECONDS_PER_HOUR: i64 = 3_600;
/// Default page size for pipeline-summary listings.
pub const PIPELINE_SUMMARY_PAGE_SIZE: i32 = 50;
/// Trailing window (hours) the percentile rollup pass scans. Overridable once
/// via `UDB_ANALYTICS_ROLLUP_WINDOW_HOURS` (OnceLock — never a per-request env
/// read).
pub const DEFAULT_ROLLUP_WINDOW_HOURS: i32 = 24;
pub