@@ -45,7 +45,9 @@ use tracing::{instrument, warn};
45
45
46
46
use crate :: debouncer:: DebouncedStorage ;
47
47
use crate :: metrics:: object_storage_get_slice_in_flight_guards;
48
- use crate :: object_storage:: metrics_wrappers:: { S3MetricsWrapperExt , copy_with_download_metrics} ;
48
+ use crate :: object_storage:: metrics_wrappers:: {
49
+ ActionLabel , S3MetricsWrapperExt , copy_with_download_metrics,
50
+ } ;
49
51
use crate :: storage:: SendableAsync ;
50
52
use crate :: {
51
53
BulkDeleteError , DeleteFailure , MultiPartPolicy , PutPayload , Storage , StorageError ,
@@ -226,9 +228,6 @@ impl AzureBlobStorage {
226
228
name : & ' a str ,
227
229
payload : Box < dyn crate :: PutPayload > ,
228
230
) -> StorageResult < ( ) > {
229
- crate :: STORAGE_METRICS
230
- . object_storage_upload_num_bytes
231
- . inc_by ( payload. len ( ) ) ;
232
231
retry ( & self . retry_params , || async {
233
232
let data = Bytes :: from ( payload. read_all ( ) . await ?. to_vec ( ) ) ;
234
233
let hash = azure_storage_blobs:: prelude:: Hash :: from ( md5:: compute ( & data[ ..] ) . 0 ) ;
@@ -237,7 +236,7 @@ impl AzureBlobStorage {
237
236
. put_block_blob ( data)
238
237
. hash ( hash)
239
238
. into_future ( )
240
- . with_count_metric ( "put_block_blob" )
239
+ . with_count_and_upload_metrics ( ActionLabel :: PutObject , payload . len ( ) )
241
240
. await ?;
242
241
Result :: < ( ) , AzureErrorWrapper > :: Ok ( ( ) )
243
242
} )
@@ -262,9 +261,6 @@ impl AzureBlobStorage {
262
261
. map ( |( num, range) | {
263
262
let moved_blob_client = blob_client. clone ( ) ;
264
263
let moved_payload = payload. clone ( ) ;
265
- crate :: STORAGE_METRICS
266
- . object_storage_upload_num_bytes
267
- . inc_by ( range. end - range. start ) ;
268
264
async move {
269
265
retry ( & self . retry_params , || async {
270
266
let block_id = format ! ( "block:{num}" ) ;
@@ -276,7 +272,10 @@ impl AzureBlobStorage {
276
272
. put_block ( block_id. clone ( ) , data)
277
273
. hash ( hash)
278
274
. into_future ( )
279
- . with_count_metric ( "put_block" )
275
+ . with_count_and_upload_metrics (
276
+ ActionLabel :: UploadPart ,
277
+ range. end - range. start ,
278
+ )
280
279
. await ?;
281
280
Result :: < _ , AzureErrorWrapper > :: Ok ( block_id)
282
281
} )
@@ -300,7 +299,7 @@ impl AzureBlobStorage {
300
299
blob_client
301
300
. put_block_list ( block_list)
302
301
. into_future ( )
303
- . with_count_metric ( "put_block_list" )
302
+ . with_count_metric ( ActionLabel :: CompleteMultipartUpload )
304
303
. await
305
304
. map_err ( AzureErrorWrapper :: from) ?;
306
305
@@ -317,6 +316,7 @@ impl Storage for AzureBlobStorage {
317
316
. max_results ( NonZeroU32 :: new ( 1u32 ) . expect ( "1 is always non-zero." ) )
318
317
. into_stream ( )
319
318
. next ( )
319
+ . with_count_metric ( ActionLabel :: ListObjects )
320
320
. await
321
321
{
322
322
let _ = first_blob_result?;
@@ -346,7 +346,11 @@ impl Storage for AzureBlobStorage {
346
346
let name = self . blob_name ( path) ;
347
347
let mut output_stream = self . container_client . blob_client ( name) . get ( ) . into_stream ( ) ;
348
348
349
- while let Some ( chunk_result) = output_stream. next ( ) . with_count_metric ( "get_blob" ) . await {
349
+ while let Some ( chunk_result) = output_stream
350
+ . next ( )
351
+ . with_count_metric ( ActionLabel :: GetObject )
352
+ . await
353
+ {
350
354
let chunk_response = chunk_result. map_err ( AzureErrorWrapper :: from) ?;
351
355
let chunk_response_body_stream = chunk_response
352
356
. data
@@ -367,7 +371,7 @@ impl Storage for AzureBlobStorage {
367
371
. blob_client ( blob_name)
368
372
. delete ( )
369
373
. into_future ( )
370
- . with_count_metric ( "delete_blob" )
374
+ . with_count_metric ( ActionLabel :: DeleteObject )
371
375
. await
372
376
. map_err ( |err| AzureErrorWrapper :: from ( err) . into ( ) ) ;
373
377
ignore_error_kind ! ( StorageErrorKind :: NotFound , delete_res) ?;
@@ -543,7 +547,11 @@ async fn download_all(
543
547
output : & mut Vec < u8 > ,
544
548
) -> Result < ( ) , AzureErrorWrapper > {
545
549
output. clear ( ) ;
546
- while let Some ( chunk_result) = chunk_stream. next ( ) . with_count_metric ( "get_blob" ) . await {
550
+ while let Some ( chunk_result) = chunk_stream
551
+ . next ( )
552
+ . with_count_metric ( ActionLabel :: GetObject )
553
+ . await
554
+ {
547
555
let chunk_response = chunk_result?;
548
556
let chunk_response_body_stream = chunk_response
549
557
. data
0 commit comments