Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix synapse_event_persisted_position metric
Browse files Browse the repository at this point in the history
Fixes a bug introduced in #11417 where we would only included backfilled events
in `synapse_event_persisted_position`
  • Loading branch information
richvdh committed Apr 6, 2022
1 parent 573cd0f commit 9888b8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/12390.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in Synapse 1.49.0 which caused the `synapse_event_persisted_position` metric to have invalid values.
6 changes: 3 additions & 3 deletions synapse/storage/databases/main/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ async def _persist_events_and_state_updates(
)
persist_event_counter.inc(len(events_and_contexts))

if stream < 0:
# backfilled events have negative stream orderings, so we don't
# want to set the event_persisted_position to that.
if not use_negative_stream_ordering:
# we don't want to set the event_persisted_position to a negative
# stream_ordering.
synapse.metrics.event_persisted_position.set(
events_and_contexts[-1][0].internal_metadata.stream_ordering
)
Expand Down

0 comments on commit 9888b8b

Please sign in to comment.