-
Notifications
You must be signed in to change notification settings - Fork 522
Refactor Gauge metrics to be homeserver-scoped
#18725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b14eed7
Add in base linting for metrics
MadLittleMods 4bb84a6
Fill in `synapse/app/phone_stats_home.py`
MadLittleMods 80d5fd5
Support `labelnames` argument being a Tuple expression
MadLittleMods 1504100
Fill in `synapse/federation/federation_server.py`
MadLittleMods 608f72e
Fill in `synapse/federation/sender/transaction_manager.py`
MadLittleMods 0a2877e
Fill in `synapse/metrics/__init__.py`
MadLittleMods 0c93d85
Fill in `synapse/metrics/_gc.py`
MadLittleMods fe1a16f
Fill in `synapse/metrics/common_usage_metrics.py`
MadLittleMods 944df9c
Fill in `synapse/push/pusherpool.py`
MadLittleMods 54e2374
Fill in `synapse/replication/http/_base.py`
MadLittleMods 883062b
Fill in `synapse/storage/databases/main/event_federation.py`
MadLittleMods 90efa41
Fill in `synapse/storage/databases/main/events_worker.py`
MadLittleMods f4b6d35
Fill in `synapse/util/batching_queue.py`
MadLittleMods 656c3ad
Fill in `synapse/util/caches/deferred_cache.py`
MadLittleMods c55e615
Add changelog
MadLittleMods 0fd34a6
Add upgrade notes
MadLittleMods 563f543
Fix `make_fake_db_pool`
MadLittleMods 554d588
Fix `event_persisted_position` usage
MadLittleMods 2536aaf
Fix lints
MadLittleMods 7b55ffb
Fill in event `Gauge` metrics from `synapse/metrics/__init__.py`
MadLittleMods 68061f9
Merge branch 'develop' into madlittlemods/18592-refactor-gauge
MadLittleMods d587aa9
Remove debug log
MadLittleMods def4eb5
Merge branch 'develop' into madlittlemods/18592-refactor-gauge
MadLittleMods 650ce32
Fix grammar
MadLittleMods 4387262
Fix duplicate word typo
MadLittleMods File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Refactor `Gauge` metrics to be homeserver-scoped. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ | |
| tags, | ||
| whitelisted_homeserver, | ||
| ) | ||
| from synapse.metrics import SERVER_NAME_LABEL | ||
| from synapse.types import JsonDict | ||
| from synapse.util import json_decoder | ||
| from synapse.util.metrics import measure_func | ||
|
|
@@ -47,7 +48,7 @@ | |
| last_pdu_ts_metric = Gauge( | ||
| "synapse_federation_last_sent_pdu_time", | ||
| "The timestamp of the last PDU which was successfully sent to the given domain", | ||
| labelnames=("server_name",), | ||
| labelnames=("destination_server_name", SERVER_NAME_LABEL), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This metric was already using the |
||
| ) | ||
|
|
||
|
|
||
|
|
@@ -191,6 +192,7 @@ def json_data_cb() -> JsonDict: | |
|
|
||
| if pdus and destination in self._federation_metrics_domains: | ||
| last_pdu = pdus[-1] | ||
| last_pdu_ts_metric.labels(server_name=destination).set( | ||
| last_pdu.origin_server_ts / 1000 | ||
| ) | ||
| last_pdu_ts_metric.labels( | ||
| destination_server_name=destination, | ||
| **{SERVER_NAME_LABEL: self.server_name}, | ||
| ).set(last_pdu.origin_server_ts / 1000) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This metric was already using the
server_namelabel so I've had to rename the label. I've updated thecontrib/grafana/synapse.jsonbut it's something we probably want to call out in the upgrade notes (added)