Skip to content

Commit 674fb79

Browse files
committed
track uncounted downloads
1 parent 92ca57a commit 674fb79

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/downloads_counter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ impl DownloadsCounter {
199199
pub fn shards_count(&self) -> usize {
200200
self.inner.shards().len()
201201
}
202+
203+
pub(crate) fn pending_count(&self) -> i64 {
204+
self.pending_count.load(Ordering::SeqCst)
205+
}
202206
}
203207

204208
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq)]

src/metrics/instance.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ metrics! {
4444
pub downloads_unconditional_redirects_total: IntCounter,
4545
/// Number of download requests with a non-canonical crate name.
4646
pub downloads_non_canonical_crate_name_total: IntCounter,
47+
/// Number of download requests that are not counted yet.
48+
downloads_not_counted_total: IntGauge,
4749
}
4850

4951
// All instance metrics will be prefixed with this namespace.
@@ -58,6 +60,9 @@ impl InstanceMetrics {
5860
self.refresh_pool_stats("follower", follower)?;
5961
}
6062

63+
self.downloads_not_counted_total
64+
.set(app.downloads_counter.pending_count());
65+
6166
Ok(self.registry.gather())
6267
}
6368

0 commit comments

Comments
 (0)