Commit b3877915 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '11918-performance-marks' into 'master'

Set up the performance marks and measures

See merge request gitlab-org/gitlab!66359
parents c6282573 b73863ed
<script> <script>
import { GlIcon } from '@gitlab/ui'; import { GlIcon } from '@gitlab/ui';
import { throttle } from 'lodash'; import { throttle } from 'lodash';
import { DESIGN_MARK_APP_START, DESIGN_MAIN_IMAGE_OUTPUT } from '~/performance/constants';
import { performanceMarkAndMeasure } from '~/performance/utils';
export default { export default {
components: { components: {
...@@ -39,7 +41,9 @@ export default { ...@@ -39,7 +41,9 @@ export default {
window.removeEventListener('resize', this.resizeThrottled, false); window.removeEventListener('resize', this.resizeThrottled, false);
}, },
mounted() { mounted() {
if (!this.image) {
this.onImgLoad(); this.onImgLoad();
}
this.resizeThrottled = throttle(() => { this.resizeThrottled = throttle(() => {
// NOTE: if imageStyle is set, then baseImageSize // NOTE: if imageStyle is set, then baseImageSize
...@@ -53,6 +57,14 @@ export default { ...@@ -53,6 +57,14 @@ export default {
methods: { methods: {
onImgLoad() { onImgLoad() {
requestIdleCallback(this.setBaseImageSize, { timeout: 1000 }); requestIdleCallback(this.setBaseImageSize, { timeout: 1000 });
performanceMarkAndMeasure({
measures: [
{
name: DESIGN_MAIN_IMAGE_OUTPUT,
start: DESIGN_MARK_APP_START,
},
],
});
}, },
onImgError() { onImgError() {
this.imageError = true; this.imageError = true;
......
import Vue from 'vue'; import Vue from 'vue';
import { DESIGN_MARK_APP_START, DESIGN_MEASURE_BEFORE_APP } from '~/performance/constants';
import { performanceMarkAndMeasure } from '~/performance/utils';
import App from './components/app.vue'; import App from './components/app.vue';
import apolloProvider from './graphql'; import apolloProvider from './graphql';
import activeDiscussionQuery from './graphql/queries/active_discussion.query.graphql'; import activeDiscussionQuery from './graphql/queries/active_discussion.query.graphql';
...@@ -28,6 +30,16 @@ export default () => { ...@@ -28,6 +30,16 @@ export default () => {
projectPath, projectPath,
issueIid, issueIid,
}, },
mounted() {
performanceMarkAndMeasure({
mark: DESIGN_MARK_APP_START,
measures: [
{
name: DESIGN_MEASURE_BEFORE_APP,
},
],
});
},
render(createElement) { render(createElement) {
return createElement(App); return createElement(App);
}, },
......
...@@ -89,3 +89,14 @@ export const REPO_BLOB_LOAD_VIEWER_FINISH = 'blobviewer-load-viewer-finish'; ...@@ -89,3 +89,14 @@ export const REPO_BLOB_LOAD_VIEWER_FINISH = 'blobviewer-load-viewer-finish';
// Measures // Measures
export const REPO_BLOB_LOAD_VIEWER = 'Repository File Viewer: loading the viewer'; export const REPO_BLOB_LOAD_VIEWER = 'Repository File Viewer: loading the viewer';
export const REPO_BLOB_SWITCH_VIEWER = 'Repository File Viewer: switching the viewer'; export const REPO_BLOB_SWITCH_VIEWER = 'Repository File Viewer: switching the viewer';
//
// DESIGN MANAGEMENT NAMESPACE
//
// Marks
export const DESIGN_MARK_APP_START = 'design-app-start';
// Measures
export const DESIGN_MEASURE_BEFORE_APP = 'Design Management: Before the Vue app';
export const DESIGN_MAIN_IMAGE_OUTPUT = 'Design Management: Single image preview';
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment