diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-03-10 18:24:52 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-03-12 16:24:51 +0000 |
commit | c782e893ec5ceaf7e8136f45c9e6cfa8b11ec653 (patch) | |
tree | a250f93458dc8f5574ef332b2dcbd239e428ade4 /synapse/federation | |
parent | Add a counter to track total number of events served by the notifier (diff) | |
download | synapse-c782e893ec5ceaf7e8136f45c9e6cfa8b11ec653.tar.xz |
Neater metrics from TransactionQueue
Diffstat (limited to '')
-rw-r--r-- | synapse/federation/transaction_queue.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py index ca5bcf21cf..99e386fa52 100644 --- a/synapse/federation/transaction_queue.py +++ b/synapse/federation/transaction_queue.py @@ -57,27 +57,29 @@ class TransactionQueue(object): # done self.pending_transactions = {} + metrics.register_callback("pending_destinations", + lambda: len(self.pending_transactions), + ) + # Is a mapping from destination -> list of # tuple(pending pdus, deferred, order) self.pending_pdus_by_dest = pdus = {} # destination -> list of tuple(edu, deferred) self.pending_edus_by_dest = edus = {} + metrics.register_callback("pending_pdus", + lambda: sum(map(len, pdus.values())), + ) + metrics.register_callback("pending_edus", + lambda: sum(map(len, edus.values())), + ) + # destination -> list of tuple(failure, deferred) self.pending_failures_by_dest = {} # HACK to get unique tx id self._next_txn_id = int(self._clock.time_msec()) - metrics.register_callback("pendingPdus", - lambda: {(dest,): len(pdus[dest]) for dest in pdus.keys()}, - labels=["dest"], - ) - metrics.register_callback("pendingEdus", - lambda: {(dest,): len(edus[dest]) for dest in edus.keys()}, - labels=["dest"], - ) - def can_send_to(self, destination): """Can we send messages to the given server? |