@@ -157,7 +157,7 @@ mod write_tests {
157157 // assert logs have been written without decoding entries
158158 assert_metric (
159159 & get_metrics ( & env, canister_id) ,
160- "ii_archive_log_entries_count " ,
160+ "ii_archive_entries_count{source= \" log \" } " ,
161161 2 ,
162162 ) ;
163163 Ok ( ( ) )
@@ -504,15 +504,14 @@ mod metrics_tests {
504504 #[ test]
505505 fn should_return_metrics ( ) -> Result < ( ) , CallError > {
506506 let metrics = vec ! [
507- "ii_archive_last_upgrade_timestamp" ,
508- "ii_archive_log_entries_count" ,
509- "ii_archive_log_entries_size" ,
510- "ii_archive_log_index_memory_size" ,
511- "ii_archive_log_data_memory_size" ,
512- "ii_archive_anchor_index_entries_count" ,
513- "ii_archive_log_index_virtual_memory_size" ,
514- "ii_archive_log_data_virtual_memory_size" ,
515- "ii_archive_anchor_index_virtual_memory_size" ,
507+ "ii_archive_last_upgrade_timestamp_seconds" ,
508+ "ii_archive_entries_count{source=\" log\" }" ,
509+ "ii_archive_entries_count{source=\" anchor_index\" }" ,
510+ "ii_archive_log_bytes{type=\" entries\" }" ,
511+ "ii_archive_log_bytes{type=\" index\" }" ,
512+ "ii_archive_virtual_memory_pages{kind=\" log_index\" }" ,
513+ "ii_archive_virtual_memory_pages{kind=\" log_data\" }" ,
514+ "ii_archive_virtual_memory_pages{kind=\" anchor_index\" }" ,
516515 "ii_archive_stable_memory_pages" ,
517516 ] ;
518517 let env = StateMachine :: new ( ) ;
@@ -539,11 +538,11 @@ mod metrics_tests {
539538 let canister_id = install_archive_canister ( & env, ARCHIVE_WASM . clone ( ) ) ;
540539 assert_metric (
541540 & get_metrics ( & env, canister_id) ,
542- "ii_archive_last_upgrade_timestamp " ,
541+ "ii_archive_last_upgrade_timestamp_seconds " ,
543542 env. time ( )
544543 . duration_since ( SystemTime :: UNIX_EPOCH )
545544 . unwrap ( )
546- . as_nanos ( ) as u64 ,
545+ . as_secs ( ) as u64 ,
547546 ) ;
548547 println ! ( "{}" , get_metrics( & env, canister_id) ) ;
549548
@@ -553,11 +552,11 @@ mod metrics_tests {
553552 println ! ( "{}" , get_metrics( & env, canister_id) ) ;
554553 assert_metric (
555554 & get_metrics ( & env, canister_id) ,
556- "ii_archive_last_upgrade_timestamp " ,
555+ "ii_archive_last_upgrade_timestamp_seconds " ,
557556 env. time ( )
558557 . duration_since ( SystemTime :: UNIX_EPOCH )
559558 . unwrap ( )
560- . as_nanos ( ) as u64 ,
559+ . as_secs ( ) as u64 ,
561560 ) ;
562561 Ok ( ( ) )
563562 }
@@ -566,8 +565,8 @@ mod metrics_tests {
566565 #[ test]
567566 fn should_update_log_entries_count ( ) -> Result < ( ) , CallError > {
568567 let metrics = vec ! [
569- "ii_archive_log_entries_count " ,
570- "ii_archive_anchor_index_entries_count " ,
568+ "ii_archive_entries_count{source= \" log \" } " ,
569+ "ii_archive_entries_count{source= \" anchor_index \" } " ,
571570 ] ;
572571
573572 let env = StateMachine :: new ( ) ;
@@ -602,19 +601,14 @@ mod metrics_tests {
602601
603602 assert_metric (
604603 & get_metrics ( & env, canister_id) ,
605- "ii_archive_log_index_memory_size " ,
604+ "ii_archive_log_bytes{type= \" index \" } " ,
606605 INDEX_OVERHEAD , // empty index
607606 ) ;
608607 assert_metric (
609608 & get_metrics ( & env, canister_id) ,
610- "ii_archive_log_data_memory_size " ,
609+ "ii_archive_log_bytes{type= \" entries \" } " ,
611610 DATA_OVERHEAD , // empty log
612611 ) ;
613- assert_metric (
614- & get_metrics ( & env, canister_id) ,
615- "ii_archive_log_entries_size" ,
616- 0 , // size of actual entries
617- ) ;
618612
619613 let entry = candid:: encode_one ( log_entry_1 ( ) ) . expect ( "failed to encode entry" ) ;
620614 let entry_size = entry. len ( ) as u64 ;
@@ -629,20 +623,14 @@ mod metrics_tests {
629623
630624 assert_metric (
631625 & get_metrics ( & env, canister_id) ,
632- "ii_archive_log_index_memory_size " ,
626+ "ii_archive_log_bytes{type= \" index \" } " ,
633627 INDEX_OVERHEAD + 8 , // 8 bytes per entry
634628 ) ;
635629 assert_metric (
636630 & get_metrics ( & env, canister_id) ,
637- "ii_archive_log_data_memory_size " ,
631+ "ii_archive_log_bytes{type= \" entries \" } " ,
638632 DATA_OVERHEAD + entry_size,
639633 ) ;
640- assert_metric (
641- & get_metrics ( & env, canister_id) ,
642- "ii_archive_log_entries_size" ,
643- entry_size, // size of actual entries
644- ) ;
645-
646634 Ok ( ( ) )
647635 }
648636
@@ -657,17 +645,17 @@ mod metrics_tests {
657645
658646 assert_metric (
659647 & get_metrics ( & env, canister_id) ,
660- "ii_archive_log_index_virtual_memory_size " ,
648+ "ii_archive_virtual_memory_pages{kind= \" log_index \" } " ,
661649 1 ,
662650 ) ;
663651 assert_metric (
664652 & get_metrics ( & env, canister_id) ,
665- "ii_archive_log_data_virtual_memory_size " ,
653+ "ii_archive_virtual_memory_pages{kind= \" log_data \" } " ,
666654 1 ,
667655 ) ;
668656 assert_metric (
669657 & get_metrics ( & env, canister_id) ,
670- "ii_archive_anchor_index_virtual_memory_size " ,
658+ "ii_archive_virtual_memory_pages{kind= \" anchor_index \" } " ,
671659 1 ,
672660 ) ;
673661 assert_metric (
@@ -687,17 +675,17 @@ mod metrics_tests {
687675
688676 assert_metric (
689677 & get_metrics ( & env, canister_id) ,
690- "ii_archive_log_index_virtual_memory_size " ,
678+ "ii_archive_virtual_memory_pages{kind= \" log_index \" } " ,
691679 1 , // does not change because the index additions are small
692680 ) ;
693681 assert_metric (
694682 & get_metrics ( & env, canister_id) ,
695- "ii_archive_log_data_virtual_memory_size " ,
683+ "ii_archive_virtual_memory_pages{kind= \" log_data \" } " ,
696684 2 ,
697685 ) ;
698686 assert_metric (
699687 & get_metrics ( & env, canister_id) ,
700- "ii_archive_anchor_index_virtual_memory_size " ,
688+ "ii_archive_virtual_memory_pages{kind= \" anchor_index \" } " ,
701689 1 , // does not change because the index additions are small
702690 ) ;
703691 assert_metric (
0 commit comments