From bffe14ef3e58224d0d455a975ae137788e93032c Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Fri, 11 Jul 2008 21:34:36 -0700
Subject: [PATCH] add 1%,10% percentiles to the storage server latency output

---
 src/allmydata/storage.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/allmydata/storage.py b/src/allmydata/storage.py
index 513b486f..775c47e3 100644
--- a/src/allmydata/storage.py
+++ b/src/allmydata/storage.py
@@ -821,10 +821,10 @@ class StorageServer(service.MultiService, Referenceable):
     def get_latencies(self):
         """Return a dict, indexed by category, that contains a dict of
         latency numbers for each category. Each dict will contain the
-        following keys: mean, median, 90_percentile, 95_percentile,
-        99_percentile). If no samples have been collected for the given
-        category, then that category name will not be present in the return
-        value."""
+        following keys: mean, median, 1_percentile, 10_percentile,
+        90_percentile, 95_percentile, 99_percentile, 999_percentile. If no
+        samples have been collected for the given category, then that
+        category name will not be present in the return value."""
         # note that Amazon's Dynamo paper says they use 99.9% percentile.
         output = {}
         for category in self.latencies:
@@ -835,6 +835,8 @@ class StorageServer(service.MultiService, Referenceable):
             samples.sort()
             count = len(samples)
             stats["mean"] = sum(samples) / count
+            stats["1_percentile"] = samples[int(0.01 * count)]
+            stats["10_percentile"] = samples[int(0.1 * count)]
             stats["median"] = samples[int(0.5 * count)]
             stats["90_percentile"] = samples[int(0.9 * count)]
             stats["95_percentile"] = samples[int(0.95 * count)]
-- 
2.45.2