图片解析应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

17 lines
546 B

from __future__ import absolute_import
from kafka.metrics.stats.sampled_stat import AbstractSampledStat
class Max(AbstractSampledStat):
"""An AbstractSampledStat that gives the max over its samples."""
def __init__(self):
super(Max, self).__init__(float('-inf'))
def update(self, sample, config, value, now):
sample.value = max(sample.value, value)
def combine(self, samples, config, now):
if not samples:
return float('-inf')
return float(max(sample.value for sample in samples))