Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
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

@squahtx

Description

@squahtx

When handling a /pushers/set request, Synapse removes any matching pushers belonging to a different user, then calls PusherPool.add_pusher:

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:

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

No one assigned

    Labels

    A-PushIssues related to push/notificationsS-TolerableMinor significance, cosmetic issues, low or no impact to users.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions