Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Sep 15, 2020
1 parent faa415f commit 791ace4
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn prometheus_metrics() -> warp::filters::log::Log<impl Fn(warp::filters::lo
// a block hash).
let path = {
let equals = |s: &'static str| -> Option<&'static str> {
if info.path() == &format!("/{}/{}/{}", API_PREFIX, API_VERSION, s) {
if info.path() == format!("/{}/{}/{}", API_PREFIX, API_VERSION, s) {
Some(s)
} else {
None
Expand All @@ -136,19 +136,19 @@ pub fn prometheus_metrics() -> warp::filters::log::Log<impl Fn(warp::filters::lo
};

equals("beacon/blocks")
.or(starts_with("validator/duties/attester"))
.or(starts_with("validator/duties/proposer"))
.or(starts_with("validator/attestation_data"))
.or(starts_with("validator/blocks"))
.or(starts_with("validator/aggregate_attestation"))
.or(starts_with("validator/aggregate_and_proofs"))
.or(starts_with("validator/beacon_committee_subscriptions"))
.or(starts_with("beacon/"))
.or(starts_with("config/"))
.or(starts_with("debug/"))
.or(starts_with("events/"))
.or(starts_with("node/"))
.or(starts_with("validator/"))
.or_else(|| starts_with("validator/duties/attester"))
.or_else(|| starts_with("validator/duties/proposer"))
.or_else(|| starts_with("validator/attestation_data"))
.or_else(|| starts_with("validator/blocks"))
.or_else(|| starts_with("validator/aggregate_attestation"))
.or_else(|| starts_with("validator/aggregate_and_proofs"))
.or_else(|| starts_with("validator/beacon_committee_subscriptions"))
.or_else(|| starts_with("beacon/"))
.or_else(|| starts_with("config/"))
.or_else(|| starts_with("debug/"))
.or_else(|| starts_with("events/"))
.or_else(|| starts_with("node/"))
.or_else(|| starts_with("validator/"))
.unwrap_or("other")
};

Expand All @@ -157,11 +157,7 @@ pub fn prometheus_metrics() -> warp::filters::log::Log<impl Fn(warp::filters::lo
&metrics::HTTP_API_STATUS_CODES_TOTAL,
&[&info.status().to_string()],
);
metrics::observe_timer_vec(
&metrics::HTTP_API_PATHS_TIMES_TOTAL,
&[path],
info.elapsed(),
);
metrics::observe_timer_vec(&metrics::HTTP_API_PATHS_TIMES, &[path], info.elapsed());
})
}

Expand Down

0 comments on commit 791ace4

Please sign in to comment.