1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 01:43:29 +01:00

Trace Prometheus' metrics requests

This commit is contained in:
Roman Zeyde 2018-11-18 14:11:41 +02:00
parent 82c3ce270e
commit c51aac74f7
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB
2 changed files with 5 additions and 1 deletions

View File

@ -90,6 +90,7 @@ fn handle_request(
prometheus::TextEncoder::new() prometheus::TextEncoder::new()
.encode(&reg.gather(), &mut buffer) .encode(&reg.gather(), &mut buffer)
.unwrap(); .unwrap();
trace!("metrics: {:?} -> {} bytes", request, buffer.len());
let response = tiny_http::Response::from_data(buffer); let response = tiny_http::Response::from_data(buffer);
request.respond(response) request.respond(response)
} }

View File

@ -585,7 +585,10 @@ fn handle_request(
}; };
let proof = query.get_merkle_proof(&hash, &status.block_hash.unwrap())?; let proof = query.get_merkle_proof(&hash, &status.block_hash.unwrap())?;
let ttl = ttl_by_depth(status.block_height, query); 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)) => { (&Method::GET, Some(&"tx"), Some(hash), Some(&"outspend"), Some(index)) => {
let hash = Sha256dHash::from_hex(hash)?; let hash = Sha256dHash::from_hex(hash)?;