diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-08-07 14:48:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-07 14:48:08 +0100 |
commit | e5d2c678442af6fb3dd5d08829e3eedc61b4950e (patch) | |
tree | 77f646593a31544cf50ee67765bacf4083452a5a | |
parent | fix event lag graph (diff) | |
parent | changelog (diff) | |
download | synapse-e5d2c678442af6fb3dd5d08829e3eedc61b4950e.tar.xz |
Merge pull request #3658 from matrix-org/rav/fix_event_persisted_position_metrics
Fix occasional glitches in the synapse_event_persisted_position metric
-rw-r--r-- | changelog.d/3658.bugfix | 1 | ||||
-rw-r--r-- | synapse/storage/events.py | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/changelog.d/3658.bugfix b/changelog.d/3658.bugfix new file mode 100644 index 0000000000..556011a150 --- /dev/null +++ b/changelog.d/3658.bugfix @@ -0,0 +1 @@ +Fix occasional glitches in the synapse_event_persisted_position metric diff --git a/synapse/storage/events.py b/synapse/storage/events.py index e8e5a0fe44..ce32e8fefd 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -485,9 +485,14 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore 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" |