Unverified Commit 182aba84 authored by Roman Zeyde's avatar Roman Zeyde
Browse files

Prefix Prometheus metrics with 'electrs_'

parent b2b7e1c4
......@@ -41,16 +41,19 @@ impl Parser {
current_headers: load_headers(daemon)?,
indexed_blockhashes: Mutex::new(indexed_blockhashes),
duration: metrics.histogram_vec(
HistogramOpts::new("parse_duration", "blk*.dat parsing duration (in seconds)"),
HistogramOpts::new(
"electrs_parse_duration",
"blk*.dat parsing duration (in seconds)",
),
&["step"],
),
block_count: metrics.counter_vec(
MetricOpts::new("parse_blocks", "# of block parsed (from blk*.dat)"),
MetricOpts::new("electrs_parse_blocks", "# of block parsed (from blk*.dat)"),
&["type"],
),
bytes_read: metrics.histogram(HistogramOpts::new(
"parse_bytes_read",
"electrs_parse_bytes_read",
"# of bytes read (from blk*.dat)",
)),
}))
......
......@@ -311,12 +311,12 @@ impl Daemon {
message_id: Counter::new(),
signal: signal.clone(),
latency: metrics.histogram_vec(
HistogramOpts::new("daemon_rpc", "Bitcoind RPC latency (in seconds)"),
HistogramOpts::new("electrs_daemon_rpc", "Bitcoind RPC latency (in seconds)"),
&["method"],
),
// TODO: use better buckets (e.g. 1 byte to 10MB).
size: metrics.histogram_vec(
HistogramOpts::new("daemon_bytes", "Bitcoind RPC size (in bytes)"),
HistogramOpts::new("electrs_daemon_bytes", "Bitcoind RPC size (in bytes)"),
&["method", "dir"],
),
};
......
......@@ -275,15 +275,24 @@ struct Stats {
impl Stats {
fn new(metrics: &Metrics) -> Stats {
Stats {
blocks: metrics.counter(MetricOpts::new("index_blocks", "# of indexed blocks")),
txns: metrics.counter(MetricOpts::new("index_txns", "# of indexed transactions")),
vsize: metrics.counter(MetricOpts::new("index_vsize", "# of indexed vbytes")),
blocks: metrics.counter(MetricOpts::new(
"electrs_index_blocks",
"# of indexed blocks",
)),
txns: metrics.counter(MetricOpts::new(
"electrs_index_txns",
"# of indexed transactions",
)),
vsize: metrics.counter(MetricOpts::new(
"electrs_index_vsize",
"# of indexed vbytes",
)),
height: metrics.gauge(MetricOpts::new(
"index_height",
"electrs_index_height",
"Last indexed block's height",
)),
duration: metrics.histogram_vec(
HistogramOpts::new("index_duration", "indexing duration (in seconds)"),
HistogramOpts::new("electrs_index_duration", "indexing duration (in seconds)"),
&["step"],
),
}
......
......@@ -153,16 +153,19 @@ impl Tracker {
histogram: vec![],
stats: Stats {
count: metrics.gauge(MetricOpts::new(
"mempool_count",
"electrs_mempool_count",
"# of mempool transactions",
)),
update: metrics.histogram_vec(
HistogramOpts::new("mempool_update", "Time to update mempool (in seconds)"),
HistogramOpts::new(
"electrs_mempool_update",
"Time to update mempool (in seconds)",
),
&["step"],
),
vsize: metrics.gauge_vec(
MetricOpts::new(
"mempool_vsize",
"electrs_mempool_vsize",
"Total vsize of transactions paying at most given fee rate",
),
&["fee_rate"],
......
......@@ -125,14 +125,20 @@ fn parse_stats() -> Result<Stats> {
fn start_process_exporter(metrics: &Metrics) {
let rss = metrics.gauge(MetricOpts::new(
"process_memory_rss",
"electrs_process_memory_rss",
"Resident memory size [bytes]",
));
let cpu = metrics.gauge_vec(
MetricOpts::new("process_cpu_usage", "CPU usage by this process [seconds]"),
MetricOpts::new(
"electrs_process_cpu_usage",
"CPU usage by this process [seconds]",
),
&["type"],
);
let fds = metrics.gauge(MetricOpts::new("process_fs_fds", "# of file descriptors"));
let fds = metrics.gauge(MetricOpts::new(
"electrs_process_open_fds",
"# of file descriptors",
));
spawn_thread("exporter", move || loop {
match parse_stats() {
Ok(stats) => {
......
......@@ -522,11 +522,11 @@ impl RPC {
pub fn start(addr: SocketAddr, query: Arc<Query>, metrics: &Metrics) -> RPC {
let stats = Arc::new(Stats {
latency: metrics.histogram_vec(
HistogramOpts::new("electrum_rpc", "Electrum RPC latency (seconds)"),
HistogramOpts::new("electrs_electrum_rpc", "Electrum RPC latency (seconds)"),
&["method"],
),
subscriptions: metrics.gauge(MetricOpts::new(
"electrum_subscriptions",
"electrs_electrum_subscriptions",
"# of Electrum subscriptions",
)),
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment