You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/05/05 20:26:06 UTC
[allura] 02/08: [#8360] track more in timermiddleware
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/8360
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 9ef97f753c7fa65553eb5293d00ed9820a393360
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon May 4 17:35:36 2020 -0400
[#8360] track more in timermiddleware
---
Allura/allura/lib/custom_middleware.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index fab0520..1b21f92 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -33,6 +33,7 @@ import pysolr
import six
from allura.lib import helpers as h
+from allura import model as M
import allura.model.repository
from six.moves import range
@@ -308,6 +309,7 @@ class AlluraTimerMiddleware(TimerMiddleware):
import activitystream
import pygments
import difflib
+ import requests
timers = self.entry_point_timers() + [
Timer(
@@ -320,6 +322,7 @@ class AlluraTimerMiddleware(TimerMiddleware):
Timer('activitystream.activity_manager.{method_name}',
activitystream.managers.ActivityManager, '*'),
Timer('jinja', jinja2.Template, 'render', 'stream', 'generate'),
+ Timer('jinja.compile', jinja2.Environment, 'compile'),
Timer('markdown', markdown.Markdown, 'convert'),
Timer('ming', ming.odm.odmsession.ODMCursor, 'next', # FIXME: this may captures timings ok, but is misleading for counts
debug_each_call=False),
@@ -351,10 +354,13 @@ class AlluraTimerMiddleware(TimerMiddleware):
'flush', debug_each_call=False),
Timer('solr', pysolr.Solr, 'add', 'delete', 'search', 'commit'),
Timer('urlopen', urlopen_pkg, 'urlopen'),
+ Timer('requests.get', requests, 'get'),
Timer('base_repo_tool.{method_name}',
allura.model.repository.RepositoryImplementation, 'last_commit_ids'),
Timer('pygments', pygments, 'highlight'), # often called from within a template so will overlap w/ jinja
Timer('difflib', difflib, '_mdiff', 'unified_diff'),
+ Timer('logging', logging.Logger, '_log', debug_each_call=False),
+ Timer('navbar', M.Project, 'nav_data', 'grouped_navbar_entries'),
] + [Timer('sidebar', ep.load(), 'sidebar_menu') for ep in tool_entry_points]
try:
@@ -368,6 +374,13 @@ class AlluraTimerMiddleware(TimerMiddleware):
'bind_s', 'unbind_s', 'add_s', 'modify_s', 'search_s'),
]
+ if self.config.get('memcached_host'):
+ import pylibmc
+ timers += [
+ Timer('memcache.get', pylibmc.client.Client, 'get'),
+ Timer('memcache.set', pylibmc.client.Client, 'set'),
+ ]
+
return timers
def before_logging(self, stat_record):