Add debug logging for when room keys are uploaded, including whether they are replacing other room keys. (#17266)
Fixes: #17013 Add logging for whether room keys are replaced This is motivated by the Crypto team who need to diagnose crypto issues. The existing opentracing logging is not enough because it is not enabled for all users.
This commit is contained in:
parent
4a7c58642c
commit
17d6c28285
|
@ -0,0 +1 @@
|
||||||
|
Add debug logging for when room keys are uploaded, including whether they are replacing other room keys.
|
|
@ -247,6 +247,12 @@ class E2eRoomKeysHandler:
|
||||||
if current_room_key:
|
if current_room_key:
|
||||||
if self._should_replace_room_key(current_room_key, room_key):
|
if self._should_replace_room_key(current_room_key, room_key):
|
||||||
log_kv({"message": "Replacing room key."})
|
log_kv({"message": "Replacing room key."})
|
||||||
|
logger.debug(
|
||||||
|
"Replacing room key. room=%s session=%s user=%s",
|
||||||
|
room_id,
|
||||||
|
session_id,
|
||||||
|
user_id,
|
||||||
|
)
|
||||||
# updates are done one at a time in the DB, so send
|
# updates are done one at a time in the DB, so send
|
||||||
# updates right away rather than batching them up,
|
# updates right away rather than batching them up,
|
||||||
# like we do with the inserts
|
# like we do with the inserts
|
||||||
|
@ -256,6 +262,12 @@ class E2eRoomKeysHandler:
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
log_kv({"message": "Not replacing room_key."})
|
log_kv({"message": "Not replacing room_key."})
|
||||||
|
logger.debug(
|
||||||
|
"Not replacing room key. room=%s session=%s user=%s",
|
||||||
|
room_id,
|
||||||
|
session_id,
|
||||||
|
user_id,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
log_kv(
|
log_kv(
|
||||||
{
|
{
|
||||||
|
@ -265,6 +277,12 @@ class E2eRoomKeysHandler:
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
log_kv({"message": "Replacing room key."})
|
log_kv({"message": "Replacing room key."})
|
||||||
|
logger.debug(
|
||||||
|
"Inserting new room key. room=%s session=%s user=%s",
|
||||||
|
room_id,
|
||||||
|
session_id,
|
||||||
|
user_id,
|
||||||
|
)
|
||||||
to_insert.append((room_id, session_id, room_key))
|
to_insert.append((room_id, session_id, room_key))
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue