client: emit max_memory metric (#11490)

This commit is contained in:
Danish Prakash 2021-11-17 19:04:22 +05:30 committed by GitHub
parent 7e1b2f1147
commit 1e2c9b3aa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -2911,6 +2911,7 @@ func (c *Client) setGaugeForAllocationStats(nodeID string, baseLabels []metrics.
// Emit allocated // Emit allocated
metrics.SetGaugeWithLabels([]string{"client", "allocated", "memory"}, float32(allocated.Flattened.Memory.MemoryMB), baseLabels) metrics.SetGaugeWithLabels([]string{"client", "allocated", "memory"}, float32(allocated.Flattened.Memory.MemoryMB), baseLabels)
metrics.SetGaugeWithLabels([]string{"client", "allocated", "max_memory"}, float32(allocated.Flattened.Memory.MemoryMaxMB), baseLabels)
metrics.SetGaugeWithLabels([]string{"client", "allocated", "disk"}, float32(allocated.Shared.DiskMB), baseLabels) metrics.SetGaugeWithLabels([]string{"client", "allocated", "disk"}, float32(allocated.Shared.DiskMB), baseLabels)
metrics.SetGaugeWithLabels([]string{"client", "allocated", "cpu"}, float32(allocated.Flattened.Cpu.CpuShares), baseLabels) metrics.SetGaugeWithLabels([]string{"client", "allocated", "cpu"}, float32(allocated.Flattened.Cpu.CpuShares), baseLabels)

View file

@ -9697,7 +9697,7 @@ func (a *Allocation) SetEventDisplayMessages() {
// //
// COMPAT(0.11): Remove in 0.11 // COMPAT(0.11): Remove in 0.11
func (a *Allocation) ComparableResources() *ComparableResources { func (a *Allocation) ComparableResources() *ComparableResources {
// ALloc already has 0.9+ behavior // Alloc already has 0.9+ behavior
if a.AllocatedResources != nil { if a.AllocatedResources != nil {
return a.AllocatedResources.Comparable() return a.AllocatedResources.Comparable()
} }
@ -9720,7 +9720,8 @@ func (a *Allocation) ComparableResources() *ComparableResources {
CpuShares: int64(resources.CPU), CpuShares: int64(resources.CPU),
}, },
Memory: AllocatedMemoryResources{ Memory: AllocatedMemoryResources{
MemoryMB: int64(resources.MemoryMB), MemoryMB: int64(resources.MemoryMB),
MemoryMaxMB: int64(resources.MemoryMaxMB),
}, },
Networks: resources.Networks, Networks: resources.Networks,
}, },