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

Fix occasional glitches in the synapse_event_persisted_position metric #3658

Merged
merged 2 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3658.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix occasional glitches in the synapse_event_persisted_position metric
11 changes: 8 additions & 3 deletions synapse/storage/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,14 @@ def _persist_events(self, events_and_contexts, backfilled=False,
new_forward_extremeties=new_forward_extremeties,
)
persist_event_counter.inc(len(chunk))
synapse.metrics.event_persisted_position.set(
chunk[-1][0].internal_metadata.stream_ordering,
)

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

for event, context in chunk:
if context.app_service:
origin_type = "local"
Expand Down