stratus/infra/metrics/
metrics_definitions.rs

1use crate::metrics;
2
3// JSON-RPC metrics.
4metrics! {
5    group: json_rpc,
6
7    "Number of JSON-RPC requests active right now."
8    gauge rpc_requests_active{},
9
10    "Number of JSON-RPC requests that started."
11    counter rpc_requests_started{client, method, contract, function, req_type},
12
13    "Number of JSON-RPC requests that finished."
14    histogram_duration rpc_requests_finished{client, method, contract, function, result, result_code, success},
15
16    "Number of JSON-RPC subscriptions active right now."
17    gauge rpc_subscriptions_active{subscription, client}
18}
19
20// Storage reads.
21metrics! {
22    group: storage_read,
23
24    "Time executing storage read_pending_block_number operation."
25    histogram_duration storage_read_pending_block_number{storage, success},
26
27    "Time executing storage read_mined_block_number operation."
28    histogram_duration storage_read_mined_block_number{storage, success},
29
30    "Time executing storage read_account operation."
31    histogram_duration storage_read_account{storage, point_in_time},
32
33    "Time executing storage read_block operation."
34    histogram_duration storage_read_block{storage, success},
35
36    "Time executing storage read_block_with_changes operation."
37    histogram_duration storage_read_block_with_changes{storage, success},
38
39    "Time executing storage read_logs operation."
40    histogram_duration storage_read_logs{storage, success},
41
42    "Time executing storage read_slot operation."
43    histogram_duration storage_read_slot{storage, point_in_time},
44
45    "Time executing storage read_transaction operation."
46    histogram_duration storage_read_transaction{storage, success},
47
48    "Time executing storage read_replication_log operation."
49    histogram_duration storage_read_replication_log{storage, success}
50}
51
52// Storage writes.
53metrics! {
54    group: storage_write,
55
56    "Time executing storage set_pending_block_number operation."
57    histogram_duration storage_set_pending_block_number{storage, success},
58
59    "Time executing storage set_mined_block_number operation."
60    histogram_duration storage_set_mined_block_number{storage, success},
61
62    "Time executing storage save_accounts operation."
63    histogram_duration storage_save_accounts{storage, success},
64
65    "Time executing storage save_account_changes operation."
66    histogram_duration storage_save_execution{storage, success},
67
68    "Time executing storage set_pending_external_block operation."
69    histogram_duration storage_set_pending_external_block{storage, success},
70
71    "Time executing storage finish_pending_block operation."
72    histogram_duration storage_finish_pending_block{storage, success},
73
74    "Time executing storage save_block operation."
75    histogram_duration storage_save_block{storage, size_by_tx, size_by_gas, success},
76
77    "Time executing storage reset operation."
78    histogram_duration storage_reset{storage, success},
79
80    "Time executing storage apply_replication_log operation."
81    histogram_duration storage_apply_replication_log{storage, success}
82}
83
84// Importer online metrics.
85metrics! {
86    group: importer_online,
87
88    "Time to import one block."
89    histogram_duration import_online_mined_block{},
90
91    "Number of transactions imported."
92    counter importer_online_transactions_total{}
93}
94
95// Execution metrics.
96metrics! {
97    group: executor,
98
99    "Time executing and persist an external block with all transactions."
100    histogram_duration executor_external_block{},
101
102    "Time executing an external transaction."
103    histogram_duration executor_external_transaction{contract, function},
104
105    "Number of account reads executing an external transaction."
106    histogram_counter executor_external_transaction_account_reads{contract, function},
107
108    "Number of slot reads executing an external transaction."
109    histogram_counter executor_external_transaction_slot_reads{contract, function},
110
111    "Gas spent executing an external transaction."
112    histogram_counter executor_external_transaction_gas{contract, function},
113
114    "Number of account reads when importing an external block."
115    histogram_counter executor_external_block_account_reads{},
116
117    "Number of slot reads when importing an external block."
118    histogram_counter executor_external_block_slot_reads{},
119
120    "Time executing a local transaction."
121    histogram_duration executor_local_transaction{success, contract, function},
122
123    "Time executing a local transaction."
124    counter executor_local_transaction_reverts{contract, function, reason},
125
126    "Number of account reads when executing a local transaction."
127    histogram_counter executor_local_transaction_account_reads{contract, function},
128
129    "Number of slot reads when executing a local transaction."
130    histogram_counter executor_local_transaction_slot_reads{contract, function},
131
132    "Gas spent executing a local transaction."
133    histogram_counter executor_local_transaction_gas{success, contract, function},
134
135    "Time executing a transaction received with eth_call or eth_estimateGas."
136    histogram_duration executor_local_call{success, contract, function},
137
138    "Number of account reads when executing a local call."
139    histogram_counter executor_local_call_account_reads{contract, function},
140
141    "Number of slot reads when executing a local call."
142    histogram_counter executor_local_call_slot_reads{contract, function},
143
144    "Gas spent executing a local call."
145    histogram_counter executor_local_call_gas{contract, function}
146}
147
148metrics! {
149    group: evm,
150
151    "Time executing EVM execution."
152    histogram_duration evm_execution{point_in_time, success},
153
154    "Number of accounts read in a single EVM execution."
155    histogram_counter evm_execution_account_reads{},
156
157    "Number of slots read in a single EVM execution."
158    histogram_counter evm_execution_slot_reads{},
159
160    "Time executing trace_transaction"
161    histogram_duration evm_inspect{trace_type}
162}
163
164metrics! {
165    group: rocks,
166
167    "Number of issued gets to rocksdb."
168    gauge rocks_db_get{dbname},
169
170    "Number of writes issued to rocksdb."
171    gauge rocks_db_write{dbname},
172
173    "Time spent compacting data."
174    gauge rocks_compaction_time{dbname},
175
176    "CPU time spent compacting data."
177    gauge rocks_compaction_cpu_time{dbname},
178
179    "Time spent flushing memtable to disk."
180    gauge rocks_flush_time{dbname},
181
182    "Number of block cache misses."
183    gauge rocks_block_cache_miss{dbname},
184
185    "Number of block cache hits."
186    gauge rocks_block_cache_hit{dbname},
187
188    "Number of bytes written."
189    gauge rocks_bytes_written{dbname},
190
191    "Number of bytes read."
192    gauge rocks_bytes_read{dbname},
193
194    "Number of times WAL sync is done."
195    gauge rocks_wal_file_synced{dbname},
196
197    "Last startup delay."
198    gauge rocks_last_startup_delay_millis{dbname},
199
200    "Last shutdown delay."
201    gauge rocks_last_shutdown_delay_millis{dbname},
202
203    "Approximate size of active memtable (bytes)."
204    gauge rocks_cur_size_active_mem_table{dbname},
205
206    "Approximate size of active and unflushed immutable memtables (bytes)."
207    gauge rocks_cur_size_all_mem_tables{dbname},
208
209    "Approximate of active, unflushed immutable, and pinned immutable memtables (bytes)."
210    gauge rocks_size_all_mem_tables{dbname},
211
212    "Memory size for the entries residing in block cache."
213    gauge rocks_block_cache_usage{dbname},
214
215    "Block cache capacity."
216    gauge rocks_block_cache_capacity{dbname},
217
218    "Accumulated number of background errors."
219    gauge rocks_background_errors{dbname},
220
221    "Size of column family on disk (bytes)."
222    gauge rocks_cf_size{dbname, cfname}
223}
224
225metrics! {
226    group: consensus,
227
228    "Time to run Consensus::forward."
229    histogram_duration consensus_forward{},
230
231    "The readiness of Stratus."
232    gauge consensus_is_ready{}
233}
234
235// Kafka Metrics
236metrics! {
237    group: kafka,
238
239    "Time to run KafkaConnector::queue_event"
240    histogram_duration kafka_queue_event{},
241
242    "Time to run KafkaConnector::send_buffered"
243    histogram_duration kafka_send_buffered{},
244
245    "Time to run KafkaConnector::create_buffer"
246    histogram_duration kafka_create_buffer{}
247}