# HG changeset patch
# User arthur
# Date 1267164448 -3600
# Node ID 6035e96b64ddd110ed7dc9b8a0249d4c38a5738b
# Parent 8ae13d05985012fcce9458aeedab803f01f5bb1d
added stats for munin collecting #615844 - from 027bbff3659f
diff -r 8ae13d059850 -r 6035e96b64dd server/repository.py
--- a/server/repository.py Fri Feb 26 07:04:52 2010 +0100
+++ b/server/repository.py Fri Feb 26 07:07:28 2010 +0100
@@ -328,8 +328,8 @@
return self._available_pools.get(True, timeout=5)
except Queue.Empty:
raise Exception('no pool available after 5 secs, probably either a '
- 'bug in code (to many uncommited/rollbacked '
- 'connections) or to much load on the server (in '
+ 'bug in code (too many uncommited/rollbacked '
+ 'connections) or too much load on the server (in '
'which case you can try to set a bigger '
'connections pools size)')
@@ -383,6 +383,22 @@
except ZeroDivisionError:
pass
+ def stats(self):
+ results = {}
+ for hits, misses, title in (
+ (self.querier.cache_hit, self.querier.cache_miss, 'rqlt_st'),
+ (self.system_source.cache_hit, self.system_source.cache_miss, 'sql'),
+ ):
+ results['%s_cache_hit' % title] = hits
+ results['%s_cache_miss' % title] = misses
+ results['%s_cache_hit_percent' % title] = (hits * 100) / (hits + misses)
+
+ results['sql_no_cache'] = self.system_source.no_cache
+ results['nb_open_sessions'] = len(self._sessions)
+ results['nb_threads'] = len(self._running_threads)
+ results['available_pools'] = self._available_pools.qsize()
+ return results
+
def _login_from_email(self, login):
session = self.internal_session()
try:
diff -r 8ae13d059850 -r 6035e96b64dd web/views/management.py
--- a/web/views/management.py Fri Feb 26 07:04:52 2010 +0100
+++ b/web/views/management.py Fri Feb 26 07:07:28 2010 +0100
@@ -12,7 +12,7 @@
from logilab.mtconverter import xml_escape
from cubicweb.selectors import yes, none_rset, match_user_groups, authenticated_user
-from cubicweb.view import AnyRsetView, StartupView, EntityView
+from cubicweb.view import AnyRsetView, StartupView, EntityView, View
from cubicweb.uilib import html_traceback, rest_traceback
from cubicweb.web import formwidgets as wdgs
from cubicweb.web.formfields import guess_field
@@ -301,6 +301,15 @@
_('data directory url'), req.datadir_url))
self.w(u'')
self.w(u'
')
+ self.w(u'
%s | %s %s |
---|