Fix federation inbound age metric. (#10355)

We should be reporting the age rather than absolute timestamp.
This commit is contained in:
Erik Johnston 2021-07-13 11:33:15 +01:00 committed by GitHub
parent c2c364f27f
commit 879d8c1ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

1
changelog.d/10355.bugfix Normal file
View File

@ -0,0 +1 @@
Fix newly added `synapse_federation_server_oldest_inbound_pdu_in_staging` prometheus metric to measure age rather than timestamp.

View File

@ -1230,7 +1230,9 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas
"SELECT coalesce(min(received_ts), 0) FROM federation_inbound_events_staging" "SELECT coalesce(min(received_ts), 0) FROM federation_inbound_events_staging"
) )
(age,) = txn.fetchone() (received_ts,) = txn.fetchone()
age = self._clock.time_msec() - received_ts
return count, age return count, age