

def sample(self, value, sample_rate, timestamp=None):
    if (self.curr_counter is None):
        self.curr_counter = value
    else:
        self.prev_counter = self.curr_counter
        self.curr_counter = value
    prev = self.prev_counter
    curr = self.curr_counter
    if ((prev is not None) and (curr is not None)):
        self.count = ((self.count or 0) + max(0, (curr - prev)))
    self.last_sample_time = time()

dataset/ETHPy150Open serverdensity/sd-agent/aggregator.py MonotonicCount.sample/original