summary refs log tree commit diff
path: root/synapse/federation
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-08-10 14:16:14 +0100
committerGitHub <noreply@github.com>2016-08-10 14:16:14 +0100
commit5aeadb74144c8fd6b4c4398adc8e832c0296eee5 (patch)
treecb1e28f93b02d6aab74e60f2e5e1da42049cbafe /synapse/federation
parentMerge pull request #998 from matrix-org/erikj/pdu_fail_cache (diff)
parentMeasure federation send transaction resources (diff)
downloadsynapse-5aeadb74144c8fd6b4c4398adc8e832c0296eee5.tar.xz
Merge pull request #999 from matrix-org/erikj/measure_more
Measure federation send transaction resources
Diffstat (limited to 'synapse/federation')
-rw-r--r--synapse/federation/transaction_queue.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py
index 5787f854d4..bbeec61f7a 100644
--- a/synapse/federation/transaction_queue.py
+++ b/synapse/federation/transaction_queue.py
@@ -26,6 +26,7 @@ from synapse.util.logcontext import PreserveLoggingContext
 from synapse.util.retryutils import (
     get_retry_limiter, NotRetryingDestination,
 )
+from synapse.util.metrics import measure_func
 import synapse.metrics
 
 import logging
@@ -51,7 +52,7 @@ class TransactionQueue(object):
 
         self.transport_layer = transport_layer
 
-        self._clock = hs.get_clock()
+        self.clock = hs.get_clock()
 
         # Is a mapping from destinations -> deferreds. Used to keep track
         # of which destinations have transactions in flight and when they are
@@ -82,7 +83,7 @@ class TransactionQueue(object):
         self.pending_failures_by_dest = {}
 
         # HACK to get unique tx id
-        self._next_txn_id = int(self._clock.time_msec())
+        self._next_txn_id = int(self.clock.time_msec())
 
     def can_send_to(self, destination):
         """Can we send messages to the given server?
@@ -197,6 +198,7 @@ class TransactionQueue(object):
 
         yield deferred
 
+    @measure_func("attempt_new_transaction")
     @defer.inlineCallbacks
     @log_function
     def _attempt_new_transaction(self, destination):
@@ -246,7 +248,7 @@ class TransactionQueue(object):
 
             limiter = yield get_retry_limiter(
                 destination,
-                self._clock,
+                self.clock,
                 self.store,
             )
 
@@ -262,7 +264,7 @@ class TransactionQueue(object):
             logger.debug("TX [%s] Persisting transaction...", destination)
 
             transaction = Transaction.create_new(
-                origin_server_ts=int(self._clock.time_msec()),
+                origin_server_ts=int(self.clock.time_msec()),
                 transaction_id=txn_id,
                 origin=self.server_name,
                 destination=destination,
@@ -293,7 +295,7 @@ class TransactionQueue(object):
                 # keys work
                 def json_data_cb():
                     data = transaction.get_dict()
-                    now = int(self._clock.time_msec())
+                    now = int(self.clock.time_msec())
                     if "pdus" in data:
                         for p in data["pdus"]:
                             if "age_ts" in p: