def get_heap(self, metric): """ get terracotta heap memory metrics """ st = ZTCStore('java.terracotta.heap', self.options) st.ttl = 60 data = st.get() if not data: # no cache, get from jmx data = self.get_prop('java.lang:type=Memory', 'HeapMemoryUsage') st.set(data) rt = self.extract_val_from_dict(data, metric) if rt is None: raise CheckFail('no such memory mertic') else: return rt
def get_codecache(self, metric): """ get java codecache memory (non-heap) metrics """ self.logger.debug('in get_codecache') st = ZTCStore('java.terracotta.codecache', self.options) st.ttl = 60 data = st.get() if not data: # no cache, get from jmx data = self.get_prop('java.lang:name=Code Cache,type=MemoryPool', 'Usage') st.set(data) rt = self.extract_val_from_dict(data, metric) if rt is None: raise CheckFail('no such memory mertic') else: return rt