Skip to content

Commit

Permalink
Couple improvements imported from monitor-core
Browse files Browse the repository at this point in the history
  • Loading branch information
vvuksan committed Mar 23, 2014
1 parent 5049eda commit f036027
Showing 1 changed file with 42 additions and 6 deletions.
48 changes: 42 additions & 6 deletions memcached/python_modules/memcached.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ def shutdown(self):
self.shuttingdown = True
if not self.running:
return
self.join()
try:
self.join()
except:
pass

def run(self):
self.running = True
Expand Down Expand Up @@ -115,6 +118,9 @@ def metric_of(self, name):
_Lock.acquire()
val = self.metric[name]
_Lock.release()
# Value should never be negative. If it is counters wrapper due to e.g. memcached restart
if val < 0:
val = 0
return val

def metric_init(params):
Expand Down Expand Up @@ -209,16 +215,34 @@ def metric_init(params):
"description": "Number of open connections",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_evictions",
"name" : mp+"_decr_hits",
"units" : "items",
"slope" : "both",
"description": "Number of valid items removed from cache to free memory for new items",
"slope" : "positive",
"description": "Number of keys that have been decremented and found present ",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_decr_misses",
"units" : "items",
"slope" : "positive",
"description": "Number of items that have been decremented and not found",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_evictions_rate",
"name" : mp+"_delete_hits",
"units" : "items",
"slope" : "positive",
"description": "Number of keys that have been deleted and found present ",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_delete_misses",
"units" : "items",
"slope" : "positive",
"description": "Number of items that have been deleted and not found",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_evictions",
"units" : "items",
"slope" : "both",
"description": "Evictions per second",
"description": "Number of valid items removed from cache to free memory for new items",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_get_hits",
Expand All @@ -244,6 +268,18 @@ def metric_init(params):
"slope" : "both",
"description": "Misses per second",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_incr_hits",
"units" : "items",
"slope" : "positive",
"description": "Number of keys that have been incremented and found present ",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_incr_misses",
"units" : "items",
"slope" : "positive",
"description": "Number of items that have been incremented and not found",
}))
descriptors.append(create_desc(Desc_Skel, {
"name" : mp+"_cmd_get_rate",
"units" : "commands",
Expand Down

0 comments on commit f036027

Please sign in to comment.