Details

    • Hide
      New metrics are available to monitor managed memory:
      `Status.Flink.Memory.Managed.[Used|Total]`
      Show
      New metrics are available to monitor managed memory: `Status.Flink.Memory.Managed.[Used|Total]`

    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

          Activity

            People

              mapohl Matthias Pohl
              lining lining
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m