@@ -21,6 +21,7 @@ import (
2121 "fmt"
2222 "math"
2323 "sort"
24+ "strconv"
2425 "strings"
2526 "time"
2627
@@ -1641,7 +1642,8 @@ func (ic *IrqTuningController) emitIrqTuningPolicy() {
16411642 irqTuningPolicyMetricVal = - 1
16421643 }
16431644
1644- _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningPolicy , irqTuningPolicyMetricVal , metrics .MetricTypeNameRaw )
1645+ _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningPolicy , irqTuningPolicyMetricVal , metrics .MetricTypeNameRaw ,
1646+ metrics.MetricTag {Key : "irq_tuning_policy" , Val : string (ic .conf .IrqTuningPolicy )})
16451647}
16461648
16471649func (ic * IrqTuningController ) emitNicsIrqAffinityPolicy () {
@@ -1652,9 +1654,12 @@ func (ic *IrqTuningController) emitNicsIrqAffinityPolicy() {
16521654 val = 0
16531655 } else if nic .IrqAffinityPolicy == IrqCoresExclusive {
16541656 val = 1
1657+ } else {
1658+ general .Errorf ("%s nic %s irq affinity policy %s is unexpected" , IrqTuningLogPrefix , nic .NicInfo , nic .IrqAffinityPolicy )
16551659 }
16561660 _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningNicIrqAffinityPolicy , val , metrics .MetricTypeNameRaw ,
1657- metrics.MetricTag {Key : "nic" , Val : nic .NicInfo .UniqName ()})
1661+ metrics.MetricTag {Key : "nic" , Val : nic .NicInfo .UniqName ()},
1662+ metrics.MetricTag {Key : "irq_affinity_policy" , Val : string (nic .IrqAffinityPolicy )})
16581663 }
16591664}
16601665
@@ -2732,6 +2737,8 @@ func (ic *IrqTuningController) tuneNicIrqsAffinityQualifiedCores(nic *NicInfo, i
27322737 tunedReason = irqtuner .NormalNicsChanged
27332738 } else {
27342739 tunedReason = irqtuner .UnexpectedTuning
2740+ general .Errorf ("%s nic %s unexpected balance-fair irq tuning, irqs: %+v, qualifiedCores: %+v" ,
2741+ IrqTuningLogPrefix , nic , irqs , qualifiedCoresMap )
27352742 }
27362743 } else {
27372744 tunedReason = irqtuner .NormalTuning
@@ -3515,8 +3522,10 @@ retry:
35153522 }
35163523 ic .IrqAffForbiddenContainers = irqAffinityForbiddenContainers
35173524 ic .SriovContainers = sriovContainers
3518- _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningSriovContainersCount , int64 (len (ic .SriovContainers )), metrics .MetricTypeNameRaw )
3519- _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningIrqAffForbiddenContainersCount , int64 (len (ic .IrqAffForbiddenContainers )), metrics .MetricTypeNameRaw )
3525+ _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningSriovContainersCount , int64 (len (ic .SriovContainers )), metrics .MetricTypeNameRaw ,
3526+ metrics.MetricTag {Key : "count" , Val : strconv .Itoa (len (ic .SriovContainers ))})
3527+ _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningIrqAffForbiddenContainersCount , int64 (len (ic .IrqAffForbiddenContainers )), metrics .MetricTypeNameRaw ,
3528+ metrics.MetricTag {Key : "count" , Val : strconv .Itoa (len (ic .IrqAffForbiddenContainers ))})
35203529
35213530 forbiddendCores , err := ic .IrqStateAdapter .GetIRQForbiddenCores ()
35223531 if err != nil {
@@ -5396,12 +5405,14 @@ func (ic *IrqTuningController) periodicTuningIrqBalanceFair() {
53965405 }
53975406 }
53985407
5399- _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningRPSEnabled , 1 , metrics .MetricTypeNameRaw )
5408+ _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningRPSEnabled , 1 , metrics .MetricTypeNameRaw ,
5409+ metrics.MetricTag {Key : "enabled" , Val : "1" })
54005410 } else {
54015411 if err := ic .clearRPSForNics (ic .getAllNics ()); err != nil {
54025412 general .Errorf ("%s failed to clearRPSForNics, err %s" , IrqTuningLogPrefix , err )
54035413 }
5404- _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningRPSEnabled , 0 , metrics .MetricTypeNameRaw )
5414+ _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningRPSEnabled , 0 , metrics .MetricTypeNameRaw ,
5415+ metrics.MetricTag {Key : "enabled" , Val : "0" })
54055416 }
54065417
54075418 // restore ksoftirqd default nice
@@ -5612,10 +5623,12 @@ func (ic *IrqTuningController) periodicTuning() {
56125623
56135624 if ! ic .conf .EnableIrqTuning {
56145625 ic .disableIrqTuning ()
5615- _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningEnabled , 0 , metrics .MetricTypeNameRaw )
5626+ _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningEnabled , 0 , metrics .MetricTypeNameRaw ,
5627+ metrics.MetricTag {Key : "enabled" , Val : "0" })
56165628 return
56175629 }
5618- _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningEnabled , 1 , metrics .MetricTypeNameRaw )
5630+ _ = ic .emitter .StoreInt64 (metricUtil .MetricNameIrqTuningEnabled , 1 , metrics .MetricTypeNameRaw ,
5631+ metrics.MetricTag {Key : "enabled" , Val : "1" })
56195632
56205633 switch ic .conf .IrqTuningPolicy {
56215634 case config .IrqTuningIrqCoresExclusive :
0 commit comments