diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index e039b4aac..cf992e313 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -697,6 +697,22 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase): # the key, which should cause the download to fail the post-download # plaintext_hash check. + def test_statistics_for_magic_folder(self): + self.basedir = "system/SystemTest/test_statistics_for_magic_folder" + d = self.set_up_nodes() + # see if the statistics page exists + d.addCallback(lambda res: self.GET("statistics")) + def _got_stats(res): + self.failUnlessIn("Operational Statistics", res) + self.failUnlessIn("Magic Folder", res) + d.addCallback(_got_stats) + d.addCallback(lambda res: self.GET("statistics?t=json")) + def _got_stats_json(res): + data = simplejson.loads(res) + #self.failUnlessEqual(data["counters"]["uploader.files_uploaded"], 0) + d.addCallback(_got_stats_json) + return d + def test_filesystem(self): self.basedir = "system/SystemTest/test_filesystem" self.data = LARGE_DATA diff --git a/src/allmydata/web/statistics.xhtml b/src/allmydata/web/statistics.xhtml index 1e173273e..fac0607e7 100644 --- a/src/allmydata/web/statistics.xhtml +++ b/src/allmydata/web/statistics.xhtml @@ -20,13 +20,16 @@
  • Files Retrieved (mutable):
  • -

    Drop-Uploader

    +

    Magic Folder

    Raw Stats:

    diff --git a/src/allmydata/web/status.py b/src/allmydata/web/status.py index d76ebfd7d..4064e2820 100644 --- a/src/allmydata/web/status.py +++ b/src/allmydata/web/status.py @@ -1273,21 +1273,34 @@ class Statistics(rend.Page): return "%s files / %s bytes (%s)" % (files, bytes, abbreviate_size(bytes)) - def render_drop_monitored(self, ctx, data): - dirs = data["counters"].get("drop_upload.dirs_monitored", 0) + def render_magic_uploader_monitored(self, ctx, data): + dirs = data["counters"].get("magic_folder.uploader.dirs_monitored", 0) return "%s directories" % (dirs,) - def render_drop_uploads(self, ctx, data): + def render_magic_uploader_succeeded(self, ctx, data): # TODO: bytes uploaded - files = data["counters"].get("drop_upload.files_uploaded", 0) + files = data["counters"].get("magic_folder.uploader.objects_succeeded", 0) return "%s files" % (files,) - def render_drop_queued(self, ctx, data): - files = data["counters"].get("drop_upload.files_queued", 0) + def render_magic_uploader_queued(self, ctx, data): + files = data["counters"].get("magic_folder.uploader.objects_queued", 0) return "%s files" % (files,) - def render_drop_failed(self, ctx, data): - files = data["counters"].get("drop_upload.files_failed", 0) + def render_magic_uploader_failed(self, ctx, data): + files = data["counters"].get("magic_folder.uploader.objects_failed", 0) + return "%s files" % (files,) + + def render_magic_downloader_succeeded(self, ctx, data): + # TODO: bytes uploaded + files = data["counters"].get("magic_folder.downloader.objects_succeeded", 0) + return "%s files" % (files,) + + def render_magic_downloader_queued(self, ctx, data): + files = data["counters"].get("magic_folder.downloader.objects_queued", 0) + return "%s files" % (files,) + + def render_magic_downloader_failed(self, ctx, data): + files = data["counters"].get("magic_folder.downloader.objects_failed", 0) return "%s files" % (files,) def render_raw(self, ctx, data):