diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 20:51:57 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 20:51:57 +0000 |
| commit | 506829156784e87fd482b0b102540ea4a3c9f777 (patch) | |
| tree | b2060d6143c290c04afcab2c1a7a83b59f489795 /src/sync | |
| parent | 9bd58faad6be254f0221820fa5e8516b8b15e19d (diff) | |
refactor(sync): parameterize rejected index metrics by event type
Replace duplicate metrics methods (announcements vs states) with unified
methods using IntGaugeVec/IntCounterVec with an event_type label:
- update_rejected_hot_cache_size(event_type, size)
- record_rejected_hot_cache_hit(event_type)
- record_rejected_hot_cache_miss(event_type)
- record_rejected_hot_cache_expired(event_type, count)
- update_rejected_cold_index_size(event_type, size)
- record_rejected_cold_index_expired(event_type, count)
- record_rejected_invalidation(event_type, count)
Prometheus labels remain separate (event_type="announcement" vs
event_type="state") but implementation is now unified.
Phase 4 of rejected events index refactoring.
Diffstat (limited to 'src/sync')
| -rw-r--r-- | src/sync/metrics.rs | 379 |
1 files changed, 171 insertions, 208 deletions
diff --git a/src/sync/metrics.rs b/src/sync/metrics.rs index 2ed983e..aacfa2c 100644 --- a/src/sync/metrics.rs +++ b/src/sync/metrics.rs | |||
| @@ -41,37 +41,21 @@ pub struct SyncMetrics { | |||
| 41 | /// Relays marked as dead | 41 | /// Relays marked as dead |
| 42 | relays_dead_total: IntGauge, | 42 | relays_dead_total: IntGauge, |
| 43 | 43 | ||
| 44 | // === Rejected Announcements Index Metrics === | 44 | // === Rejected Events Index Metrics (unified with event_type label) === |
| 45 | /// Current number of entries in hot cache | 45 | /// Current number of entries in hot cache (by event_type: announcement, state) |
| 46 | rejected_announcements_hot_cache_current: IntGauge, | 46 | rejected_hot_cache_current: IntGaugeVec, |
| 47 | /// Total hot cache hits (events re-processed from cache) | 47 | /// Total hot cache hits (by event_type: announcement, state) |
| 48 | rejected_announcements_hot_cache_hits_total: IntCounter, | 48 | rejected_hot_cache_hits_total: IntCounterVec, |
| 49 | /// Total hot cache misses (events not in cache) | 49 | /// Total hot cache misses (by event_type: announcement, state) |
| 50 | rejected_announcements_hot_cache_misses_total: IntCounter, | 50 | rejected_hot_cache_misses_total: IntCounterVec, |
| 51 | /// Total expired entries removed from hot cache | 51 | /// Total expired entries removed from hot cache (by event_type: announcement, state) |
| 52 | rejected_announcements_hot_cache_expired_total: IntCounter, | 52 | rejected_hot_cache_expired_total: IntCounterVec, |
| 53 | /// Current number of entries in cold index | 53 | /// Current number of entries in cold index (by event_type: announcement, state) |
| 54 | rejected_announcements_cold_index_current: IntGauge, | 54 | rejected_cold_index_current: IntGaugeVec, |
| 55 | /// Total cold index entries expired and removed | 55 | /// Total cold index entries expired and removed (by event_type: announcement, state) |
| 56 | rejected_announcements_cold_index_expired_total: IntCounter, | 56 | rejected_cold_index_expired_total: IntCounterVec, |
| 57 | /// Total invalidations (maintainer announcements invalidated) | 57 | /// Total invalidations (by event_type: announcement, state) |
| 58 | rejected_announcements_invalidated_total: IntCounter, | 58 | rejected_invalidated_total: IntCounterVec, |
| 59 | |||
| 60 | // === Rejected States Index Metrics === | ||
| 61 | /// Current number of state events in hot cache | ||
| 62 | rejected_states_hot_cache_current: IntGauge, | ||
| 63 | /// Total hot cache hits (state events re-processed from cache) | ||
| 64 | rejected_states_hot_cache_hits_total: IntCounter, | ||
| 65 | /// Total hot cache misses (state events not in cache) | ||
| 66 | rejected_states_hot_cache_misses_total: IntCounter, | ||
| 67 | /// Total expired state events removed from hot cache | ||
| 68 | rejected_states_hot_cache_expired_total: IntCounter, | ||
| 69 | /// Current number of state event entries in cold index | ||
| 70 | rejected_states_cold_index_current: IntGauge, | ||
| 71 | /// Total state event cold index entries expired and removed | ||
| 72 | rejected_states_cold_index_expired_total: IntCounter, | ||
| 73 | /// Total state event invalidations | ||
| 74 | rejected_states_invalidated_total: IntCounter, | ||
| 75 | } | 59 | } |
| 76 | 60 | ||
| 77 | impl SyncMetrics { | 61 | impl SyncMetrics { |
| @@ -145,99 +129,69 @@ impl SyncMetrics { | |||
| 145 | ))?; | 129 | ))?; |
| 146 | registry.register(Box::new(relays_dead_total.clone()))?; | 130 | registry.register(Box::new(relays_dead_total.clone()))?; |
| 147 | 131 | ||
| 148 | // Rejected announcements metrics | 132 | // Rejected events metrics (unified with event_type label) |
| 149 | let rejected_announcements_hot_cache_current = IntGauge::with_opts(Opts::new( | 133 | let rejected_hot_cache_current = IntGaugeVec::new( |
| 150 | "ngit_sync_rejected_announcements_hot_cache_current", | 134 | Opts::new( |
| 151 | "Current number of entries in hot cache (full events, 2 min expiry)", | 135 | "ngit_sync_rejected_hot_cache_current", |
| 152 | ))?; | 136 | "Current number of entries in hot cache (full events, 2 min expiry)", |
| 153 | registry.register(Box::new(rejected_announcements_hot_cache_current.clone()))?; | 137 | ), |
| 154 | 138 | &["event_type"], | |
| 155 | let rejected_announcements_hot_cache_hits_total = IntCounter::with_opts(Opts::new( | 139 | )?; |
| 156 | "ngit_sync_rejected_announcements_hot_cache_hits_total", | 140 | registry.register(Box::new(rejected_hot_cache_current.clone()))?; |
| 157 | "Total hot cache hits (events re-processed from cache)", | ||
| 158 | ))?; | ||
| 159 | registry.register(Box::new( | ||
| 160 | rejected_announcements_hot_cache_hits_total.clone(), | ||
| 161 | ))?; | ||
| 162 | |||
| 163 | let rejected_announcements_hot_cache_misses_total = IntCounter::with_opts(Opts::new( | ||
| 164 | "ngit_sync_rejected_announcements_hot_cache_misses_total", | ||
| 165 | "Total hot cache misses (events not in cache when invalidated)", | ||
| 166 | ))?; | ||
| 167 | registry.register(Box::new( | ||
| 168 | rejected_announcements_hot_cache_misses_total.clone(), | ||
| 169 | ))?; | ||
| 170 | |||
| 171 | let rejected_announcements_hot_cache_expired_total = IntCounter::with_opts(Opts::new( | ||
| 172 | "ngit_sync_rejected_announcements_hot_cache_expired_total", | ||
| 173 | "Total expired entries removed from hot cache", | ||
| 174 | ))?; | ||
| 175 | registry.register(Box::new( | ||
| 176 | rejected_announcements_hot_cache_expired_total.clone(), | ||
| 177 | ))?; | ||
| 178 | |||
| 179 | let rejected_announcements_cold_index_current = IntGauge::with_opts(Opts::new( | ||
| 180 | "ngit_sync_rejected_announcements_cold_index_current", | ||
| 181 | "Current number of entries in cold index (metadata only, 7 day expiry)", | ||
| 182 | ))?; | ||
| 183 | registry.register(Box::new(rejected_announcements_cold_index_current.clone()))?; | ||
| 184 | |||
| 185 | let rejected_announcements_cold_index_expired_total = IntCounter::with_opts(Opts::new( | ||
| 186 | "ngit_sync_rejected_announcements_cold_index_expired_total", | ||
| 187 | "Total expired entries removed from cold index", | ||
| 188 | ))?; | ||
| 189 | registry.register(Box::new( | ||
| 190 | rejected_announcements_cold_index_expired_total.clone(), | ||
| 191 | ))?; | ||
| 192 | |||
| 193 | let rejected_announcements_invalidated_total = IntCounter::with_opts(Opts::new( | ||
| 194 | "ngit_sync_rejected_announcements_invalidated_total", | ||
| 195 | "Total invalidations (maintainer announcements invalidated when owner accepted)", | ||
| 196 | ))?; | ||
| 197 | registry.register(Box::new(rejected_announcements_invalidated_total.clone()))?; | ||
| 198 | |||
| 199 | // Rejected states metrics | ||
| 200 | let rejected_states_hot_cache_current = IntGauge::with_opts(Opts::new( | ||
| 201 | "ngit_sync_rejected_states_hot_cache_current", | ||
| 202 | "Current number of state events in hot cache (full events, 2 min expiry)", | ||
| 203 | ))?; | ||
| 204 | registry.register(Box::new(rejected_states_hot_cache_current.clone()))?; | ||
| 205 | 141 | ||
| 206 | let rejected_states_hot_cache_hits_total = IntCounter::with_opts(Opts::new( | 142 | let rejected_hot_cache_hits_total = IntCounterVec::new( |
| 207 | "ngit_sync_rejected_states_hot_cache_hits_total", | 143 | Opts::new( |
| 208 | "Total hot cache hits (state events re-processed from cache)", | 144 | "ngit_sync_rejected_hot_cache_hits_total", |
| 209 | ))?; | 145 | "Total hot cache hits (events re-processed from cache)", |
| 210 | registry.register(Box::new(rejected_states_hot_cache_hits_total.clone()))?; | 146 | ), |
| 147 | &["event_type"], | ||
| 148 | )?; | ||
| 149 | registry.register(Box::new(rejected_hot_cache_hits_total.clone()))?; | ||
| 211 | 150 | ||
| 212 | let rejected_states_hot_cache_misses_total = IntCounter::with_opts(Opts::new( | 151 | let rejected_hot_cache_misses_total = IntCounterVec::new( |
| 213 | "ngit_sync_rejected_states_hot_cache_misses_total", | 152 | Opts::new( |
| 214 | "Total hot cache misses (state events not in cache when invalidated)", | 153 | "ngit_sync_rejected_hot_cache_misses_total", |
| 215 | ))?; | 154 | "Total hot cache misses (events not in cache when invalidated)", |
| 216 | registry.register(Box::new(rejected_states_hot_cache_misses_total.clone()))?; | 155 | ), |
| 156 | &["event_type"], | ||
| 157 | )?; | ||
| 158 | registry.register(Box::new(rejected_hot_cache_misses_total.clone()))?; | ||
| 217 | 159 | ||
| 218 | let rejected_states_hot_cache_expired_total = IntCounter::with_opts(Opts::new( | 160 | let rejected_hot_cache_expired_total = IntCounterVec::new( |
| 219 | "ngit_sync_rejected_states_hot_cache_expired_total", | 161 | Opts::new( |
| 220 | "Total expired state events removed from hot cache", | 162 | "ngit_sync_rejected_hot_cache_expired_total", |
| 221 | ))?; | 163 | "Total expired entries removed from hot cache", |
| 222 | registry.register(Box::new(rejected_states_hot_cache_expired_total.clone()))?; | 164 | ), |
| 165 | &["event_type"], | ||
| 166 | )?; | ||
| 167 | registry.register(Box::new(rejected_hot_cache_expired_total.clone()))?; | ||
| 223 | 168 | ||
| 224 | let rejected_states_cold_index_current = IntGauge::with_opts(Opts::new( | 169 | let rejected_cold_index_current = IntGaugeVec::new( |
| 225 | "ngit_sync_rejected_states_cold_index_current", | 170 | Opts::new( |
| 226 | "Current number of state event entries in cold index (metadata only, 7 day expiry)", | 171 | "ngit_sync_rejected_cold_index_current", |
| 227 | ))?; | 172 | "Current number of entries in cold index (metadata only, 7 day expiry)", |
| 228 | registry.register(Box::new(rejected_states_cold_index_current.clone()))?; | 173 | ), |
| 174 | &["event_type"], | ||
| 175 | )?; | ||
| 176 | registry.register(Box::new(rejected_cold_index_current.clone()))?; | ||
| 229 | 177 | ||
| 230 | let rejected_states_cold_index_expired_total = IntCounter::with_opts(Opts::new( | 178 | let rejected_cold_index_expired_total = IntCounterVec::new( |
| 231 | "ngit_sync_rejected_states_cold_index_expired_total", | 179 | Opts::new( |
| 232 | "Total state event cold index entries expired and removed", | 180 | "ngit_sync_rejected_cold_index_expired_total", |
| 233 | ))?; | 181 | "Total expired entries removed from cold index", |
| 234 | registry.register(Box::new(rejected_states_cold_index_expired_total.clone()))?; | 182 | ), |
| 183 | &["event_type"], | ||
| 184 | )?; | ||
| 185 | registry.register(Box::new(rejected_cold_index_expired_total.clone()))?; | ||
| 235 | 186 | ||
| 236 | let rejected_states_invalidated_total = IntCounter::with_opts(Opts::new( | 187 | let rejected_invalidated_total = IntCounterVec::new( |
| 237 | "ngit_sync_rejected_states_invalidated_total", | 188 | Opts::new( |
| 238 | "Total state event invalidations (when announcements accepted)", | 189 | "ngit_sync_rejected_invalidated_total", |
| 239 | ))?; | 190 | "Total invalidations (events invalidated when dependencies resolved)", |
| 240 | registry.register(Box::new(rejected_states_invalidated_total.clone()))?; | 191 | ), |
| 192 | &["event_type"], | ||
| 193 | )?; | ||
| 194 | registry.register(Box::new(rejected_invalidated_total.clone()))?; | ||
| 241 | 195 | ||
| 242 | Ok(Self { | 196 | Ok(Self { |
| 243 | relay_connected, | 197 | relay_connected, |
| @@ -248,20 +202,13 @@ impl SyncMetrics { | |||
| 248 | relays_tracked_total, | 202 | relays_tracked_total, |
| 249 | relays_connected_total, | 203 | relays_connected_total, |
| 250 | relays_dead_total, | 204 | relays_dead_total, |
| 251 | rejected_announcements_hot_cache_current, | 205 | rejected_hot_cache_current, |
| 252 | rejected_announcements_hot_cache_hits_total, | 206 | rejected_hot_cache_hits_total, |
| 253 | rejected_announcements_hot_cache_misses_total, | 207 | rejected_hot_cache_misses_total, |
| 254 | rejected_announcements_hot_cache_expired_total, | 208 | rejected_hot_cache_expired_total, |
| 255 | rejected_announcements_cold_index_current, | 209 | rejected_cold_index_current, |
| 256 | rejected_announcements_cold_index_expired_total, | 210 | rejected_cold_index_expired_total, |
| 257 | rejected_announcements_invalidated_total, | 211 | rejected_invalidated_total, |
| 258 | rejected_states_hot_cache_current, | ||
| 259 | rejected_states_hot_cache_hits_total, | ||
| 260 | rejected_states_hot_cache_misses_total, | ||
| 261 | rejected_states_hot_cache_expired_total, | ||
| 262 | rejected_states_cold_index_current, | ||
| 263 | rejected_states_cold_index_expired_total, | ||
| 264 | rejected_states_invalidated_total, | ||
| 265 | }) | 212 | }) |
| 266 | } | 213 | } |
| 267 | 214 | ||
| @@ -434,86 +381,89 @@ impl SyncMetrics { | |||
| 434 | self.relays_dead_total.get() | 381 | self.relays_dead_total.get() |
| 435 | } | 382 | } |
| 436 | 383 | ||
| 437 | // === Rejected Announcements Recording Methods === | 384 | // === Rejected Events Recording Methods (unified with event_type parameter) === |
| 438 | 385 | ||
| 439 | /// Update hot cache current size gauge. | 386 | /// Update hot cache current size gauge for a specific event type. |
| 440 | pub fn update_hot_cache_size(&self, size: usize) { | 387 | /// |
| 441 | self.rejected_announcements_hot_cache_current | 388 | /// # Arguments |
| 389 | /// | ||
| 390 | /// * `event_type` - Either "announcement" or "state" | ||
| 391 | /// * `size` - Current number of entries | ||
| 392 | pub fn update_rejected_hot_cache_size(&self, event_type: &str, size: usize) { | ||
| 393 | self.rejected_hot_cache_current | ||
| 394 | .with_label_values(&[event_type]) | ||
| 442 | .set(size as i64); | 395 | .set(size as i64); |
| 443 | } | 396 | } |
| 444 | 397 | ||
| 445 | /// Record hot cache hit (event re-processed from cache). | 398 | /// Record hot cache hit for a specific event type. |
| 446 | pub fn record_hot_cache_hit(&self) { | 399 | /// |
| 447 | self.rejected_announcements_hot_cache_hits_total.inc(); | 400 | /// # Arguments |
| 401 | /// | ||
| 402 | /// * `event_type` - Either "announcement" or "state" | ||
| 403 | pub fn record_rejected_hot_cache_hit(&self, event_type: &str) { | ||
| 404 | self.rejected_hot_cache_hits_total | ||
| 405 | .with_label_values(&[event_type]) | ||
| 406 | .inc(); | ||
| 448 | } | 407 | } |
| 449 | 408 | ||
| 450 | /// Record hot cache miss (event not in cache when invalidated). | 409 | /// Record hot cache miss for a specific event type. |
| 451 | pub fn record_hot_cache_miss(&self) { | 410 | /// |
| 452 | self.rejected_announcements_hot_cache_misses_total.inc(); | 411 | /// # Arguments |
| 412 | /// | ||
| 413 | /// * `event_type` - Either "announcement" or "state" | ||
| 414 | pub fn record_rejected_hot_cache_miss(&self, event_type: &str) { | ||
| 415 | self.rejected_hot_cache_misses_total | ||
| 416 | .with_label_values(&[event_type]) | ||
| 417 | .inc(); | ||
| 453 | } | 418 | } |
| 454 | 419 | ||
| 455 | /// Record hot cache expired entries. | 420 | /// Record hot cache expired entries for a specific event type. |
| 456 | pub fn record_hot_cache_expired(&self, count: usize) { | 421 | /// |
| 457 | self.rejected_announcements_hot_cache_expired_total | 422 | /// # Arguments |
| 423 | /// | ||
| 424 | /// * `event_type` - Either "announcement" or "state" | ||
| 425 | /// * `count` - Number of expired entries | ||
| 426 | pub fn record_rejected_hot_cache_expired(&self, event_type: &str, count: usize) { | ||
| 427 | self.rejected_hot_cache_expired_total | ||
| 428 | .with_label_values(&[event_type]) | ||
| 458 | .inc_by(count as u64); | 429 | .inc_by(count as u64); |
| 459 | } | 430 | } |
| 460 | 431 | ||
| 461 | /// Update cold index current size gauge. | 432 | /// Update cold index current size gauge for a specific event type. |
| 462 | pub fn update_cold_index_size(&self, size: usize) { | 433 | /// |
| 463 | self.rejected_announcements_cold_index_current | 434 | /// # Arguments |
| 435 | /// | ||
| 436 | /// * `event_type` - Either "announcement" or "state" | ||
| 437 | /// * `size` - Current number of entries | ||
| 438 | pub fn update_rejected_cold_index_size(&self, event_type: &str, size: usize) { | ||
| 439 | self.rejected_cold_index_current | ||
| 440 | .with_label_values(&[event_type]) | ||
| 464 | .set(size as i64); | 441 | .set(size as i64); |
| 465 | } | 442 | } |
| 466 | 443 | ||
| 467 | /// Record cold index expired entries. | 444 | /// Record cold index expired entries for a specific event type. |
| 468 | pub fn record_cold_index_expired(&self, count: usize) { | 445 | /// |
| 469 | self.rejected_announcements_cold_index_expired_total | 446 | /// # Arguments |
| 470 | .inc_by(count as u64); | 447 | /// |
| 471 | } | 448 | /// * `event_type` - Either "announcement" or "state" |
| 472 | 449 | /// * `count` - Number of expired entries | |
| 473 | /// Record invalidation (maintainer announcement invalidated). | 450 | pub fn record_rejected_cold_index_expired(&self, event_type: &str, count: usize) { |
| 474 | pub fn record_invalidation(&self, count: usize) { | 451 | self.rejected_cold_index_expired_total |
| 475 | self.rejected_announcements_invalidated_total | 452 | .with_label_values(&[event_type]) |
| 476 | .inc_by(count as u64); | ||
| 477 | } | ||
| 478 | |||
| 479 | // === Rejected States Recording Methods === | ||
| 480 | |||
| 481 | /// Update state events hot cache current size gauge. | ||
| 482 | pub fn update_states_hot_cache_size(&self, size: usize) { | ||
| 483 | self.rejected_states_hot_cache_current.set(size as i64); | ||
| 484 | } | ||
| 485 | |||
| 486 | /// Record state event hot cache hit (event re-processed from cache). | ||
| 487 | pub fn record_states_hot_cache_hit(&self) { | ||
| 488 | self.rejected_states_hot_cache_hits_total.inc(); | ||
| 489 | } | ||
| 490 | |||
| 491 | /// Record state event hot cache miss (event not in cache when invalidated). | ||
| 492 | pub fn record_states_hot_cache_miss(&self) { | ||
| 493 | self.rejected_states_hot_cache_misses_total.inc(); | ||
| 494 | } | ||
| 495 | |||
| 496 | /// Record state event hot cache expired entries. | ||
| 497 | pub fn record_states_hot_cache_expired(&self, count: usize) { | ||
| 498 | self.rejected_states_hot_cache_expired_total | ||
| 499 | .inc_by(count as u64); | 453 | .inc_by(count as u64); |
| 500 | } | 454 | } |
| 501 | 455 | ||
| 502 | /// Update state events cold index current size gauge. | 456 | /// Record invalidation for a specific event type. |
| 503 | pub fn update_states_cold_index_size(&self, size: usize) { | 457 | /// |
| 504 | self.rejected_states_cold_index_current.set(size as i64); | 458 | /// # Arguments |
| 505 | } | 459 | /// |
| 506 | 460 | /// * `event_type` - Either "announcement" or "state" | |
| 507 | /// Record state event cold index expired entries. | 461 | /// * `count` - Number of invalidated entries |
| 508 | pub fn record_states_cold_index_expired(&self, count: usize) { | 462 | pub fn record_rejected_invalidation(&self, event_type: &str, count: usize) { |
| 509 | self.rejected_states_cold_index_expired_total | 463 | self.rejected_invalidated_total |
| 464 | .with_label_values(&[event_type]) | ||
| 510 | .inc_by(count as u64); | 465 | .inc_by(count as u64); |
| 511 | } | 466 | } |
| 512 | |||
| 513 | /// Record state event invalidation. | ||
| 514 | pub fn record_states_invalidation(&self, count: usize) { | ||
| 515 | self.rejected_states_invalidated_total.inc_by(count as u64); | ||
| 516 | } | ||
| 517 | } | 467 | } |
| 518 | 468 | ||
| 519 | #[cfg(test)] | 469 | #[cfg(test)] |
| @@ -618,23 +568,36 @@ mod tests { | |||
| 618 | } | 568 | } |
| 619 | 569 | ||
| 620 | #[test] | 570 | #[test] |
| 621 | fn test_rejected_announcements_metrics() { | 571 | fn test_rejected_events_metrics() { |
| 622 | let registry = create_test_registry(); | 572 | let registry = create_test_registry(); |
| 623 | let metrics = SyncMetrics::register(®istry).unwrap(); | 573 | let metrics = SyncMetrics::register(®istry).unwrap(); |
| 624 | 574 | ||
| 625 | // Test hot cache metrics | 575 | // Test announcement hot cache metrics |
| 626 | metrics.update_hot_cache_size(10); | 576 | metrics.update_rejected_hot_cache_size("announcement", 10); |
| 627 | metrics.record_hot_cache_hit(); | 577 | metrics.record_rejected_hot_cache_hit("announcement"); |
| 628 | metrics.record_hot_cache_hit(); | 578 | metrics.record_rejected_hot_cache_hit("announcement"); |
| 629 | metrics.record_hot_cache_miss(); | 579 | metrics.record_rejected_hot_cache_miss("announcement"); |
| 630 | metrics.record_hot_cache_expired(5); | 580 | metrics.record_rejected_hot_cache_expired("announcement", 5); |
| 631 | 581 | ||
| 632 | // Test cold index metrics | 582 | // Test announcement cold index metrics |
| 633 | metrics.update_cold_index_size(100); | 583 | metrics.update_rejected_cold_index_size("announcement", 100); |
| 634 | metrics.record_cold_index_expired(10); | 584 | metrics.record_rejected_cold_index_expired("announcement", 10); |
| 635 | 585 | ||
| 636 | // Test invalidation metrics | 586 | // Test announcement invalidation metrics |
| 637 | metrics.record_invalidation(3); | 587 | metrics.record_rejected_invalidation("announcement", 3); |
| 638 | metrics.record_invalidation(2); | 588 | metrics.record_rejected_invalidation("announcement", 2); |
| 589 | |||
| 590 | // Test state hot cache metrics | ||
| 591 | metrics.update_rejected_hot_cache_size("state", 20); | ||
| 592 | metrics.record_rejected_hot_cache_hit("state"); | ||
| 593 | metrics.record_rejected_hot_cache_miss("state"); | ||
| 594 | metrics.record_rejected_hot_cache_expired("state", 3); | ||
| 595 | |||
| 596 | // Test state cold index metrics | ||
| 597 | metrics.update_rejected_cold_index_size("state", 50); | ||
| 598 | metrics.record_rejected_cold_index_expired("state", 5); | ||
| 599 | |||
| 600 | // Test state invalidation metrics | ||
| 601 | metrics.record_rejected_invalidation("state", 1); | ||
| 639 | } | 602 | } |
| 640 | } | 603 | } |