Cue / scales

scales - Metrics for Python
Apache License 2.0
920 stars 73 forks source link

Question concerning `real` value of PmfStat #41

Open dannyOhNo opened 8 years ago

dannyOhNo commented 8 years ago

via src/greplin/scales/__init__.py

def addValue(self, value):
    """Updates the dictionary."""
    self['count'] += 1
    self.__sample.update(value)
    if time.time() > self.__timestamp + 20 and len(self.__sample) > 1:
      self.__timestamp = time.time()
      self['min'] = self.__sample.min
      self['max'] = self.__sample.max
      self['mean'] = self.__sample.mean
      self['stddev'] = self.__sample.stddev

      percentiles = self.__sample.percentiles([0.5, 0.75, 0.95, 0.98, 0.99, 0.999])
      self['median'] = percentiles[0]
      self['75percentile'] = percentiles[1]
      self['95percentile'] = percentiles[2]
      self['98percentile'] = percentiles[3]
      self['99percentile'] = percentiles[4]
      self.percentile99 = percentiles[4]
      self['999percentile'] = percentiles[5]

Several stats about the current metric are saved. However, it doesn't appear that the raw value is being preserved. Is this correct? If so, what is the reason this value isn't being preserved?

Inserting self['value'] = value in the above statement worked locally.