File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 10
10
//! As a rule of thumb, if the metric is not straight up fetched from the database it's probably an
11
11
//! instance-level metric, and you should add it to `src/metrics/instance.rs`.
12
12
13
- use crate :: schema:: { crates, versions} ;
13
+ use crate :: schema:: { background_jobs , crates, versions} ;
14
14
use crate :: util:: errors:: AppResult ;
15
15
use diesel:: { dsl:: count_star, prelude:: * , PgConnection } ;
16
16
use prometheus:: { proto:: MetricFamily , IntGauge } ;
@@ -21,6 +21,8 @@ metrics! {
21
21
crates_total: IntGauge ,
22
22
/// Number of versions ever published
23
23
versions_total: IntGauge ,
24
+ /// Number of queued up background jobs
25
+ background_jobs: IntGauge ,
24
26
}
25
27
26
28
// All service metrics will be prefixed with this namespace.
@@ -33,6 +35,8 @@ impl ServiceMetrics {
33
35
. set ( crates:: table. select ( count_star ( ) ) . first ( conn) ?) ;
34
36
self . versions_total
35
37
. set ( versions:: table. select ( count_star ( ) ) . first ( conn) ?) ;
38
+ self . background_jobs
39
+ . set ( background_jobs:: table. select ( count_star ( ) ) . first ( conn) ?) ;
36
40
37
41
Ok ( self . registry . gather ( ) )
38
42
}
You can’t perform that action at this time.
0 commit comments