@@ -26,6 +26,18 @@ def to_format(self, value):
26
26
'stake' : Metric ('validator_stake' , 'Validator stake' , 'gauge' ),
27
27
'celldb_gc_block' : Metric ('validator_celldb_gc_block' , 'Celldb GC block latency' , 'gauge' ),
28
28
'celldb_gc_state' : Metric ('validator_celldb_gc_state' , 'Celldb GC queue size' , 'gauge' ),
29
+ 'collated_master_ok' : Metric ('validator_blocks_collated_master_ok' , 'Number of masterchain blocks successfully collated' , 'gauge' ),
30
+ 'collated_master_err' : Metric ('validator_blocks_collated_master_err' , 'Number of masterchain blocks failed to collate' , 'gauge' ),
31
+ 'collated_shard_ok' : Metric ('validator_blocks_collated_shard_ok' , 'Number of shardchain blocks successfully collated' , 'gauge' ),
32
+ 'collated_shard_err' : Metric ('validator_blocks_collated_shard_err' , 'Number of shardchain blocks failed to collate' , 'gauge' ),
33
+ 'validated_master_ok' : Metric ('validator_blocks_validated_master_ok' , 'Number of masterchain blocks successfully validated' , 'gauge' ),
34
+ 'validated_master_err' : Metric ('validator_blocks_validated_master_err' , 'Number of masterchain blocks failed to validate' , 'gauge' ),
35
+ 'validated_shard_ok' : Metric ('validator_blocks_validated_shard_ok' , 'Number of shardchain blocks successfully validated' , 'gauge' ),
36
+ 'validated_shard_err' : Metric ('validator_blocks_validated_shard_err' , 'Number of shardchain blocks failed to validate' , 'gauge' ),
37
+ 'validator_groups_master' : Metric ('validator_active_groups_master' , 'Number of masterchain validation groups validator participates in' , 'gauge' ),
38
+ 'validator_groups_shard' : Metric ('validator_active_groups_shard' , 'Number of shardchain validation groups validator participates in' , 'gauge' ),
39
+ 'ls_queries_ok' : Metric ('validator_ls_queries_ok' , 'Number of Liteserver successful queries' , 'gauge' ),
40
+ 'ls_queries_err' : Metric ('validator_ls_queries_err' , 'Number of Liteserver failed queries' , 'gauge' ),
29
41
}
30
42
31
43
@@ -44,7 +56,7 @@ def get_validator_status_metrics(self, result: list):
44
56
result .append (METRICS ['master_out_of_sync' ].to_format (status .masterchain_out_of_sync ))
45
57
if status .shardchain_out_of_sync is not None :
46
58
result .append (METRICS ['shard_out_of_sync' ].to_format (status .shardchain_out_of_sync ))
47
- if status .masterchain_out_of_ser is not None and status .stateserializermasterchainseqno != 0 :
59
+ if status .stateserializerenabled and status . masterchain_out_of_ser is not None and status .stateserializermasterchainseqno != 0 :
48
60
result .append (METRICS ['out_of_ser' ].to_format (status .masterchain_out_of_ser ))
49
61
if status .masterchainblock is not None and status .gcmasterchainblock is not None :
50
62
result .append (METRICS ['celldb_gc_block' ].to_format (status .masterchainblock - status .gcmasterchainblock ))
@@ -53,6 +65,9 @@ def get_validator_status_metrics(self, result: list):
53
65
result .append (METRICS ['celldb_gc_state' ].to_format (status .gcmasterchainblock - status .last_deleted_mc_state ))
54
66
else :
55
67
result .append (METRICS ['celldb_gc_state' ].to_format (- 1 ))
68
+ if status .validator_groups_master is not None :
69
+ result .append (METRICS ['validator_groups_master' ].to_format (status .validator_groups_master ))
70
+ result .append (METRICS ['validator_groups_shard' ].to_format (status .validator_groups_shard ))
56
71
result .append (METRICS ['vc_up' ].to_format (int (is_working )))
57
72
58
73
def get_validator_validation_metrics (self , result : list ):
@@ -67,6 +82,25 @@ def get_validator_validation_metrics(self, result: list):
67
82
if stake :
68
83
result .append (METRICS ['stake' ].to_format (round (stake , 2 )))
69
84
85
+ def get_node_stats_metrics (self , result : list ):
86
+ stats = self .ton .get_node_statistics ()
87
+ if stats and 'ls_queries' in stats :
88
+ if stats ['ls_queries' ]['time' ] < 50 :
89
+ self .local .add_log (f'Liteserver queries time is too low: { stats } ' )
90
+ return
91
+ result .append (METRICS ['ls_queries_ok' ].to_format (stats ['ls_queries' ]['ok' ]))
92
+ result .append (METRICS ['ls_queries_err' ].to_format (stats ['ls_queries' ]['error' ]))
93
+ if stats and 'collated' in stats :
94
+ result .append (METRICS ['collated_master_ok' ].to_format (stats ['collated' ]['master' ]['ok' ]))
95
+ result .append (METRICS ['collated_master_err' ].to_format (stats ['collated' ]['master' ]['error' ]))
96
+ result .append (METRICS ['collated_shard_ok' ].to_format (stats ['collated' ]['shard' ]['ok' ]))
97
+ result .append (METRICS ['collated_shard_err' ].to_format (stats ['collated' ]['shard' ]['error' ]))
98
+ if stats and 'validated' in stats :
99
+ result .append (METRICS ['validated_master_ok' ].to_format (stats ['validated' ]['master' ]['ok' ]))
100
+ result .append (METRICS ['validated_master_err' ].to_format (stats ['validated' ]['master' ]['error' ]))
101
+ result .append (METRICS ['validated_shard_ok' ].to_format (stats ['validated' ]['shard' ]['ok' ]))
102
+ result .append (METRICS ['validated_shard_err' ].to_format (stats ['validated' ]['shard' ]['error' ]))
103
+
70
104
def push_metrics (self ):
71
105
if not self .ton .using_prometheus ():
72
106
return
@@ -77,6 +111,7 @@ def push_metrics(self):
77
111
metrics = []
78
112
self .local .try_function (self .get_validator_status_metrics , args = [metrics ])
79
113
self .local .try_function (self .get_validator_validation_metrics , args = [metrics ])
114
+ self .local .try_function (self .get_node_stats_metrics , args = [metrics ])
80
115
requests .post (url , data = '\n ' .join (metrics ).encode ())
81
116
82
117
def add_console_commands (self , console ):
0 commit comments