mirror of https://github.com/zulip/zulip.git
Report unnarrow times as well as narrow times
(imported from commit b3a889aa11dc112508c5a1d213f68e5223a879fc)
This commit is contained in:
parent
91445035bc
commit
acec697fe7
|
@ -54,3 +54,7 @@ stats.timers.<app>.endtoend.displayed_time.all.<type> (5) = sum stats.timers.<ap
|
|||
stats.timers.<app>.narrow.initial_core.all.<type> (5) = sum stats.timers.<app>.narrow.initial_core.*.<type>
|
||||
stats.timers.<app>.narrow.initial_free.all.<type> (5) = sum stats.timers.<app>.narrow.initial_free.*.<type>
|
||||
stats.timers.<app>.narrow.network.all.<type> (5) = sum stats.timers.<app>.narrow.network.*.<type>
|
||||
|
||||
# Do the same for unnarrow times
|
||||
stats.timers.<app>.unnarrow.initial_core.all.<type> (5) = sum stats.timers.<app>.unnarrow.initial_core.*.<type>
|
||||
stats.timers.<app>.unnarrow.initial_free.all.<type> (5) = sum stats.timers.<app>.unnarrow.initial_free.*.<type>
|
||||
|
|
|
@ -3,6 +3,7 @@ var narrow = (function () {
|
|||
var exports = {};
|
||||
|
||||
var current_filter;
|
||||
var unnarrow_times;
|
||||
|
||||
// A small concession to unit testing follows:
|
||||
exports._set_current_filter = function (filter) {
|
||||
|
@ -116,6 +117,26 @@ function maybe_report_narrow_time(msg_list) {
|
|||
|
||||
}
|
||||
|
||||
function report_unnarrow_time() {
|
||||
if (unnarrow_times === undefined ||
|
||||
unnarrow_times.start_time === undefined ||
|
||||
unnarrow_times.initial_core_time === undefined ||
|
||||
unnarrow_times.initial_free_time === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var initial_core_time = unnarrow_times.initial_core_time - unnarrow_times.start_time;
|
||||
var initial_free_time = unnarrow_times.initial_free_time - unnarrow_times.start_time;
|
||||
|
||||
channel.post({
|
||||
url: '/json/report_unnarrow_time',
|
||||
data: {"initial_core": initial_core_time.toString(),
|
||||
"initial_free": initial_free_time.toString()}
|
||||
});
|
||||
|
||||
unnarrow_times = {};
|
||||
}
|
||||
|
||||
exports.activate = function (raw_operators, opts) {
|
||||
var start_time = new Date();
|
||||
var was_narrowed_already = exports.active();
|
||||
|
@ -386,6 +407,7 @@ exports.deactivate = function () {
|
|||
if (current_filter === undefined) {
|
||||
return;
|
||||
}
|
||||
unnarrow_times = {start_time: new Date()};
|
||||
blueslip.debug("Unnarrowed");
|
||||
|
||||
if (ui.actively_scrolling()) {
|
||||
|
@ -464,6 +486,12 @@ exports.deactivate = function () {
|
|||
compose_fade.update_message_list();
|
||||
|
||||
$(document).trigger($.Event('narrow_deactivated.zulip', {msg_list: current_msg_list}));
|
||||
|
||||
unnarrow_times.initial_core_time = new Date();
|
||||
setTimeout(function () {
|
||||
unnarrow_times.initial_free_time = new Date();
|
||||
report_unnarrow_time();
|
||||
});
|
||||
};
|
||||
|
||||
exports.restore_home_state = function () {
|
||||
|
|
|
@ -1711,6 +1711,16 @@ def json_report_narrow_time(request, user_profile,
|
|||
statsd.timing("narrow.network.%s" % (statsd_key(user_profile.realm.domain, clean_periods=True),), network)
|
||||
return json_success()
|
||||
|
||||
@authenticated_json_post_view
|
||||
@has_request_variables
|
||||
def json_report_unnarrow_time(request, user_profile,
|
||||
initial_core=REQ(converter=to_non_negative_int),
|
||||
initial_free=REQ(converter=to_non_negative_int)):
|
||||
request._log_data["extra"] = "[%sms/%sms]" % (initial_core, initial_free)
|
||||
statsd.timing("unnarrow.initial_core.%s" % (statsd_key(user_profile.realm.domain, clean_periods=True),), initial_core)
|
||||
statsd.timing("unnarrow.initial_free.%s" % (statsd_key(user_profile.realm.domain, clean_periods=True),), initial_free)
|
||||
return json_success()
|
||||
|
||||
@authenticated_json_post_view
|
||||
@has_request_variables
|
||||
def json_report_error(request, user_profile, message=REQ, stacktrace=REQ,
|
||||
|
|
|
@ -130,6 +130,7 @@ urlpatterns += patterns('zerver.views',
|
|||
url(r'^json/report_error$', 'json_report_error'),
|
||||
url(r'^json/report_send_time$', 'json_report_send_time'),
|
||||
url(r'^json/report_narrow_time$', 'json_report_narrow_time'),
|
||||
url(r'^json/report_unnarrow_time$', 'json_report_unnarrow_time'),
|
||||
url(r'^json/update_message_flags$', 'messages.json_update_flags'),
|
||||
url(r'^json/register$', 'json_events_register'),
|
||||
url(r'^json/upload_file$', 'json_upload_file'),
|
||||
|
|
Loading…
Reference in New Issue