@@ -2593,12 +2593,12 @@ func (c *Client) emitStats() {
2593
2593
}
2594
2594
2595
2595
// setGaugeForMemoryStats proxies metrics for memory specific statistics
2596
- func (c * Client ) setGaugeForMemoryStats (nodeID string , hStats * stats.HostStats ) {
2596
+ func (c * Client ) setGaugeForMemoryStats (nodeID string , hStats * stats.HostStats , baseLabels []metrics. Label ) {
2597
2597
if ! c .config .DisableTaggedMetrics {
2598
- metrics .SetGaugeWithLabels ([]string {"client" , "host" , "memory" , "total" }, float32 (hStats .Memory .Total ), c . baseLabels )
2599
- metrics .SetGaugeWithLabels ([]string {"client" , "host" , "memory" , "available" }, float32 (hStats .Memory .Available ), c . baseLabels )
2600
- metrics .SetGaugeWithLabels ([]string {"client" , "host" , "memory" , "used" }, float32 (hStats .Memory .Used ), c . baseLabels )
2601
- metrics .SetGaugeWithLabels ([]string {"client" , "host" , "memory" , "free" }, float32 (hStats .Memory .Free ), c . baseLabels )
2598
+ metrics .SetGaugeWithLabels ([]string {"client" , "host" , "memory" , "total" }, float32 (hStats .Memory .Total ), baseLabels )
2599
+ metrics .SetGaugeWithLabels ([]string {"client" , "host" , "memory" , "available" }, float32 (hStats .Memory .Available ), baseLabels )
2600
+ metrics .SetGaugeWithLabels ([]string {"client" , "host" , "memory" , "used" }, float32 (hStats .Memory .Used ), baseLabels )
2601
+ metrics .SetGaugeWithLabels ([]string {"client" , "host" , "memory" , "free" }, float32 (hStats .Memory .Free ), baseLabels )
2602
2602
}
2603
2603
2604
2604
if c .config .BackwardsCompatibleMetrics {
@@ -2610,10 +2610,10 @@ func (c *Client) setGaugeForMemoryStats(nodeID string, hStats *stats.HostStats)
2610
2610
}
2611
2611
2612
2612
// setGaugeForCPUStats proxies metrics for CPU specific statistics
2613
- func (c * Client ) setGaugeForCPUStats (nodeID string , hStats * stats.HostStats ) {
2613
+ func (c * Client ) setGaugeForCPUStats (nodeID string , hStats * stats.HostStats , baseLabels []metrics. Label ) {
2614
2614
for _ , cpu := range hStats .CPU {
2615
2615
if ! c .config .DisableTaggedMetrics {
2616
- labels := append (c . baseLabels , metrics.Label {
2616
+ labels := append (baseLabels , metrics.Label {
2617
2617
Name : "cpu" ,
2618
2618
Value : cpu .CPU ,
2619
2619
})
@@ -2634,10 +2634,10 @@ func (c *Client) setGaugeForCPUStats(nodeID string, hStats *stats.HostStats) {
2634
2634
}
2635
2635
2636
2636
// setGaugeForDiskStats proxies metrics for disk specific statistics
2637
- func (c * Client ) setGaugeForDiskStats (nodeID string , hStats * stats.HostStats ) {
2637
+ func (c * Client ) setGaugeForDiskStats (nodeID string , hStats * stats.HostStats , baseLabels []metrics. Label ) {
2638
2638
for _ , disk := range hStats .DiskStats {
2639
2639
if ! c .config .DisableTaggedMetrics {
2640
- labels := append (c . baseLabels , metrics.Label {
2640
+ labels := append (baseLabels , metrics.Label {
2641
2641
Name : "disk" ,
2642
2642
Value : disk .Device ,
2643
2643
})
@@ -2737,9 +2737,9 @@ func (c *Client) setGaugeForAllocationStats(nodeID string) {
2737
2737
}
2738
2738
2739
2739
// No labels are required so we emit with only a key/value syntax
2740
- func (c * Client ) setGaugeForUptime (hStats * stats.HostStats ) {
2740
+ func (c * Client ) setGaugeForUptime (hStats * stats.HostStats , baseLabels []metrics. Label ) {
2741
2741
if ! c .config .DisableTaggedMetrics {
2742
- metrics .SetGaugeWithLabels ([]string {"client" , "uptime" }, float32 (hStats .Uptime ), c . baseLabels )
2742
+ metrics .SetGaugeWithLabels ([]string {"client" , "uptime" }, float32 (hStats .Uptime ), baseLabels )
2743
2743
}
2744
2744
if c .config .BackwardsCompatibleMetrics {
2745
2745
metrics .SetGauge ([]string {"client" , "uptime" }, float32 (hStats .Uptime ))
@@ -2750,11 +2750,18 @@ func (c *Client) setGaugeForUptime(hStats *stats.HostStats) {
2750
2750
func (c * Client ) emitHostStats () {
2751
2751
nodeID := c .NodeID ()
2752
2752
hStats := c .hostStatsCollector .Stats ()
2753
+ node := c .Node ()
2754
+
2755
+ node .Canonicalize ()
2756
+ labels := append (c .baseLabels ,
2757
+ metrics.Label {Name : "node_status" , Value : node .Status },
2758
+ metrics.Label {Name : "node_scheduling_eligibility" , Value : node .SchedulingEligibility },
2759
+ )
2753
2760
2754
- c .setGaugeForMemoryStats (nodeID , hStats )
2755
- c .setGaugeForUptime (hStats )
2756
- c .setGaugeForCPUStats (nodeID , hStats )
2757
- c .setGaugeForDiskStats (nodeID , hStats )
2761
+ c .setGaugeForMemoryStats (nodeID , hStats , labels )
2762
+ c .setGaugeForUptime (hStats , labels )
2763
+ c .setGaugeForCPUStats (nodeID , hStats , labels )
2764
+ c .setGaugeForDiskStats (nodeID , hStats , labels )
2758
2765
}
2759
2766
2760
2767
// emitClientMetrics emits lower volume client metrics
0 commit comments