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

Commit

Permalink
Merge pull request #3658 from matrix-org/rav/fix_event_persisted_posi…
Browse files Browse the repository at this point in the history
…tion_metrics

Fix occasional glitches in the synapse_event_persisted_position metric
  • Loading branch information
richvdh committed Aug 7, 2018
2 parents 9b92720 + 865d07c commit e5d2c67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit e5d2c67

Please sign in to comment.