Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4818

Export JVM heap metrics in ServerMetrics

    XMLWordPrintableJSON

Details

    Description

      A metric for JVM heap occupancy is not included in ServerMetrics.

      According to https://zookeeper.apache.org/doc/current/zookeeperMonitor.html the recommended practice is for someone to enable the PrometheusMetricsProvider and the Prometheus base class upon which that provider is based does export that information. See https://zookeeper.apache.org/doc/current/zookeeperMonitor.html . The example provided for alerting on heap utilization there is:

        - alert: JvmMemoryFillingUp
          expr: jvm_memory_bytes_used / jvm_memory_bytes_max{area="heap"} > 0.8
          for: 5m
          labels:
            severity: warning
          annotations:
            summary: "JVM memory filling up (instance {{ $labels.instance }})"
            description: "JVM memory is filling up (> 80%)\n labels: {{ $labels }}  value = {{ $value }}\n"
      

      where jvm_memory_bytes_used and jvm_memory_bytes_max are provided by a Prometheus base class.

      Where PrometheusMetricsProvider is the right choice that's good enough but where the ServerMetrics information is consumed in an alternate way, by 4-letter-word scraping, or by JMX, ServerMetrics should provide the same information. jvm_memory_bytes_used and jvm_memory_bytes_max (presuming heap) are reasonable names. An alternative could be to calculate the heap occupancy and provide that as a percentage, either an integer in the range 0 - 100 or floating point value in the range 0.0 - 1.0. 

      There is some precedent for exporting JVM metrics in ServerMetrics from ZOOKEEPER-3845

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              apurtell Andrew Kyle Purtell
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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