Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Done
-
None
Description
If a user wants to get memory used in time, as there's no manage memory's metrics, it couldn't get it.
Propose
- add default memory type in MemoryManager
public static final MemoryType DEFAULT_MEMORY_TYPE = MemoryType.OFF_HEAP;
- add getManagedMemoryTotal in TaskExecutor:
public long getManagedMemoryTotal() { return this.taskSlotTable.getAllocatedSlots().stream().mapToLong( slot -> slot.getMemoryManager().getMemorySizeByType(MemoryManager.DEFAULT_MEMORY_TYPE) ).sum(); }
- add getManagedMemoryUsed in TaskExecutor:
public long getManagedMemoryUsed() { return this.taskSlotTable.getAllocatedSlots().stream().mapToLong( slot -> slot.getMemoryManager().getMemorySizeByType(MemoryManager.DEFAULT_MEMORY_TYPE) - slot.getMemoryManager().availableMemory(MemoryManager.DEFAULT_MEMORY_TYPE) ).sum(); }
- add instantiateMemoryManagerMetrics in MetricUtils
public static void instantiateMemoryManagerMetrics(MetricGroup statusMetricGroup, TaskExecutor taskExecutor) { checkNotNull(statusMetricGroup); MetricGroup memoryManagerGroup = statusMetricGroup.addGroup("Managed").addGroup("Memory"); memoryManagerGroup.<Long, Gauge<Long>>gauge("TotalCapacity", taskExecutor::getManagedMemoryTotal); memoryManagerGroup.<Long, Gauge<Long>>gauge("MemoryUsed", taskExecutor::getManagedMemoryUsed); }
- register it in TaskManagerRunner#startTaskManager
Attachments
Issue Links
- links to
- mentioned in
-
Page Loading...