@@ -3,8 +3,7 @@ use crate::observability::latency_guard::LatencyGuard;
33use opentelemetry:: metrics:: Histogram ;
44use opentelemetry:: { global, KeyValue } ;
55
6- #[ derive( Debug , Clone , Copy ) ]
7- pub ( crate ) enum IcebergPersistenceStage {
6+ enum PersistenceStage {
87 Overall ,
98 DataFiles ,
109 FileIndices ,
@@ -14,35 +13,71 @@ pub(crate) enum IcebergPersistenceStage {
1413
1514#[ derive( Debug ) ]
1615pub ( crate ) struct IcebergPersistenceStats {
16+ pub ( crate ) overall : IcebergPersistenceSingleStats ,
17+ pub ( crate ) sync_data_files : IcebergPersistenceSingleStats ,
18+ pub ( crate ) sync_file_indices : IcebergPersistenceSingleStats ,
19+ pub ( crate ) sync_deletion_vectors : IcebergPersistenceSingleStats ,
20+ pub ( crate ) transaction_commit : IcebergPersistenceSingleStats ,
21+ }
22+
23+ impl IcebergPersistenceStats {
24+ pub ( crate ) fn new ( mooncake_table_id : String ) -> Self {
25+ Self {
26+ overall : IcebergPersistenceSingleStats :: new (
27+ mooncake_table_id. to_string ( ) ,
28+ PersistenceStage :: Overall ,
29+ ) ,
30+ sync_data_files : IcebergPersistenceSingleStats :: new (
31+ mooncake_table_id. to_string ( ) ,
32+ PersistenceStage :: DataFiles ,
33+ ) ,
34+ sync_file_indices : IcebergPersistenceSingleStats :: new (
35+ mooncake_table_id. to_string ( ) ,
36+ PersistenceStage :: FileIndices ,
37+ ) ,
38+ sync_deletion_vectors : IcebergPersistenceSingleStats :: new (
39+ mooncake_table_id. to_string ( ) ,
40+ PersistenceStage :: DeletionVectors ,
41+ ) ,
42+ transaction_commit : IcebergPersistenceSingleStats :: new (
43+ mooncake_table_id. to_string ( ) ,
44+ PersistenceStage :: TransactionCommit ,
45+ ) ,
46+ }
47+ }
48+ }
49+
50+ #[ derive( Debug ) ]
51+ pub ( crate ) struct IcebergPersistenceSingleStats {
1752 mooncake_table_id : String ,
1853 latency : Histogram < u64 > ,
1954}
2055
21- impl IcebergPersistenceStats {
22- pub ( crate ) fn new ( mooncake_table_id : String , stats_type : IcebergPersistenceStage ) -> Self {
56+ impl IcebergPersistenceSingleStats {
57+ fn new ( mooncake_table_id : String , stats_type : PersistenceStage ) -> Self {
2358 let meter = global:: meter ( "iceberg_persistence" ) ;
2459 let latency = match stats_type {
25- IcebergPersistenceStage :: Overall => meter
60+ PersistenceStage :: Overall => meter
2661 . u64_histogram ( "snapshot_synchronization_latency" )
2762 . with_description ( "Latency (ms) for snapshot synchronization" )
2863 . with_boundaries ( vec ! [ 50.0 , 100.0 , 200.0 , 300.0 , 400.0 , 500.0 ] )
2964 . build ( ) ,
30- IcebergPersistenceStage :: DataFiles => meter
65+ PersistenceStage :: DataFiles => meter
3166 . u64_histogram ( "sync_data_files_latency" )
3267 . with_description ( "Latency (ms) for data files synchronization" )
3368 . with_boundaries ( vec ! [ 50.0 , 100.0 , 200.0 , 300.0 , 400.0 , 500.0 ] )
3469 . build ( ) ,
35- IcebergPersistenceStage :: FileIndices => meter
70+ PersistenceStage :: FileIndices => meter
3671 . u64_histogram ( "sync_file_indices_latency" )
3772 . with_description ( "Latency (ms) for file indices synchronization" )
3873 . with_boundaries ( vec ! [ 50.0 , 100.0 , 200.0 , 300.0 , 400.0 , 500.0 ] )
3974 . build ( ) ,
40- IcebergPersistenceStage :: DeletionVectors => meter
75+ PersistenceStage :: DeletionVectors => meter
4176 . u64_histogram ( "sync_deletion_vectors_latency" )
4277 . with_description ( "Latency (ms) for deletion vectors synchronization" )
4378 . with_boundaries ( vec ! [ 50.0 , 100.0 , 200.0 , 300.0 , 400.0 , 500.0 ] )
4479 . build ( ) ,
45- IcebergPersistenceStage :: TransactionCommit => meter
80+ PersistenceStage :: TransactionCommit => meter
4681 . u64_histogram ( "transaction_commit_latency" )
4782 . with_description ( "Latency (ms) for transaction commit" )
4883 . with_boundaries ( vec ! [ 50.0 , 100.0 , 200.0 , 300.0 , 400.0 , 500.0 ] )
@@ -56,7 +91,7 @@ impl IcebergPersistenceStats {
5691 }
5792}
5893
59- impl BaseLatencyExporter for IcebergPersistenceStats {
94+ impl BaseLatencyExporter for IcebergPersistenceSingleStats {
6095 fn start < ' a > ( & ' a self ) -> LatencyGuard < ' a > {
6196 LatencyGuard :: new ( self . mooncake_table_id . clone ( ) , self )
6297 }
0 commit comments