Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
5a4da21d
Unverified
Commit
5a4da21d
authored
7 years ago
by
Richard van der Hoff
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2810 from matrix-org/rav/metrics_fixes
Fix bugs in block metrics
parents
d6af5512
d57765fc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/util/metrics.py
+4
-2
4 additions, 2 deletions
synapse/util/metrics.py
with
4 additions
and
2 deletions
synapse/util/metrics.py
+
4
−
2
View file @
5a4da21d
...
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
...
@@ -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
_count
er
=
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(
...
@@ -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):
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment