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

Commit

Permalink
expose ModuleApi.get_measure(name)
Browse files Browse the repository at this point in the history
Signed-off-by: jesopo <github@lolnerd.net>
  • Loading branch information
jesopo committed Apr 20, 2022
1 parent ecef741 commit bb56be8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions synapse/module_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
from synapse.util.async_helpers import maybe_awaitable
from synapse.util.caches.descriptors import cached
from synapse.util.frozenutils import freeze
from synapse.util.metrics import Measure

if TYPE_CHECKING:
from synapse.app.generic_worker import GenericWorkerSlavedStore
Expand Down Expand Up @@ -1350,6 +1351,15 @@ async def store_remote_3pid_association(
"""
await self._store.add_user_bound_threepid(user_id, medium, address, id_server)

def get_measure(self, name: str) -> Measure:
"""Create and return a synapse.utils.metrics.Measure to allow modules to report
metrics.
Args:
name: The name of the metric to report.
"""
return Measure(self._clock, name)


class PublicRoomListManager:
"""Contains methods for adding to, removing from and querying whether a room
Expand Down

0 comments on commit bb56be8

Please sign in to comment.