Skip to content

Commit

Permalink
Merge pull request #104 from flexoid/mongodb-mongos-fix
Browse files Browse the repository at this point in the history
Fix working with MongoDB's mongos router
  • Loading branch information
Gavin M. Roy committed Jul 27, 2013
2 parents fd78445 + 898492b commit 2c5243d
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions newrelic_plugin_agent/plugins/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,27 @@ def add_server_datapoints(self, stats):
timems.get('remapPrivateView', 0))

locks = stats.get('globalLock', dict())
self.add_derive_value('Global Locks/Held', 'us',
locks.get('lockTime', 0))
self.add_derive_value('Global Locks/Ratio', '',
locks.get('ratio', 0))

active = locks.get('activeClients')
self.add_derive_value('Global Locks/Active Clients/Total', '',
active.get('total', 0))
self.add_derive_value('Global Locks/Active Clients/Readers', '',
active.get('readers', 0))
self.add_derive_value('Global Locks/Active Clients/Writers', '',
active.get('writers', 0))

queue = locks.get('currentQueue')
self.add_derive_value('Global Locks/Queue/Total', '',
queue.get('total', 0))
self.add_derive_value('Global Locks/Queue/Readers', '',
queue.get('readers', 0))
self.add_derive_value('Global Locks/Queue/Writers', '',
queue.get('writers', 0))
if locks:
self.add_derive_value('Global Locks/Held', 'us',
locks.get('lockTime', 0))
self.add_derive_value('Global Locks/Ratio', '',
locks.get('ratio', 0))

active = locks.get('activeClients')
self.add_derive_value('Global Locks/Active Clients/Total', '',
active.get('total', 0))
self.add_derive_value('Global Locks/Active Clients/Readers', '',
active.get('readers', 0))
self.add_derive_value('Global Locks/Active Clients/Writers', '',
active.get('writers', 0))

queue = locks.get('currentQueue')
self.add_derive_value('Global Locks/Queue/Total', '',
queue.get('total', 0))
self.add_derive_value('Global Locks/Queue/Readers', '',
queue.get('readers', 0))
self.add_derive_value('Global Locks/Queue/Writers', '',
queue.get('writers', 0))

index = stats.get('indexCounters', dict())
self.add_derive_value('Index/Accesses', '', index.get('accesses', 0))
Expand Down

0 comments on commit 2c5243d

Please sign in to comment.