mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Merge pull request #3554 from matrix-org/erikj/response_metrics_code
Add response code to response timer metrics
This commit is contained in:
commit
6f62a6ef21
1
changelog.d/3554.feature
Normal file
1
changelog.d/3554.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add `code` label to `synapse_http_server_response_time_seconds` prometheus metric
|
@ -38,7 +38,8 @@ outgoing_responses_counter = Counter(
|
|||||||
)
|
)
|
||||||
|
|
||||||
response_timer = Histogram(
|
response_timer = Histogram(
|
||||||
"synapse_http_server_response_time_seconds", "sec", ["method", "servlet", "tag"]
|
"synapse_http_server_response_time_seconds", "sec",
|
||||||
|
["method", "servlet", "tag", "code"],
|
||||||
)
|
)
|
||||||
|
|
||||||
response_ru_utime = Counter(
|
response_ru_utime = Counter(
|
||||||
@ -171,11 +172,13 @@ class RequestMetrics(object):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
outgoing_responses_counter.labels(request.method, str(request.code)).inc()
|
response_code = str(request.code)
|
||||||
|
|
||||||
|
outgoing_responses_counter.labels(request.method, response_code).inc()
|
||||||
|
|
||||||
response_count.labels(request.method, self.name, tag).inc()
|
response_count.labels(request.method, self.name, tag).inc()
|
||||||
|
|
||||||
response_timer.labels(request.method, self.name, tag).observe(
|
response_timer.labels(request.method, self.name, tag, response_code).observe(
|
||||||
time_sec - self.start
|
time_sec - self.start
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user