@@ -132,6 +132,7 @@ pub struct Worker {
132
132
pub transaction_filter : TransactionFilter ,
133
133
pub grpc_response_item_timeout_in_secs : u64 ,
134
134
pub deprecated_tables : TableFlags ,
135
+ pub db_row_name : String ,
135
136
}
136
137
137
138
impl Worker {
@@ -155,6 +156,7 @@ impl Worker {
155
156
transaction_filter : TransactionFilter ,
156
157
grpc_response_item_timeout_in_secs : u64 ,
157
158
deprecated_tables : HashSet < String > ,
159
+ db_row_name : String ,
158
160
) -> Result < Self > {
159
161
let processor_name = processor_config. name ( ) ;
160
162
info ! ( processor_name = processor_name, "[Parser] Kicking off" ) ;
@@ -200,6 +202,7 @@ impl Worker {
200
202
transaction_filter,
201
203
grpc_response_item_timeout_in_secs,
202
204
deprecated_tables : deprecated_tables_flags,
205
+ db_row_name,
203
206
} )
204
207
}
205
208
@@ -210,7 +213,7 @@ impl Worker {
210
213
/// * Note that the batches will be sequential so we won't have problems with gaps
211
214
/// 4. We will keep track of the last processed version and monitoring things like TPS
212
215
pub async fn run ( & mut self ) {
213
- let processor_name = self . processor_config . name ( ) ;
216
+ let processor_name = self . db_row_name . clone ( ) ;
214
217
info ! (
215
218
processor_name = processor_name,
216
219
service_type = PROCESSOR_SERVICE_TYPE ,
@@ -332,6 +335,7 @@ impl Worker {
332
335
self . deprecated_tables ,
333
336
self . db_pool . clone ( ) ,
334
337
maybe_gap_detector_sender,
338
+ self . db_row_name . clone ( ) ,
335
339
) ;
336
340
337
341
let gap_detector = if is_parquet_processor {
@@ -361,7 +365,7 @@ impl Worker {
361
365
// 5. If it's the wrong chain, panic.
362
366
363
367
info ! (
364
- processor_name = processor_name ,
368
+ processor_name = self . db_row_name ,
365
369
service_type = PROCESSOR_SERVICE_TYPE ,
366
370
stream_address = self . indexer_grpc_data_service_address. as_str( ) ,
367
371
concurrent_tasks,
@@ -376,13 +380,14 @@ impl Worker {
376
380
receiver. clone ( ) ,
377
381
gap_detector_sender. clone ( ) ,
378
382
gap_detector. clone ( ) ,
383
+ self . db_row_name . clone ( ) ,
379
384
)
380
385
. await ;
381
386
processor_tasks. push ( join_handle) ;
382
387
}
383
388
384
389
info ! (
385
- processor_name = processor_name ,
390
+ processor_name = self . db_row_name ,
386
391
service_type = PROCESSOR_SERVICE_TYPE ,
387
392
stream_address = self . indexer_grpc_data_service_address. as_str( ) ,
388
393
concurrent_tasks,
@@ -401,8 +406,9 @@ impl Worker {
401
406
receiver : kanal:: AsyncReceiver < TransactionsPBResponse > ,
402
407
gap_detector_sender : AsyncSender < ProcessingResult > ,
403
408
mut gap_detector : GapDetector ,
409
+ db_row_name : String ,
404
410
) -> JoinHandle < ( ) > {
405
- let processor_name = self . processor_config . name ( ) ;
411
+ let processor_name = db_row_name . clone ( ) ;
406
412
let stream_address = self . indexer_grpc_data_service_address . to_string ( ) ;
407
413
let receiver_clone = receiver. clone ( ) ;
408
414
let auth_token = self . auth_token . clone ( ) ;
@@ -415,6 +421,7 @@ impl Worker {
415
421
self . deprecated_tables ,
416
422
self . db_pool . clone ( ) ,
417
423
Some ( gap_detector_sender. clone ( ) ) ,
424
+ "" . to_string ( ) ,
418
425
)
419
426
} else {
420
427
build_processor (
@@ -423,6 +430,7 @@ impl Worker {
423
430
self . deprecated_tables ,
424
431
self . db_pool . clone ( ) ,
425
432
None ,
433
+ db_row_name,
426
434
)
427
435
} ;
428
436
@@ -441,7 +449,7 @@ impl Worker {
441
449
loop {
442
450
let txn_channel_fetch_latency = std:: time:: Instant :: now ( ) ;
443
451
match fetch_transactions (
444
- processor_name,
452
+ & processor_name,
445
453
& stream_address,
446
454
receiver_clone. clone ( ) ,
447
455
task_index,
@@ -522,7 +530,7 @@ impl Worker {
522
530
transactions_pb,
523
531
& processor,
524
532
chain_id,
525
- processor_name,
533
+ & processor_name,
526
534
& auth_token,
527
535
false , // enable_verbose_logging
528
536
)
@@ -531,7 +539,7 @@ impl Worker {
531
539
let processing_result = match res {
532
540
Ok ( versions) => {
533
541
PROCESSOR_SUCCESSES_COUNT
534
- . with_label_values ( & [ processor_name] )
542
+ . with_label_values ( & [ & processor_name] )
535
543
. inc ( ) ;
536
544
versions
537
545
} ,
@@ -544,7 +552,7 @@ impl Worker {
544
552
"[Parser][T#{}] Error processing transactions" , task_index
545
553
) ;
546
554
PROCESSOR_ERRORS_COUNT
547
- . with_label_values ( & [ processor_name] )
555
+ . with_label_values ( & [ & processor_name] )
548
556
. inc ( ) ;
549
557
panic ! (
550
558
"[Parser][T#{}] Error processing '{:}' transactions: {:?}" ,
@@ -590,21 +598,21 @@ impl Worker {
590
598
591
599
// TODO: For these three, do an atomic thing, or ideally move to an async metrics collector!
592
600
GRPC_LATENCY_BY_PROCESSOR_IN_SECS
593
- . with_label_values ( & [ processor_name, & task_index_str] )
601
+ . with_label_values ( & [ & processor_name, & task_index_str] )
594
602
. observe ( time_diff_since_pb_timestamp_in_secs (
595
603
end_txn_timestamp. as_ref ( ) . unwrap ( ) ,
596
604
) ) ;
597
605
LATEST_PROCESSED_VERSION
598
606
. with_label_values ( & [
599
- processor_name,
607
+ & processor_name,
600
608
step,
601
609
label,
602
610
& task_index_str,
603
611
] )
604
612
. set ( last_txn_version as i64 ) ;
605
613
TRANSACTION_UNIX_TIMESTAMP
606
614
. with_label_values ( & [
607
- processor_name,
615
+ & processor_name,
608
616
step,
609
617
label,
610
618
& task_index_str,
@@ -614,29 +622,29 @@ impl Worker {
614
622
// Single batch metrics
615
623
PROCESSED_BYTES_COUNT
616
624
. with_label_values ( & [
617
- processor_name,
625
+ & processor_name,
618
626
step,
619
627
label,
620
628
& task_index_str,
621
629
] )
622
630
. inc_by ( size_in_bytes as u64 ) ;
623
631
NUM_TRANSACTIONS_PROCESSED_COUNT
624
632
. with_label_values ( & [
625
- processor_name,
633
+ & processor_name,
626
634
step,
627
635
label,
628
636
& task_index_str,
629
637
] )
630
638
. inc_by ( num_processed) ;
631
639
632
640
SINGLE_BATCH_PROCESSING_TIME_IN_SECS
633
- . with_label_values ( & [ processor_name, & task_index_str] )
641
+ . with_label_values ( & [ & processor_name, & task_index_str] )
634
642
. observe ( processing_time) ;
635
643
SINGLE_BATCH_PARSING_TIME_IN_SECS
636
- . with_label_values ( & [ processor_name, & task_index_str] )
644
+ . with_label_values ( & [ & processor_name, & task_index_str] )
637
645
. observe ( processing_result. processing_duration_in_secs ) ;
638
646
SINGLE_BATCH_DB_INSERTION_TIME_IN_SECS
639
- . with_label_values ( & [ processor_name, & task_index_str] )
647
+ . with_label_values ( & [ & processor_name, & task_index_str] )
640
648
. observe ( processing_result. db_insertion_duration_in_secs ) ;
641
649
642
650
gap_detector_sender
@@ -659,7 +667,7 @@ impl Worker {
659
667
660
668
NUM_TRANSACTIONS_PROCESSED_COUNT
661
669
. with_label_values ( & [
662
- processor_name,
670
+ & processor_name,
663
671
step,
664
672
label,
665
673
& task_index_str,
@@ -740,9 +748,7 @@ impl Worker {
740
748
pub async fn get_start_version ( & self ) -> Result < Option < u64 > > {
741
749
let mut conn = self . db_pool . get ( ) . await ?;
742
750
743
- match ProcessorStatusQuery :: get_by_processor ( self . processor_config . name ( ) , & mut conn)
744
- . await ?
745
- {
751
+ match ProcessorStatusQuery :: get_by_processor ( & self . db_row_name , & mut conn) . await ? {
746
752
Some ( status) => Ok ( Some ( status. last_success_version as u64 + 1 ) ) ,
747
753
None => Ok ( None ) ,
748
754
}
@@ -900,6 +906,7 @@ pub fn build_processor_for_testing(
900
906
deprecated_tables,
901
907
db_pool,
902
908
None ,
909
+ "" . to_string ( ) ,
903
910
)
904
911
}
905
912
@@ -914,6 +921,7 @@ pub fn build_processor(
914
921
deprecated_tables : TableFlags ,
915
922
db_pool : ArcDbPool ,
916
923
gap_detector_sender : Option < AsyncSender < ProcessingResult > > , // Parquet only
924
+ db_row_name : String ,
917
925
) -> Processor {
918
926
match config {
919
927
ProcessorConfig :: AccountTransactionsProcessor => Processor :: from (
@@ -938,7 +946,9 @@ pub fn build_processor(
938
946
per_table_chunk_sizes,
939
947
deprecated_tables,
940
948
) ) ,
941
- ProcessorConfig :: MonitoringProcessor => Processor :: from ( MonitoringProcessor :: new ( db_pool) ) ,
949
+ ProcessorConfig :: MonitoringProcessor => {
950
+ Processor :: from ( MonitoringProcessor :: new ( db_pool, db_row_name) )
951
+ } ,
942
952
ProcessorConfig :: NftMetadataProcessor ( config) => {
943
953
Processor :: from ( NftMetadataProcessor :: new ( db_pool, config. clone ( ) ) )
944
954
} ,
0 commit comments