mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-09 11:51:21 +00:00
mutable stats: track mutable bytes published too
This commit is contained in:
parent
3be921174b
commit
4b3adb3fcf
@ -307,8 +307,9 @@ class Client(node.Node, testutil.PollMixin):
|
||||
assert IMutableFileURI.providedBy(u), u
|
||||
return MutableFileNode(self).init_from_uri(u)
|
||||
|
||||
def notify_publish(self, publish_status):
|
||||
self.getServiceNamed("mutable-watcher").notify_publish(publish_status)
|
||||
def notify_publish(self, publish_status, size):
|
||||
self.getServiceNamed("mutable-watcher").notify_publish(publish_status,
|
||||
size)
|
||||
def notify_retrieve(self, retrieve_status):
|
||||
self.getServiceNamed("mutable-watcher").notify_retrieve(retrieve_status)
|
||||
def notify_mapupdate(self, update_status):
|
||||
|
@ -381,7 +381,7 @@ class MutableFileNode:
|
||||
def _upload(self, new_contents, servermap):
|
||||
assert self._pubkey, "update_servermap must be called before publish"
|
||||
p = Publish(self, servermap)
|
||||
self._client.notify_publish(p.get_status())
|
||||
self._client.notify_publish(p.get_status(), len(new_contents))
|
||||
return p.publish(new_contents)
|
||||
|
||||
|
||||
@ -410,16 +410,16 @@ class MutableWatcher(service.MultiService):
|
||||
while len(self._recent_mapupdate_status) > self.MAX_MAPUPDATE_STATUSES:
|
||||
self._recent_mapupdate_status.pop(0)
|
||||
|
||||
def notify_publish(self, p):
|
||||
def notify_publish(self, p, size):
|
||||
self._all_publish_status[p] = None
|
||||
self._recent_publish_status.append(p)
|
||||
if self.stats_provider:
|
||||
self.stats_provider.count('mutable.files_published', 1)
|
||||
# bytes_published can't be handled here, because the
|
||||
# We must be told bytes_published as an argument, since the
|
||||
# publish_status does not yet know how much data it will be asked
|
||||
# to send. TODO: figure out a clean way to do this that doesn't
|
||||
# make MDMF harder.
|
||||
#self.stats_provider.count('mutable.bytes_published', p.get_size())
|
||||
# to send. When we move to MDMF we'll need to find a better way
|
||||
# to handle this.
|
||||
self.stats_provider.count('mutable.bytes_published', size)
|
||||
while len(self._recent_publish_status) > self.MAX_PUBLISH_STATUSES:
|
||||
self._recent_publish_status.pop(0)
|
||||
|
||||
|
@ -947,24 +947,28 @@ class Statistics(rend.Page):
|
||||
return str(data["stats"].get("load_monitor.max_load"))
|
||||
|
||||
def render_uploads(self, ctx, data):
|
||||
files = data["counters"].get("uploader.files_uploaded")
|
||||
bytes = data["counters"].get("uploader.bytes_uploaded")
|
||||
files = data["counters"].get("uploader.files_uploaded", 0)
|
||||
bytes = data["counters"].get("uploader.bytes_uploaded", 0)
|
||||
return ("%s files / %s bytes (%s)" %
|
||||
(files, bytes, abbreviate_size(bytes)))
|
||||
|
||||
def render_downloads(self, ctx, data):
|
||||
files = data["counters"].get("downloader.files_downloaded")
|
||||
bytes = data["counters"].get("downloader.bytes_downloaded")
|
||||
files = data["counters"].get("downloader.files_downloaded", 0)
|
||||
bytes = data["counters"].get("downloader.bytes_downloaded", 0)
|
||||
return ("%s files / %s bytes (%s)" %
|
||||
(files, bytes, abbreviate_size(bytes)))
|
||||
|
||||
def render_publishes(self, ctx, data):
|
||||
files = data["counters"].get("mutable.files_published")
|
||||
return "%s files" % (files,)
|
||||
bytes = data["counters"].get("mutable.bytes_published", 0)
|
||||
return "%s files / %s bytes (%s)" % (files, bytes,
|
||||
abbreviate_size(bytes))
|
||||
|
||||
def render_retrieves(self, ctx, data):
|
||||
files = data["counters"].get("mutable.files_retrieved")
|
||||
return "%s files" % (files,)
|
||||
bytes = data["counters"].get("mutable.bytes_retrieved", 0)
|
||||
return "%s files / %s bytes (%s)" % (files, bytes,
|
||||
abbreviate_size(bytes))
|
||||
|
||||
def render_raw(self, ctx, data):
|
||||
raw = pprint.pformat(data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user