From 4d52c1463e0616da070664a287902bea80b876f8 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sat, 26 Jul 2014 18:01:14 +0100
Subject: [PATCH] show number of partitions per target

---
 partition/debug.go  | 6 ++++++
 partition/status.go | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/partition/debug.go b/partition/debug.go
index 339c611..dd2623b 100644
--- a/partition/debug.go
+++ b/partition/debug.go
@@ -55,6 +55,7 @@ Versions:
    <th>Host</th>
    <th>Version</th>
    <th>Stamp</th>
+   <th>#Part</th>
    <th>#Items</th>
   </tr>
  </thead>
@@ -62,9 +63,14 @@ Versions:
  {{range $s := .GlobalStatus.Sort}}
   <tr>
    <td><a href="{{$s.Target | httpize}}/debug/part/{{.Name}}">{{$s.Target}}</a></td>
+   {{if $s.Err}}
+   <td colspan="4">{{$s.Err}}</td>
+   {{else}}
    <td>{{$s.Version}}</td>
    <td>{{$s.Stamp}}</td>
+   <td>{{$s.Partitions}}</td>
    <td>{{$s.Total}}</td>
+   {{end}}
   </tr>
  {{end}}
  </tbody>
diff --git a/partition/status.go b/partition/status.go
index 6bc7ba5..9606628 100644
--- a/partition/status.go
+++ b/partition/status.go
@@ -25,6 +25,10 @@ func (s PartitionStatus) Total() int {
 	return total
 }
 
+func (s PartitionStatus) Partitions() int {
+	return len(s.Counters)
+}
+
 type statusMap map[string]*PartitionStatus
 
 func (m statusMap) AllVersions() []string {
-- 
GitLab