Improve Send Reply Metric Send Reply metric captures a time needed to prepare, send request to server, and renders main content of change view. It shouldn't capture time for full UI loading eg. wait for mergability action. Change-Id: Ib088a1763d8914f9a82c1c92190c212a12507fe2
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js index 058bce8..10f575b 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
@@ -713,10 +713,12 @@ } _handleReplySent(e) { + this.addEventListener('change-details-loaded', + () => { + this.$.reporting.timeEnd(SEND_REPLY_TIMING_LABEL); + }, {once: true}); this.$.replyOverlay.close(); - this._reload().then(() => { - this.$.reporting.timeEnd(SEND_REPLY_TIMING_LABEL); - }); + this._reload(); } _handleReplyCancel(e) { @@ -1459,7 +1461,11 @@ // Resolves when the loading flag is set to false, meaning that some // change content may start appearing. const loadingFlagSet = detailCompletes - .then(() => { this._loading = false; }) + .then(() => { + this._loading = false; + this.dispatchEvent(new CustomEvent('change-details-loaded', + {bubbles: true, composed: true})); + }) .then(() => { this.$.reporting.timeEnd(CHANGE_RELOAD_TIMING_LABEL); if (opt_isLocationChange) {