Add necessary logging contexts

This commit is contained in:
Erik Johnston 2016-04-14 11:33:50 +01:00
parent 96bcfb29c7
commit 56da835eaf
1 changed files with 25 additions and 24 deletions

View File

@ -21,6 +21,7 @@ import logging
import push_rule_evaluator
import push_tools
from synapse.util.logcontext import LoggingContext
from synapse.util.metrics import Measure
logger = logging.getLogger(__name__)
@ -85,7 +86,6 @@ class HttpPusher(object):
@defer.inlineCallbacks
def on_new_notifications(self, min_stream_ordering, max_stream_ordering):
with Measure(self.clock, "push.on_new_notifications"):
self.max_stream_ordering = max(max_stream_ordering, self.max_stream_ordering)
yield self._process()
@ -95,6 +95,7 @@ class HttpPusher(object):
# We could check the receipts are actually m.read receipts here,
# but currently that's the only type of receipt anyway...
with LoggingContext("push._process"):
with Measure(self.clock, "push.on_new_receipts"):
badge = yield push_tools.get_badge_count(
self.hs.get_datastore(), self.user_id
@ -103,7 +104,6 @@ class HttpPusher(object):
@defer.inlineCallbacks
def on_timer(self):
with Measure(self.clock, "push.on_timer"):
yield self._process()
def on_stop(self):
@ -115,6 +115,7 @@ class HttpPusher(object):
if self.processing:
return
with LoggingContext("push._process"):
with Measure(self.clock, "push._process"):
try:
self.processing = True