Andrew Kyle Purtell created ZOOKEEPER-4818:
----------------------------------------------

             Summary: Export JVM heap metrics in ServerMetrics
                 Key: ZOOKEEPER-4818
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4818
             Project: ZooKeeper
          Issue Type: Improvement
          Components: metric system
            Reporter: Andrew Kyle Purtell


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:
{noformat}
  - 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"
{noformat}
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. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to