Skip to content

Commit

Permalink
client: emit max_memory metric (#11490)
Browse files Browse the repository at this point in the history
  • Loading branch information
danishprakash committed Nov 17, 2021
1 parent 23c977c commit e70b0b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2911,6 +2911,7 @@ func (c *Client) setGaugeForAllocationStats(nodeID string, baseLabels []metrics.

// Emit allocated
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", "cpu"}, float32(allocated.Flattened.Cpu.CpuShares), baseLabels)

Expand Down
5 changes: 3 additions & 2 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9697,7 +9697,7 @@ func (a *Allocation) SetEventDisplayMessages() {
//
// COMPAT(0.11): Remove in 0.11
func (a *Allocation) ComparableResources() *ComparableResources {
// ALloc already has 0.9+ behavior
// Alloc already has 0.9+ behavior
if a.AllocatedResources != nil {
return a.AllocatedResources.Comparable()
}
Expand All @@ -9720,7 +9720,8 @@ func (a *Allocation) ComparableResources() *ComparableResources {
CpuShares: int64(resources.CPU),
},
Memory: AllocatedMemoryResources{
MemoryMB: int64(resources.MemoryMB),
MemoryMB: int64(resources.MemoryMB),
MemoryMaxMB: int64(resources.MemoryMaxMB),
},
Networks: resources.Networks,
},
Expand Down

0 comments on commit e70b0b7

Please sign in to comment.