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

Fix bugs in block metrics #2810

Merged
merged 1 commit into from
Jan 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions synapse/util/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
metrics = synapse.metrics.get_metrics_for(__name__)

# total number of times we have hit this block
response_count = metrics.register_counter(
block_counter = metrics.register_counter(
"block_count",
labels=["block_name"],
alternative_names=(
Expand Down Expand Up @@ -76,7 +76,7 @@
block_db_txn_duration = metrics.register_counter(
"block_db_txn_duration_seconds", labels=["block_name"],
alternative_names=(
metrics.name_prefix + "_block_db_txn_count:total",
metrics.name_prefix + "_block_db_txn_duration:total",
),
)

Expand Down Expand Up @@ -131,6 +131,8 @@ def __exit__(self, exc_type, exc_val, exc_tb):
return

duration = self.clock.time_msec() - self.start

block_counter.inc(self.name)
block_timer.inc_by(duration, self.name)

context = LoggingContext.current_context()
Expand Down