File tree 2 files changed +13
-2
lines changed 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ struct ProjectStateChannel {
90
90
receiver : Shared < oneshot:: Receiver < Arc < ProjectState > > > ,
91
91
deadline : Instant ,
92
92
no_cache : bool ,
93
+ attempts : u64 ,
93
94
}
94
95
95
96
impl ProjectStateChannel {
@@ -101,6 +102,7 @@ impl ProjectStateChannel {
101
102
receiver : receiver. shared ( ) ,
102
103
deadline : Instant :: now ( ) + timeout,
103
104
no_cache : false ,
105
+ attempts : 0 ,
104
106
}
105
107
}
106
108
@@ -196,7 +198,10 @@ impl UpstreamProjectSource {
196
198
let requests: Vec < _ > = ( cache_batches. into_iter ( ) )
197
199
. chain ( nocache_batches. into_iter ( ) )
198
200
. map ( |channels_batch| {
199
- let channels_batch: BTreeMap < _ , _ > = channels_batch. collect ( ) ;
201
+ let mut channels_batch: BTreeMap < _ , _ > = channels_batch. collect ( ) ;
202
+ for channel in channels_batch. values_mut ( ) {
203
+ channel. attempts += 1 ;
204
+ }
200
205
relay_log:: debug!( "sending request of size {}" , channels_batch. len( ) ) ;
201
206
metric ! (
202
207
histogram( RelayHistograms :: ProjectStateRequestBatchSize ) =
@@ -261,7 +266,10 @@ impl UpstreamProjectSource {
261
266
Some ( ProjectState :: err ( ) )
262
267
} )
263
268
. unwrap_or_else ( ProjectState :: missing) ;
264
-
269
+ metric ! (
270
+ histogram( RelayHistograms :: ProjectStateAttempts ) =
271
+ channel. attempts
272
+ ) ;
265
273
channel. send ( state. sanitize ( ) ) ;
266
274
}
267
275
}
Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ pub enum RelayHistograms {
89
89
///
90
90
/// See `project_cache.size` for more description of the project cache.
91
91
ProjectStateReceived ,
92
+ /// Number of attempts required to fetch the config for a given project key.
93
+ ProjectStateAttempts ,
92
94
/// Number of project states currently held in the in-memory project cache.
93
95
///
94
96
/// The cache duration for project states can be configured with the following options:
@@ -150,6 +152,7 @@ impl HistogramMetric for RelayHistograms {
150
152
RelayHistograms :: RequestSizeBytesRaw => "event.size_bytes.raw" ,
151
153
RelayHistograms :: RequestSizeBytesUncompressed => "event.size_bytes.uncompressed" ,
152
154
RelayHistograms :: ProjectStatePending => "project_state.pending" ,
155
+ RelayHistograms :: ProjectStateAttempts => "project_state.attempts" ,
153
156
RelayHistograms :: ProjectStateRequestBatchSize => "project_state.request.batch_size" ,
154
157
RelayHistograms :: ProjectStateReceived => "project_state.received" ,
155
158
RelayHistograms :: ProjectStateCacheSize => "project_cache.size" ,
You can’t perform that action at this time.
0 commit comments