Skip to content

Commit

Permalink
add total stats without local db
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Waldvogel committed Feb 23, 2012
1 parent 38fd540 commit 4532ed8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gmetric-mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def writeStats(self):
"fileSize": "bytes", "dataSize": "bytes", "indexSize": "bytes", "storageSize": "bytes" }

totals = {}
totalsNoLocals = {}
for k in keys.keys():
totalsNoLocals[k] = 0
totals[k] = 0

for status in self.stats:
Expand All @@ -64,11 +66,15 @@ def writeStats(self):
value = status[k]
self.callGmetric({dbName + "_" + k: (value, v)})
totals[k] += value
if (dbName != "local"):
totalsNoLocals[k] += value

for k, v in keys.iteritems():
self.callGmetric({"total_" + k: (totals[k], v)})
self.callGmetric({"totalNoLocal_" + k: (totals[k], v)})

self.callGmetric({"total_dataAndIndexSize" : (totals["dataSize"]+totals["indexSize"], "bytes")})
self.callGmetric({"totalNoLocal_dataAndIndexSize" : (totalsNoLocals["dataSize"]+totalsNoLocals["indexSize"], "bytes")})

def callGmetric(self, d):
for k, v in d.iteritems():
Expand Down

0 comments on commit 4532ed8

Please sign in to comment.