1use metrics::{describe_counter, describe_gauge, describe_histogram, Unit};
7
8pub const LABELS: &[(&str, &[&str])] = &[
16 ("rpc.requests.total", &["method", "status"]),
17 ("rpc.request.duration_seconds", &["method"]),
18 ("rpc.errors.total", &["method", "error_code"]),
19 ("rpc.submitblock.outcomes.total", &["outcome"]),
20];
21
22pub fn describe() {
24 describe_counter!(
25 "rpc.requests.total",
26 Unit::Count,
27 "JSON-RPC requests handled, by method and status."
28 );
29 describe_histogram!(
30 "rpc.request.duration_seconds",
31 Unit::Seconds,
32 "Time taken to handle a JSON-RPC request."
33 );
34 describe_gauge!(
35 "rpc.active_requests",
36 Unit::Count,
37 "JSON-RPC requests currently being handled."
38 );
39 describe_histogram!(
40 "rpc.getblocktemplate.build.duration_seconds",
41 Unit::Seconds,
42 "Time taken to select transactions and build a block template, including the coinbase."
43 );
44 describe_histogram!(
45 "rpc.getblocktemplate.first_template.duration_seconds",
46 Unit::Seconds,
47 "Time from a new best chain tip until the first block template on it was served."
48 );
49 describe_counter!(
50 "rpc.submitblock.outcomes.total",
51 Unit::Count,
52 "Blocks submitted with submitblock, by their zcashd-compatible result."
53 );
54 describe_counter!(
55 "rpc.errors.total",
56 Unit::Count,
57 "JSON-RPC requests that returned an error, by method and error code."
58 );
59}