summary refs log tree commit diff
path: root/synapse/appservice/api.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-06-10 12:26:14 +0300
committerMatthew Hodgson <matthew@matrix.org>2018-06-10 12:26:14 +0300
commitc96d882a02924a26f69c75cb988b06f3015d7578 (patch)
tree4b2fd1bea90831955841dfb33753ac553c439104 /synapse/appservice/api.py
parentMerge branch 'develop' into matthew/filter_members (diff)
parentMerge branch 'master' into develop (diff)
downloadsynapse-c96d882a02924a26f69c75cb988b06f3015d7578.tar.xz
Merge branch 'develop' into matthew/filter_members
Diffstat (limited to 'synapse/appservice/api.py')
-rw-r--r--synapse/appservice/api.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py
index 00efff1464..47251fb6ad 100644
--- a/synapse/appservice/api.py
+++ b/synapse/appservice/api.py
@@ -24,8 +24,27 @@ from synapse.types import ThirdPartyInstanceID
 import logging
 import urllib
 
+from prometheus_client import Counter
+
 logger = logging.getLogger(__name__)
 
+sent_transactions_counter = Counter(
+    "synapse_appservice_api_sent_transactions",
+    "Number of /transactions/ requests sent",
+    ["service"]
+)
+
+failed_transactions_counter = Counter(
+    "synapse_appservice_api_failed_transactions",
+    "Number of /transactions/ requests that failed to send",
+    ["service"]
+)
+
+sent_events_counter = Counter(
+    "synapse_appservice_api_sent_events",
+    "Number of events sent to the AS",
+    ["service"]
+)
 
 HOUR_IN_MS = 60 * 60 * 1000
 
@@ -219,12 +238,15 @@ class ApplicationServiceApi(SimpleHttpClient):
                 args={
                     "access_token": service.hs_token
                 })
+            sent_transactions_counter.labels(service.id).inc()
+            sent_events_counter.labels(service.id).inc(len(events))
             defer.returnValue(True)
             return
         except CodeMessageException as e:
             logger.warning("push_bulk to %s received %s", uri, e.code)
         except Exception as ex:
             logger.warning("push_bulk to %s threw exception %s", uri, ex)
+        failed_transactions_counter.labels(service.id).inc()
         defer.returnValue(False)
 
     def _serialize(self, events):