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

Add metric to count lazy member sync requests #4022

Merged
merged 6 commits into from
Oct 10, 2018

Conversation

erikjohnston
Copy link
Member

No description provided.

@erikjohnston erikjohnston force-pushed the erikj/metrics_lazy_loaded_count branch from 7b5e318 to 2073385 Compare October 9, 2018 13:18
@erikjohnston erikjohnston requested a review from a team October 9, 2018 13:18
# Counts the number of times we got asked for a lazy loaded sync. Type is one of
# initial_sync, full_sate_sync or incremental_sync
lazy_member_sync_counter = Counter(
"synapse_handlers_sync_lazy_member_sync", "", ["type"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"apparently" best practice is for these to be called xyz_total ...

@@ -36,6 +38,13 @@

logger = logging.getLogger(__name__)


# Counts the number of times we got asked for a lazy loaded sync. Type is one of
# initial_sync, full_sate_sync or incremental_sync
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

full_state_sync

context.tag = sync_type

if sync_config.filter_collection.lazy_load_members():
lazy_member_sync_counter.labels(sync_type).inc()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sort-of wondering if we should only bump this when the result is non-empty (ie, do it in current_sync_for_user rather than here). Not bothered though.

@erikjohnston
Copy link
Member Author

erikjohnston commented Oct 10, 2018

I'm sort-of wondering if we should only bump this when the result is non-empty (ie, do it in current_sync_for_user rather than here). Not bothered though.

I was sort of planning on comparing it to the total number of sync requests we received, but that doesn't actually work. I've changed it so that we have a count of number of non-empty sync responses, and have made whether it was a lazy loaded request or not a label.

Which I think makes more sense?

@erikjohnston erikjohnston requested a review from a team October 10, 2018 10:25
@@ -0,0 +1 @@
Add metric to count lazy member sync requests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could do with some expansion

# "true" or "false" depending on if the request asked for lazy loaded members or
# not.
non_empty_sync_counter = Counter(
"synapse_handlers_sync_nonempty_total", "", ["type", "lazy_loaded"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the second param is a description. why not use it!

@erikjohnston
Copy link
Member Author

I've added a description. I'm not sure whether its too much or too little, as we generally haven't used description. (I think to keep the metric size down?)

@erikjohnston erikjohnston requested a review from a team October 10, 2018 12:46
@richvdh
Copy link
Member

richvdh commented Oct 10, 2018

I think to keep the metric size down?

more likely because the predecessor to prometheus-client made them hard

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@erikjohnston erikjohnston merged commit e97d939 into develop Oct 10, 2018
michaelkaye added a commit that referenced this pull request Oct 22, 2018
**Warning**: This release removes the example email notification templates from
`res/templates` (they are now internal to the python package). This should only
affect you if you (a) deploy your Synapse instance from a git checkout or a
github snapshot URL, and (b) have email notifications enabled.

If you have email notifications enabled, you should ensure that
`email.template_dir` is either configured to point at a directory where you
have installed customised templates, or leave it unset to use the default
templates.

The configuration parser will try to detect the situation where
`email.template_dir` is incorrectly set to `res/templates` and do the right
thing, but will warn about this.

Features
--------

- Ship the example email templates as part of the package ([\#4052](#4052))
- Add support for end-to-end key backup (MSC1687) ([\#4019](#4019))

Bugfixes
--------

- Fix bug which made get_missing_events return too few events ([\#4045](#4045))
- Fix bug in event persistence logic which caused 'NoneType is not iterable' ([\#3995](#3995))
- Fix exception in background metrics collection ([\#3996](#3996))
- Fix exception handling in fetching remote profiles ([\#3997](#3997))
- Fix handling of rejected threepid invites ([\#3999](#3999))
- Workers now start on Python 3. ([\#4027](#4027))
- Synapse now starts on Python 3.7. ([\#4033](#4033))

Internal Changes
----------------

- Log exceptions in looping calls ([\#4008](#4008))
- Optimisation for serving federation requests ([\#4017](#4017))
- Add metric to count number of non-empty sync responses ([\#4022](#4022))
@erikjohnston erikjohnston deleted the erikj/metrics_lazy_loaded_count branch December 12, 2018 15:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants