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

Commit

Permalink
Merge pull request #3554 from matrix-org/erikj/response_metrics_code
Browse files Browse the repository at this point in the history
Add response code to response timer metrics
  • Loading branch information
erikjohnston authored Jul 19, 2018
2 parents 77091d7 + 5bd0a47 commit 6f62a6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/3554.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `code` label to `synapse_http_server_response_time_seconds` prometheus metric
9 changes: 6 additions & 3 deletions synapse/http/request_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
)

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(
Expand Down Expand Up @@ -171,11 +172,13 @@ def stop(self, time_sec, request):
)
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_timer.labels(request.method, self.name, tag).observe(
response_timer.labels(request.method, self.name, tag, response_code).observe(
time_sec - self.start
)

Expand Down

0 comments on commit 6f62a6e

Please sign in to comment.