@@ -491,11 +491,12 @@ impl Lambda {
491
491
fd_max : f64 ,
492
492
fd_use : f64 ,
493
493
aggr : & mut std:: sync:: MutexGuard < Aggregator > ,
494
+ tags : Option < SortedTags > ,
494
495
) {
495
496
let metric = Metric :: new (
496
497
constants:: FD_MAX_METRIC . into ( ) ,
497
498
MetricValue :: distribution ( fd_max) ,
498
- None ,
499
+ tags . clone ( ) ,
499
500
) ;
500
501
if let Err ( e) = aggr. insert ( metric) {
501
502
error ! ( "Failed to insert fd_max metric: {}" , e) ;
@@ -506,7 +507,7 @@ impl Lambda {
506
507
let metric = Metric :: new (
507
508
constants:: FD_USE_METRIC . into ( ) ,
508
509
MetricValue :: distribution ( fd_use) ,
509
- None ,
510
+ tags ,
510
511
) ;
511
512
if let Err ( e) = aggr. insert ( metric) {
512
513
error ! ( "Failed to insert fd_use metric: {}" , e) ;
@@ -518,11 +519,12 @@ impl Lambda {
518
519
threads_max : f64 ,
519
520
threads_use : f64 ,
520
521
aggr : & mut std:: sync:: MutexGuard < Aggregator > ,
522
+ tags : Option < SortedTags > ,
521
523
) {
522
524
let metric = Metric :: new (
523
525
constants:: THREADS_MAX_METRIC . into ( ) ,
524
526
MetricValue :: distribution ( threads_max) ,
525
- None ,
527
+ tags . clone ( ) ,
526
528
) ;
527
529
if let Err ( e) = aggr. insert ( metric) {
528
530
error ! ( "Failed to insert threads_max metric: {}" , e) ;
@@ -533,7 +535,7 @@ impl Lambda {
533
535
let metric = Metric :: new (
534
536
constants:: THREADS_USE_METRIC . into ( ) ,
535
537
MetricValue :: distribution ( threads_use) ,
536
- None ,
538
+ tags ,
537
539
) ;
538
540
if let Err ( e) = aggr. insert ( metric) {
539
541
error ! ( "Failed to insert threads_use metric: {}" , e) ;
@@ -547,6 +549,7 @@ impl Lambda {
547
549
}
548
550
549
551
let aggr = Arc :: clone ( & self . aggregator ) ;
552
+ let tags = self . get_dynamic_value_tags ( ) ;
550
553
551
554
tokio:: spawn ( async move {
552
555
// get list of all process ids
@@ -568,8 +571,8 @@ impl Lambda {
568
571
_ = send_metrics. changed( ) => {
569
572
let mut aggr: std:: sync:: MutexGuard <Aggregator > =
570
573
aggr. lock( ) . expect( "lock poisoned" ) ;
571
- Self :: generate_fd_enhanced_metrics( fd_max, fd_use, & mut aggr) ;
572
- Self :: generate_threads_enhanced_metrics( threads_max, threads_use, & mut aggr) ;
574
+ Self :: generate_fd_enhanced_metrics( fd_max, fd_use, & mut aggr, tags . clone ( ) ) ;
575
+ Self :: generate_threads_enhanced_metrics( threads_max, threads_use, & mut aggr, tags ) ;
573
576
return ;
574
577
}
575
578
// Otherwise keep monitoring file descriptor and thread usage periodically
@@ -1015,6 +1018,7 @@ mod tests {
1015
1018
fd_max,
1016
1019
fd_use,
1017
1020
& mut lambda. aggregator . lock ( ) . expect ( "lock poisoned" ) ,
1021
+ None ,
1018
1022
) ;
1019
1023
1020
1024
assert_sketch ( & metrics_aggr, constants:: FD_MAX_METRIC , 1024.0 ) ;
@@ -1033,6 +1037,7 @@ mod tests {
1033
1037
fd_max,
1034
1038
fd_use,
1035
1039
& mut lambda. aggregator . lock ( ) . expect ( "lock poisoned" ) ,
1040
+ None ,
1036
1041
) ;
1037
1042
1038
1043
assert_sketch ( & metrics_aggr, constants:: FD_MAX_METRIC , 1024.0 ) ;
@@ -1055,6 +1060,7 @@ mod tests {
1055
1060
threads_max,
1056
1061
threads_use,
1057
1062
& mut lambda. aggregator . lock ( ) . expect ( "lock poisoned" ) ,
1063
+ None ,
1058
1064
) ;
1059
1065
1060
1066
assert_sketch ( & metrics_aggr, constants:: THREADS_MAX_METRIC , 1024.0 ) ;
@@ -1073,6 +1079,7 @@ mod tests {
1073
1079
threads_max,
1074
1080
threads_use,
1075
1081
& mut lambda. aggregator . lock ( ) . expect ( "lock poisoned" ) ,
1082
+ None ,
1076
1083
) ;
1077
1084
1078
1085
assert_sketch ( & metrics_aggr, constants:: THREADS_MAX_METRIC , 1024.0 ) ;
0 commit comments