Skip to content
Browse files

Show more stats.

  • Loading branch information...
1 parent 2eb3caf commit 0a1d8e2bf21a337b5e4bfe5cf865a2b7b7eff90b @dustin dustin committed May 24, 2012
Showing with 33 additions and 12 deletions.
  1. +14 −1 static/vb2.html
  2. +19 −10 static/vbmap.js
  3. +0 −1 vbmap.go
View
15 static/vb2.html
@@ -58,6 +58,19 @@
</div>
<h2>Nodes</h2>
<ul id="nodes"></ul>
+ <form method="post" action="#">
+ <input type="radio" name="stat" value="num_items"
+ checked="checked">Number of Items</input>
+ <input type="radio" name="stat" value="ht_item_memory">Memory Size</input>
+ <input type="radio" name="stat"
+ value="pending_writes">Pending Writes</input>
+ <input type="radio" name="stat"
+ value="queue_size">Queue Size</input>
+ <input type="radio" name="stat"
+ value="num_resident">Resident Items</input>
+ <input type="radio" name="stat"
+ value="num_resident">Resident Items</input>
+ </form>
</div>
<script type="text/javascript">
@@ -67,7 +80,7 @@
$("#bucketid").val(clusterInfo.bucket || 'default');
var chart = makeVBStatThing(window.innerWidth - 50,
- window.innerHeight - 100,
+ window.innerHeight - 150,
'#levels');
function updateGraphs(json) {
View
29 static/vbmap.js
@@ -881,26 +881,35 @@ function makeVBStatThing(totalWidth, h, container) {
var w = 5;
- var maxvalue = 1;
-
var x;
var y;
var color = d3.scale.category20();
+ var maxvalue = {};
+ var prevstat = "";
+
chart.append("g").attr("class", "rulex");
chart.append("g").attr("class", "ruley");
chart.append("g").attr("class", "plot");
function update(json) {
+ var stat = $("input[@name=stat]:checked").val();
+ if (stat != prevstat) {
+ maxvalue[prevstat] = 0;
+ }
update.color = color;
var data = [];
- var total = 0;
+ var masters = {};
+ update.total = 0;
update.largeV = 0, update.largeN = 0, update.smallV = 0, update.smallN = 10000000000000;
for (var node in json.stats) {
var nstates = json.stats[node];
for (var vbid in nstates) {
- var n = parseInt(nstates[vbid].num_items);
+ if (nstates[vbid].state === 'active') {
+ masters[vbid] = node;
+ }
+ var n = parseInt(nstates[vbid][stat]);
if (n > update.largeN) {
update.largeN = n;
update.largeV = vbid;
@@ -910,13 +919,13 @@ function makeVBStatThing(totalWidth, h, container) {
update.smallV = vbid;
}
data[vbid] = n;
- total += n;
- maxvalue = Math.max(maxvalue, n);
+ update.total += n;
+ maxvalue[stat] = Math.max(maxvalue[stat] || 0, n);
}
}
function master(n) {
- return json.server_list[json.repmap[n][0]];
+ return masters[n];
}
w = Math.max(2, Math.floor(totalWidth / data.length));
@@ -926,7 +935,7 @@ function makeVBStatThing(totalWidth, h, container) {
.range([0, w]);
y = d3.scale.linear()
- .domain([0, maxvalue])
+ .domain([0, maxvalue[stat]])
.rangeRound([0, h]);
chart.select(".plot").selectAll("rect")
@@ -995,12 +1004,12 @@ function makeVBStatThing(totalWidth, h, container) {
.attr("dx", -25)
.attr("y", y)
.attr("text-anchor", "middle")
- .text(function(d) { return maxvalue - d; });
+ .text(function(d) { return maxvalue[stat] - d; });
chart.select(".ruley").selectAll(".rule")
.data(y.ticks(10))
.attr("y", y)
- .text(function(d) { return maxvalue - d; });
+ .text(function(d) { return maxvalue[stat] - d; });
chart.select(".ruley").selectAll(".rule")
.data(y.ticks(10))
View
1 vbmap.go
@@ -158,7 +158,6 @@ func vbHandler(w http.ResponseWriter, req *http.Request) {
rv := map[string]interface{}{}
rv["server_list"] = getShortServerList(bucket, commonSuffixMC)
rv["stats"] = getVbStats(bucket, commonSuffixMC)
- rv["repmap"] = bucket.VBucketServerMap.VBucketMap
req.ParseForm()
var_name := req.FormValue("name")

0 comments on commit 0a1d8e2

Please sign in to comment.
Something went wrong with that request. Please try again.