MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / record_process_for_tenant

Method record_process_for_tenant

nodedb/src/event/metrics.rs:88–101  ·  view source on GitHub ↗

Record event processing for a specific tenant. Also increments the global `events_processed` counter and updates LSN/sequence tracking. Silently skips tenant tracking if the per-core tenant map is full (bounded to `MAX_TRACKED_TENANTS`).

(&self, lsn: u64, sequence: u64, tenant_id: u64)

Source from the content-addressed store, hash-verified

86 /// LSN/sequence tracking. Silently skips tenant tracking if the
87 /// per-core tenant map is full (bounded to `MAX_TRACKED_TENANTS`).
88 pub fn record_process_for_tenant(&self, lsn: u64, sequence: u64, tenant_id: u64) {
89 self.record_process(lsn, sequence);
90
91 let mut map = match self.tenant_events.write() {
92 Ok(m) => m,
93 Err(p) => p.into_inner(),
94 };
95 if let Some(count) = map.get_mut(&tenant_id) {
96 *count += 1;
97 } else if map.len() < MAX_TRACKED_TENANTS {
98 map.insert(tenant_id, 1);
99 }
100 // If map is full and tenant not present, silently skip.
101 }
102
103 /// Snapshot of per-tenant event counts on this core.
104 pub fn tenant_event_counts(&self) -> HashMap<u64, u64> {

Callers 5

per_tenant_trackingFunction · 0.80
tenant_tracking_boundedFunction · 0.80
aggregate_from_coresFunction · 0.80
record_eventFunction · 0.80

Calls 5

record_processMethod · 0.80
writeMethod · 0.45
get_mutMethod · 0.45
lenMethod · 0.45
insertMethod · 0.45

Tested by 4

per_tenant_trackingFunction · 0.64
tenant_tracking_boundedFunction · 0.64
aggregate_from_coresFunction · 0.64