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 #4445 from matrix-org/anoa/user_dir_develop_backport
Browse files Browse the repository at this point in the history
Add metric for user dir current event stream position
  • Loading branch information
anoadragon453 authored Jan 23, 2019
2 parents a0ae475 + cb0e637 commit 6b90ae6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/4445.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a metric for tracking event stream position of the user directory.
6 changes: 6 additions & 0 deletions synapse/handlers/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from twisted.internet import defer

import synapse.metrics
from synapse.api.constants import EventTypes, JoinRules, Membership
from synapse.metrics.background_process_metrics import run_as_background_process
from synapse.storage.roommember import ProfileInfo
Expand Down Expand Up @@ -163,6 +164,11 @@ def _unsafe_process(self):
yield self._handle_deltas(deltas)

self.pos = deltas[-1]["stream_id"]

# Expose current event processing position to prometheus
synapse.metrics.event_processing_positions.labels(
"user_dir").set(self.pos)

yield self.store.update_user_directory_stream_pos(self.pos)

@defer.inlineCallbacks
Expand Down

0 comments on commit 6b90ae6

Please sign in to comment.