Skip to content

Commit a722f21

Browse files
authored
metrics: fix docsrs_prioritized_crates_count (#810)
The metric was including failed crates, and didn't consider that the priority is stored with the wrong sign in the database (a positive priority means a negative priority, for whatever reason).
1 parent 8413226 commit a722f21

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/web/metrics.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,12 @@ pub fn metrics_handler(req: &mut Request) -> IronResult<Response> {
124124
.get(0),
125125
);
126126
PRIORITIZED_CRATES_COUNT.set(
127-
ctry!(conn.query("SELECT COUNT(*) FROM queue WHERE priority >= 0;", &[]))
128-
.get(0)
129-
.get(0),
127+
ctry!(conn.query(
128+
"SELECT COUNT(*) FROM queue WHERE attempts < 5 AND priority <= 0;",
129+
&[]
130+
))
131+
.get(0)
132+
.get(0),
130133
);
131134
FAILED_CRATES_COUNT.set(
132135
ctry!(conn.query("SELECT COUNT(*) FROM queue WHERE attempt >= 5;", &[]))

0 commit comments

Comments
 (0)