From c51aac74f77fe6a62033cb2b9d47492483ed2fb2 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sun, 18 Nov 2018 14:11:41 +0200 Subject: [PATCH] Trace Prometheus' metrics requests --- src/metrics.rs | 1 + src/rest.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/metrics.rs b/src/metrics.rs index c735660..31666f6 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -90,6 +90,7 @@ fn handle_request( prometheus::TextEncoder::new() .encode(®.gather(), &mut buffer) .unwrap(); + trace!("metrics: {:?} -> {} bytes", request, buffer.len()); let response = tiny_http::Response::from_data(buffer); request.respond(response) } diff --git a/src/rest.rs b/src/rest.rs index 2349c94..dab3ee6 100644 --- a/src/rest.rs +++ b/src/rest.rs @@ -585,7 +585,10 @@ fn handle_request( }; let proof = query.get_merkle_proof(&hash, &status.block_hash.unwrap())?; let ttl = ttl_by_depth(status.block_height, query); - json_response(json!({ "block_height": status.block_height, "merkle": proof.0, "pos": proof.1 }), ttl) + json_response( + json!({ "block_height": status.block_height, "merkle": proof.0, "pos": proof.1 }), + ttl, + ) } (&Method::GET, Some(&"tx"), Some(hash), Some(&"outspend"), Some(index)) => { let hash = Sha256dHash::from_hex(hash)?;