@@ -65,14 +65,14 @@ public long absoluteTimeInMillis() {
6565 public static final HttpResponseInterceptor METERING_INTERCEPTOR = response -> {
6666 var stats = getThreadLocal ();
6767 var code = response .getStatusCode ();
68- stats .reqAtt += 1 ;
69- stats .isLastReqSuccess = true ;
68+ stats .requestAttempts += 1 ;
69+ stats .isLastRequestSucceed = true ;
7070 if (((code >= 200 && code < 300 ) || code == 308 || code == 404 ) == false ) {
71- stats .reqErr += 1 ;
72- stats .isLastReqSuccess = false ;
71+ stats .requestError += 1 ;
72+ stats .isLastRequestSucceed = false ;
7373 switch (code ) {
74- case 416 -> stats .reqErrRange += 1 ;
75- case 429 -> stats .reqErrThrottle += 1 ;
74+ case 416 -> stats .requestRangeError += 1 ;
75+ case 429 -> stats .requestThrottle += 1 ;
7676 }
7777 }
7878 };
@@ -167,9 +167,6 @@ public void finishRunnable(OperationStats stats, IORunnable runnable) throws IOE
167167 }
168168 }
169169
170- /**
171- * Continue collecting metrics with given OperationStats. Useful for readers and writers.
172- */
173170 public void collectIORunnable (OperationPurpose purpose , StorageOperation operation , IORunnable runnable ) throws IOException {
174171 var stats = initAndGetThreadLocal (purpose , operation );
175172 var t = timer .absoluteTimeInMillis ();
@@ -193,9 +190,6 @@ public void collectRunnable(OperationPurpose purpose, StorageOperation operation
193190 }
194191 }
195192
196- /**
197- * Executes GCS Storage operation in a wrapper that stores metrics in ThreadLocal
198- */
199193 public <T > T collectIOSupplier (OperationPurpose purpose , StorageOperation operation , IOSupplier <T > blobFn ) throws IOException {
200194 var t = timer .absoluteTimeInMillis ();
201195 var stats = initAndGetThreadLocal (purpose , operation );
@@ -208,9 +202,6 @@ public <T> T collectIOSupplier(OperationPurpose purpose, StorageOperation operat
208202 }
209203 }
210204
211- /**
212- * Executes GCS Storage operation in a wrapper that stores metrics in ThreadLocal
213- */
214205 public <T > T collectSupplier (OperationPurpose purpose , StorageOperation operation , Supplier <T > blobFn ) {
215206 var t = timer .absoluteTimeInMillis ();
216207 var stats = initAndGetThreadLocal (purpose , operation );
@@ -224,28 +215,28 @@ public <T> T collectSupplier(OperationPurpose purpose, StorageOperation operatio
224215 }
225216
226217 private void collect (OperationStats stats ) {
227- if (stats .reqAtt == 0 ) {
218+ if (stats .requestAttempts == 0 ) {
228219 return ; // nothing happened
229220 }
230221 var purpose = stats .purpose ;
231222 var operation = stats .operation ;
232- var operationSuccess = stats .isLastReqSuccess ? 1 : 0 ;
233- var operationErr = stats .isLastReqSuccess ? 0 : 1 ;
223+ var operationSuccess = stats .isLastRequestSucceed ? 1 : 0 ;
224+ var operationError = stats .isLastRequestSucceed ? 0 : 1 ;
234225 var collector = collectors .get (purpose ).get (operation );
235226 assert collector != null ;
236227 collector .operations .add (operationSuccess );
237- collector .requests .add (stats .reqAtt );
228+ collector .requests .add (stats .requestAttempts );
238229
239230 var attr = telemetryAttributes .get (purpose ).get (operation );
240231 assert attr != null ;
241232 telemetry .operationCounter ().incrementBy (operationSuccess , attr );
242- telemetry .unsuccessfulOperationCounter ().incrementBy (operationErr , attr );
243- telemetry .requestCounter ().incrementBy (stats .reqAtt , attr );
244- telemetry .exceptionCounter ().incrementBy (stats .reqErr , attr );
245- telemetry .exceptionHistogram ().record (stats .reqErr , attr );
246- telemetry .throttleCounter ().incrementBy (stats .reqErrThrottle , attr );
247- telemetry .throttleHistogram ().record (stats .reqErrThrottle , attr );
248- telemetry .requestRangeNotSatisfiedExceptionCounter ().incrementBy (stats .reqErrRange , attr );
233+ telemetry .unsuccessfulOperationCounter ().incrementBy (operationError , attr );
234+ telemetry .requestCounter ().incrementBy (stats .requestAttempts , attr );
235+ telemetry .exceptionCounter ().incrementBy (stats .requestError , attr );
236+ telemetry .exceptionHistogram ().record (stats .requestError , attr );
237+ telemetry .throttleCounter ().incrementBy (stats .requestThrottle , attr );
238+ telemetry .throttleHistogram ().record (stats .requestThrottle , attr );
239+ telemetry .requestRangeNotSatisfiedExceptionCounter ().incrementBy (stats .requestRangeError , attr );
249240 telemetry .httpRequestTimeInMillisHistogram ().record (stats .totalDuration , attr );
250241 }
251242
0 commit comments