-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
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.
generally looks good. a few minor comments.
synapse/metrics/metric.py
Outdated
# dict[list[str]]: value for each set of label values. the keys are the | ||
# label values, in the same order as the labels in self.labels. | ||
# | ||
# (if the metric is a scalar, the (single) key is the empty list). |
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.
s/list/tuple/, fwiw
|
||
self.guages[values] = v | ||
|
||
def render(self): |
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.
feels like a bit of a shame not to share this with CounterMetric
with a baseclass
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.
Yeah, though I think in this case its more hassle than its worth. Another option would be to make the counter and gauge class the same and have it support both set
and inc
, but then you lose the easy ability to see if a metric is meant to be a counter or gauge. WDYT?
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.
I like them being separate. Happy for you to leave the code c&ped for now.
synapse/storage/events_worker.py
Outdated
event_id (str) | ||
|
||
Returns: | ||
Deferred[int|None]: Timstamp in milliseconds, or None for events |
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.
Timstamp
|
||
if events: | ||
now = self.clock.time_msec() | ||
ts = yield self.store.get_received_ts(events[-1].event_id) |
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.
seems a shame to have to do a db hit for this, but I guess working around it is a faff.
@@ -239,6 +239,21 @@ def handle_room_events(events): | |||
"events", next_token | |||
) | |||
|
|||
synapse.metrics.event_processing_positions.set( |
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.
can we move the events_processed_counter
update here so that all the metrics updates are collected together?
synapse/handlers/appservice.py
Outdated
@@ -111,6 +111,20 @@ def notify_interested_services(self, current_id): | |||
events_processed_counter.inc_by(len(events)) | |||
|
|||
yield self.store.set_appservice_last_pos(upper_bound) | |||
|
|||
synapse.metrics.event_processing_positions.set( |
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.
again with events_processed_counter
synapse/storage/events_worker.py
Outdated
Returns: | ||
Deferred[int|None]: Timstamp in milliseconds, or None for events | ||
that were persisted before received_ts was implemented. | ||
""" |
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.
what happens if the event id is unknown? exception, presumably?
synapse/storage/events_worker.py
Outdated
@@ -52,13 +52,14 @@ | |||
|
|||
class EventsWorkerStore(SQLBaseStore): | |||
def get_received_ts(self, event_id): | |||
"""Get received_ts (when it was persisted) for the event | |||
"""Get received_ts (when it was persisted) for the event. Raises an |
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.
could have done with being a separate paragraph, ftr, since the first line is slightly special (https://www.python.org/dev/peps/pep-0257/#multi-line-docstrings)
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.
lgtm
Changes in synapse v0.28.0-rc1 (2018-04-26) =========================================== Bug Fixes: * Fix quarantine media admin API and search reindex (PR #3130) * Fix media admin APIs (PR #3134) Changes in synapse v0.28.0-rc1 (2018-04-24) =========================================== Minor performance improvement to federation sending and bug fixes. (Note: This release does not include state resolutions discussed in matrix live) Features: * Add metrics for event processing lag (PR #3090) * Add metrics for ResponseCache (PR #3092) Changes: * Synapse on PyPy (PR #2760) Thanks to @Valodim! * move handling of auto_join_rooms to RegisterHandler (PR #2996) Thanks to @krombel! * Improve handling of SRV records for federation connections (PR #3016) Thanks to @silkeh! * Document the behaviour of ResponseCache (PR #3059) * Preparation for py3 (PR #3061, #3073, #3074, #3075, #3103, #3104, #3106, #3107, #3109, #3110) Thanks to @NotAFile! * update prometheus dashboard to use new metric names (PR #3069) Thanks to @krombel! * use python3-compatible prints (PR #3074) Thanks to @NotAFile! * Send federation events concurrently (PR #3078) * Limit concurrent event sends for a room (PR #3079) * Improve R30 stat definition (PR #3086) * Send events to ASes concurrently (PR #3088) * Refactor ResponseCache usage (PR #3093) * Clarify that SRV may not point to a CNAME (PR #3100) Thanks to @silkeh! * Use str(e) instead of e.message (PR #3103) Thanks to @NotAFile! * Use six.itervalues in some places (PR #3106) Thanks to @NotAFile! * Refactor store.have_events (PR #3117) Bug Fixes: * Return 401 for invalid access_token on logout (PR #2938) Thanks to @dklug! * Return a 404 rather than a 500 on rejoining empty rooms (PR #3080) * fix federation_domain_whitelist (PR #3099) * Avoid creating events with huge numbers of prev_events (PR #3113) * Reject events which have lots of prev_events (PR #3118)
Adds metrics for tracking how far behind the appservice and federation sending loops are. There are threee:
received_ts
of the last processed event. This allows us to get an estimate of where the processing is up to time wise.received_ts
.