This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
synapse_pushers
metric overcounts on every /pushers/set
request #13295
Copy link
Copy link
Closed
Labels
A-PushIssues related to push/notificationsIssues related to push/notificationsS-TolerableMinor significance, cosmetic issues, low or no impact to users.Minor significance, cosmetic issues, low or no impact to users.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Description
When handling a /pushers/set
request, Synapse removes any matching pushers belonging to a different user, then calls PusherPool.add_pusher
:
synapse/synapse/rest/client/pusher.py
Lines 106 to 125 in fe1daad
if not append: | |
await self.pusher_pool.remove_pushers_by_app_id_and_pushkey_not_user( | |
app_id=content["app_id"], | |
pushkey=content["pushkey"], | |
not_user_id=user.to_string(), | |
) | |
try: | |
await self.pusher_pool.add_pusher( | |
user_id=user.to_string(), | |
access_token=requester.access_token_id, | |
kind=content["kind"], | |
app_id=content["app_id"], | |
app_display_name=content["app_display_name"], | |
device_display_name=content["device_display_name"], | |
pushkey=content["pushkey"], | |
lang=content["lang"], | |
data=content["data"], | |
profile_tag=content.get("profile_tag", ""), | |
) |
PusherPool.add_pusher
eventually creates a new pusher to replace the existing one:
synapse/synapse/push/pusherpool.py
Lines 354 to 359 in e24ff8e
byuser = self.pushers.setdefault(pusher_config.user_name, {}) | |
if appid_pushkey in byuser: | |
byuser[appid_pushkey].on_stop() | |
byuser[appid_pushkey] = p | |
synapse_pushers.labels(type(p).__name__, p.app_id).inc() |
Critically, it increments the synapse_pushers
metric, regardless of whether it replaced an existing pusher, so stopped pushers can be included in the count.
Metadata
Metadata
Assignees
Labels
A-PushIssues related to push/notificationsIssues related to push/notificationsS-TolerableMinor significance, cosmetic issues, low or no impact to users.Minor significance, cosmetic issues, low or no impact to users.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.Bugs, crashes, hangs, security vulnerabilities, or other reported issues.