def _update_request_stats()

in zktraffic/stats/accumulators.py [0:0]


  def _update_request_stats(self, path, request):
    """ here we actually update the stats for a given request """

    # things like Connect() don't have a path so for consistency treat it
    # as /.
    if not path:
      path = '/'

    self._cur_stats[request.name][path] += 1

    if self._include_bytes:
      self._cur_stats["%sBytes" % (request.name)][path] += request.size

    if request.is_write:
      self._cur_stats["writes"][path] += 1
      self._cur_stats["total"]["/writes"] += 1

      if self._include_bytes:
        self._cur_stats["writesBytes"][path] += request.size
        self._cur_stats["total"]["/writeBytes"] += request.size
    else:
      self._cur_stats["reads"][path] += 1
      self._cur_stats["total"]["/reads"] += 1

      if self._include_bytes:
        self._cur_stats["readsBytes"][path] += request.size
        self._cur_stats["total"]["/readBytes"] += request.size

      if request.watch:
        self._cur_stats["watches"][path] += 1