forked from MirrorHub/synapse
parent
d6af5512bb
commit
d57765fc8a
1 changed files with 4 additions and 2 deletions
|
@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
|
||||||
metrics = synapse.metrics.get_metrics_for(__name__)
|
metrics = synapse.metrics.get_metrics_for(__name__)
|
||||||
|
|
||||||
# total number of times we have hit this block
|
# total number of times we have hit this block
|
||||||
response_count = metrics.register_counter(
|
block_counter = metrics.register_counter(
|
||||||
"block_count",
|
"block_count",
|
||||||
labels=["block_name"],
|
labels=["block_name"],
|
||||||
alternative_names=(
|
alternative_names=(
|
||||||
|
@ -76,7 +76,7 @@ block_db_txn_count = metrics.register_counter(
|
||||||
block_db_txn_duration = metrics.register_counter(
|
block_db_txn_duration = metrics.register_counter(
|
||||||
"block_db_txn_duration_seconds", labels=["block_name"],
|
"block_db_txn_duration_seconds", labels=["block_name"],
|
||||||
alternative_names=(
|
alternative_names=(
|
||||||
metrics.name_prefix + "_block_db_txn_count:total",
|
metrics.name_prefix + "_block_db_txn_duration:total",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -131,6 +131,8 @@ class Measure(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
duration = self.clock.time_msec() - self.start
|
duration = self.clock.time_msec() - self.start
|
||||||
|
|
||||||
|
block_counter.inc(self.name)
|
||||||
block_timer.inc_by(duration, self.name)
|
block_timer.inc_by(duration, self.name)
|
||||||
|
|
||||||
context = LoggingContext.current_context()
|
context = LoggingContext.current_context()
|
||||||
|
|
Loading…
Reference in a new issue