1use metrics::{describe_counter, describe_gauge, describe_histogram, Unit};
7
8pub const LABELS: &[(&str, &[&str])] = &[
27 ("state.requests", &["service", "type"]),
28 ("zcash.pool.value.zatoshis", &["name"]),
29 ("zcash.pool.notes.created", &["name"]),
30 ("zebra.state.rocksdb.cf_disk_size_bytes", &["cf"]),
31 ("zebra.state.rocksdb.cf_memory_size_bytes", &["cf"]),
32 ("zebra.state.rocksdb.num_files_at_level", &["level"]),
33 ("state.block_writer.phase.duration_seconds", &["phase"]),
34];
35
36pub fn describe() {
38 describe_counter!(
39 "state.requests",
40 Unit::Count,
41 "Requests to the state and read state services, by request type."
42 );
43
44 describe_gauge!(
46 "zcash.chain.verified.block.height",
47 Unit::Count,
48 "Height of the latest block committed to the state, by either verifier."
49 );
50 describe_counter!(
51 "zcash.chain.verified.block.total",
52 Unit::Count,
53 "Blocks committed to the state, by either verifier."
54 );
55
56 describe_gauge!(
58 "state.checkpoint.queued.max.height",
59 Unit::Count,
60 "Highest checkpoint-verified block height queued for the finalized state, or NaN when none are queued."
61 );
62 describe_gauge!(
63 "state.checkpoint.queued.block.count",
64 Unit::Count,
65 "Checkpoint-verified blocks queued for the finalized state."
66 );
67 describe_gauge!(
68 "state.checkpoint.sent.block.height",
69 Unit::Count,
70 "Height of the latest checkpoint-verified block sent to the block write task."
71 );
72 describe_counter!(
73 "state.checkpoint.finalized.block.count",
74 Unit::Count,
75 "Checkpoint-verified blocks committed to the finalized state."
76 );
77 describe_gauge!(
78 "state.checkpoint.finalized.block.height",
79 Unit::Count,
80 "Height of the latest checkpoint-verified block committed to the finalized state."
81 );
82 describe_counter!(
83 "state.checkpoint.error.block.count",
84 Unit::Count,
85 "Checkpoint-verified blocks that failed to commit to the finalized state."
86 );
87 describe_gauge!(
88 "state.checkpoint.error.block.height",
89 Unit::Count,
90 "Height of the latest checkpoint-verified block that failed to commit."
91 );
92
93 describe_counter!(
95 "state.full_verifier.committed.block.count",
96 Unit::Count,
97 "Fully verified blocks committed to the state."
98 );
99 describe_gauge!(
100 "state.full_verifier.committed.block.height",
101 Unit::Count,
102 "Height of the latest fully verified block committed to the state."
103 );
104
105 describe_counter!(
107 "state.memory.committed.block.count",
108 Unit::Count,
109 "Blocks committed to any chain in the non-finalized state."
110 );
111 describe_gauge!(
112 "state.memory.committed.block.height",
113 Unit::Count,
114 "Height of the latest block committed to any chain in the non-finalized state."
115 );
116 describe_counter!(
117 "state.memory.best.committed.block.count",
118 Unit::Count,
119 "Blocks committed to the best chain in the non-finalized state."
120 );
121 describe_gauge!(
122 "state.memory.best.committed.block.height",
123 Unit::Count,
124 "Height of the latest block committed to the best chain in the non-finalized state."
125 );
126 describe_gauge!(
127 "state.memory.chain.count",
128 Unit::Count,
129 "Chains in the non-finalized state."
130 );
131 describe_gauge!(
132 "state.memory.best.chain.length",
133 Unit::Count,
134 "Blocks in the best chain of the non-finalized state."
135 );
136 describe_gauge!(
137 "state.memory.index.entries",
138 Unit::Count,
139 "Blocks, transactions, transparent outputs and spends, and nullifiers indexed across all \
140 non-finalized chains, counting the blocks that chains share once."
141 );
142 describe_gauge!(
143 "state.memory.best.chain.index.entries",
144 Unit::Count,
145 "Blocks, transactions, transparent outputs and spends, and nullifiers indexed in the best \
146 non-finalized chain."
147 );
148 describe_counter!(
149 "state.memory.fork.evicted.count",
150 Unit::Count,
151 "Non-finalized forks dropped because the node tracked too many."
152 );
153 describe_gauge!(
154 "state.memory.backup.restored.block.count",
155 Unit::Count,
156 "Blocks restored from the non-finalized backup at startup."
157 );
158 describe_gauge!(
159 "state.memory.backup.restore.duration_seconds",
160 Unit::Seconds,
161 "Time taken to restore the non-finalized backup at startup."
162 );
163 describe_gauge!(
164 "zcash.pool.value.zatoshis",
165 Unit::Count,
166 "Value in each pool at the best chain tip, in zatoshis."
167 );
168 describe_gauge!(
169 "zcash.pool.notes.created",
170 Unit::Count,
171 "Note commitments in each shielded pool's tree at the best chain tip."
172 );
173
174 describe_gauge!(
176 "state.memory.queued.min.height",
177 Unit::Count,
178 "Lowest height of fully verified blocks waiting for their parent, or NaN when none are queued."
179 );
180 describe_gauge!(
181 "state.memory.queued.max.height",
182 Unit::Count,
183 "Highest height of fully verified blocks waiting for their parent, or NaN when none are queued."
184 );
185 describe_gauge!(
186 "state.memory.queued.block.count",
187 Unit::Count,
188 "Fully verified blocks waiting for their parent."
189 );
190 describe_counter!(
191 "state.memory.sent.block.count",
192 Unit::Count,
193 "Fully verified blocks sent to the block write task."
194 );
195 describe_gauge!(
196 "state.memory.sent.block.height",
197 Unit::Count,
198 "Height of the latest fully verified block sent to the block write task."
199 );
200 describe_gauge!(
201 "state.memory.sent.cache.min.height",
202 Unit::Count,
203 "Lowest height in the cache of sent blocks, or NaN when it is empty."
204 );
205 describe_gauge!(
206 "state.memory.sent.cache.max.height",
207 Unit::Count,
208 "Highest height in the cache of sent blocks, or NaN when it is empty."
209 );
210 describe_gauge!(
211 "state.memory.sent.cache.block.count",
212 Unit::Count,
213 "Blocks in the cache of sent blocks."
214 );
215 describe_gauge!(
216 "state.memory.sent.cache.batch.count",
217 Unit::Count,
218 "Batches in the cache of sent blocks."
219 );
220
221 describe_counter!(
223 "state.finalized.block.count",
224 Unit::Count,
225 "Blocks committed to the finalized state."
226 );
227 describe_gauge!(
228 "state.finalized.block.height",
229 Unit::Count,
230 "Height of the finalized tip."
231 );
232 describe_counter!(
233 "state.finalized.cumulative.transactions",
234 Unit::Count,
235 "Transactions in blocks committed to the finalized state."
236 );
237 describe_counter!(
238 "state.finalized.cumulative.sprout_nullifiers",
239 Unit::Count,
240 "Sprout nullifiers revealed by blocks committed to the finalized state."
241 );
242 describe_counter!(
243 "state.finalized.cumulative.sapling_nullifiers",
244 Unit::Count,
245 "Sapling nullifiers revealed by blocks committed to the finalized state."
246 );
247 describe_counter!(
248 "state.finalized.cumulative.orchard_nullifiers",
249 Unit::Count,
250 "Orchard nullifiers revealed by blocks committed to the finalized state."
251 );
252 describe_counter!(
253 "state.finalized.cumulative.transparent_prevouts",
254 Unit::Count,
255 "Transparent outputs spent by blocks committed to the finalized state, after genesis."
256 );
257 describe_counter!(
258 "state.finalized.cumulative.transparent_newouts",
259 Unit::Count,
260 "Transparent outputs created by blocks committed to the finalized state, after genesis."
261 );
262 describe_gauge!(
263 "state.finalized.value_pool.transparent",
264 Unit::Count,
265 "Transparent pool balance at the finalized tip, in zatoshis."
266 );
267 describe_gauge!(
268 "state.finalized.value_pool.sprout",
269 Unit::Count,
270 "Sprout pool balance at the finalized tip, in zatoshis."
271 );
272 describe_gauge!(
273 "state.finalized.value_pool.sapling",
274 Unit::Count,
275 "Sapling pool balance at the finalized tip, in zatoshis."
276 );
277 describe_gauge!(
278 "state.finalized.value_pool.orchard",
279 Unit::Count,
280 "Orchard pool balance at the finalized tip, in zatoshis."
281 );
282 describe_gauge!(
283 "state.finalized.value_pool.ironwood",
284 Unit::Count,
285 "Ironwood pool balance at the finalized tip, in zatoshis."
286 );
287 describe_gauge!(
288 "state.finalized.value_pool.deferred",
289 Unit::Count,
290 "Deferred lockbox pool balance at the finalized tip, in zatoshis."
291 );
292 describe_gauge!(
293 "state.finalized.chain_supply.total",
294 Unit::Count,
295 "Total value in all pools at the finalized tip, in zatoshis."
296 );
297
298 describe_histogram!(
299 "state.block_writer.phase.duration_seconds",
300 Unit::Seconds,
301 "Time each phase of committing a checkpoint-verified block to the finalized state took."
302 );
303
304 describe_histogram!(
306 "zebra.state.rocksdb.batch_commit.duration_seconds",
307 Unit::Seconds,
308 "Time taken to write one block's batch to RocksDB."
309 );
310 describe_gauge!(
311 "zebra.state.rocksdb.cf_disk_size_bytes",
312 Unit::Bytes,
313 "Disk space used by each RocksDB column family."
314 );
315 describe_gauge!(
316 "zebra.state.rocksdb.cf_memory_size_bytes",
317 Unit::Bytes,
318 "Memory used by each RocksDB column family's memtables."
319 );
320 describe_gauge!(
321 "zebra.state.rocksdb.total_disk_size_bytes",
322 Unit::Bytes,
323 "Disk space used by all RocksDB column families."
324 );
325 describe_gauge!(
326 "zebra.state.rocksdb.live_data_size_bytes",
327 Unit::Bytes,
328 "Estimated size of the live data in all RocksDB column families."
329 );
330 describe_gauge!(
331 "zebra.state.rocksdb.total_memory_size_bytes",
332 Unit::Bytes,
333 "Memory used by all RocksDB memtables."
334 );
335 describe_gauge!(
336 "zebra.state.rocksdb.compaction.pending_bytes",
337 Unit::Count,
338 "1 when RocksDB has at least one compaction pending, otherwise 0."
339 );
340 describe_gauge!(
341 "zebra.state.rocksdb.compaction.running",
342 Unit::Count,
343 "RocksDB compactions currently running."
344 );
345 describe_gauge!(
346 "zebra.state.rocksdb.block_cache_usage_bytes",
347 Unit::Bytes,
348 "Memory used by the RocksDB block cache."
349 );
350 describe_gauge!(
351 "zebra.state.rocksdb.num_files_at_level",
352 Unit::Count,
353 "RocksDB files at each level."
354 );
355}