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

Commit 64d9900

Browse files
committed
Add specific metric to time long-running /messages requests
Split out from #13478 (comment)
1 parent 1b09b08 commit 64d9900

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

synapse/rest/client/room.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
from typing import TYPE_CHECKING, Awaitable, Dict, List, Optional, Tuple
2020
from urllib import parse as urlparse
2121

22+
from prometheus_client.core import Histogram
23+
2224
from twisted.web.server import Request
2325

2426
from synapse import event_auth
@@ -60,6 +62,30 @@
6062

6163
logger = logging.getLogger(__name__)
6264

65+
messsages_response_timer = Histogram(
66+
"synapse_room_message_list_rest_servlet_response_time_seconds",
67+
"sec",
68+
[],
69+
buckets=(
70+
0.005,
71+
0.01,
72+
0.025,
73+
0.05,
74+
0.1,
75+
0.25,
76+
0.5,
77+
1.0,
78+
2.5,
79+
5.0,
80+
10.0,
81+
30.0,
82+
60.0,
83+
120.0,
84+
180.0,
85+
"+Inf",
86+
),
87+
)
88+
6389

6490
class TransactionRestServlet(RestServlet):
6591
def __init__(self, hs: "HomeServer"):
@@ -560,6 +586,7 @@ def __init__(self, hs: "HomeServer"):
560586
self.auth = hs.get_auth()
561587
self.store = hs.get_datastores().main
562588

589+
@messsages_response_timer.time()
563590
async def on_GET(
564591
self, request: SynapseRequest, room_id: str
565592
) -> Tuple[int, JsonDict]:

0 commit comments

Comments
 (0)