File tree 2 files changed +9
-0
lines changed
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,14 @@ pub fn download(req: &mut dyn RequestExt) -> EndpointResult {
22
22
23
23
let cache_key = ( crate_name. to_string ( ) , version. to_string ( ) ) ;
24
24
if let Some ( version_id) = app. version_id_cacher . get ( & cache_key) {
25
+ app. instance_metrics . version_id_cache_hits . inc ( ) ;
26
+
25
27
// The increment does not happen instantly, but it's deferred to be executed in a batch
26
28
// along with other downloads. See crate::downloads_counter for the implementation.
27
29
app. downloads_counter . increment ( version_id) ;
28
30
} else {
31
+ app. instance_metrics . version_id_cache_misses . inc ( ) ;
32
+
29
33
// When no database connection is ready unconditional redirects will be performed. This could
30
34
// happen if the pool is not healthy or if an operator manually configured the application to
31
35
// always perform unconditional redirects (for example as part of the mitigations for an
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ metrics! {
50
50
pub downloads_select_query_execution_time: Histogram ,
51
51
/// Number of download requests that are not counted yet.
52
52
downloads_not_counted_total: IntGauge ,
53
+
54
+ /// Number of version ID cache hits on the download endpoint.
55
+ pub version_id_cache_hits: IntCounter ,
56
+ /// Number of version ID cache misses on the download endpoint.
57
+ pub version_id_cache_misses: IntCounter ,
53
58
}
54
59
55
60
// All instance metrics will be prefixed with this namespace.
You can’t perform that action at this time.
0 commit comments