summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--changelog.d/10156.misc1
-rw-r--r--synapse/handlers/federation.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/changelog.d/10156.misc b/changelog.d/10156.misc
new file mode 100644
index 0000000000..92a188b87b
--- /dev/null
+++ b/changelog.d/10156.misc
@@ -0,0 +1 @@
+Add `synapse_federation_soft_failed_events_total` metric to track how often events are soft failed.
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 6e40e2c216..6647063485 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -33,6 +33,7 @@ from typing import (
 )
 
 import attr
+from prometheus_client import Counter
 from signedjson.key import decode_verify_key_bytes
 from signedjson.sign import verify_signed_json
 from unpaddedbase64 import decode_base64
@@ -101,6 +102,11 @@ if TYPE_CHECKING:
 
 logger = logging.getLogger(__name__)
 
+soft_failed_event_counter = Counter(
+    "synapse_federation_soft_failed_events_total",
+    "Events received over federation that we marked as soft_failed",
+)
+
 
 @attr.s(slots=True)
 class _NewEventInfo:
@@ -2498,6 +2504,7 @@ class FederationHandler(BaseHandler):
             event_auth.check(room_version_obj, event, auth_events=current_auth_events)
         except AuthError as e:
             logger.warning("Soft-failing %r because %s", event, e)
+            soft_failed_event_counter.inc()
             event.internal_metadata.soft_failed = True
 
     async def on_get_missing_events(