Commit 28f1bf87 authored by Quang-Minh Nguyen's avatar Quang-Minh Nguyen

Add performance bar summary section in the frontend side

Issue https://gitlab.com/gitlab-org/gitlab/-/issues/324649
parent 0b4d2dd5
...@@ -48,6 +48,17 @@ export default { ...@@ -48,6 +48,17 @@ export default {
metricDetails() { metricDetails() {
return this.currentRequest.details[this.metric]; return this.currentRequest.details[this.metric];
}, },
metricDetailsSummary() {
let summary = {
[s__('PerformanceBar|Total')]: this.metricDetails.calls,
[s__('PerformanceBar|Total duration')]: this.metricDetails.duration,
};
if (this.metricDetails.summary) {
summary = { ...summary, ...this.metricDetails.summary };
}
return summary;
},
metricDetailsLabel() { metricDetailsLabel() {
return this.metricDetails.duration return this.metricDetails.duration
? `${this.metricDetails.duration} / ${this.metricDetails.calls}` ? `${this.metricDetails.duration} / ${this.metricDetails.calls}`
...@@ -96,6 +107,21 @@ export default { ...@@ -96,6 +107,21 @@ export default {
<span class="gl-text-blue-300 gl-font-weight-bold">{{ metricDetailsLabel }}</span> <span class="gl-text-blue-300 gl-font-weight-bold">{{ metricDetailsLabel }}</span>
</gl-button> </gl-button>
<gl-modal :modal-id="modalId" :title="header" size="lg" footer-class="d-none" scrollable> <gl-modal :modal-id="modalId" :title="header" size="lg" footer-class="d-none" scrollable>
<div class="gl-display-flex gl-align-items-center gl-justify-content-space-between">
<div class="gl-display-flex gl-align-items-center" data-testid="performance-bar-summary">
<div
v-for="(value, name) in metricDetailsSummary"
v-if="value"
:key="name"
class="gl-pr-8"
data-testid="performance-bar-summary-item"
>
<div>{{ name }}</div>
<div class="gl-font-size-h1 gl-font-weight-bold">{{ value }}</div>
</div>
</div>
</div>
<hr />
<table class="table gl-table"> <table class="table gl-table">
<template v-if="detailsList.length"> <template v-if="detailsList.length">
<tr v-for="(item, index) in detailsList" :key="index"> <tr v-for="(item, index) in detailsList" :key="index">
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
metric: 'active-record', metric: 'active-record',
title: 'pg', title: 'pg',
header: s__('PerformanceBar|SQL queries'), header: s__('PerformanceBar|SQL queries'),
keys: ['sql', 'cached', 'db_role'], keys: ['sql', 'cached', 'transaction', 'db_role'],
}, },
{ {
metric: 'bullet', metric: 'bullet',
...@@ -69,6 +69,7 @@ export default { ...@@ -69,6 +69,7 @@ export default {
}, },
{ {
metric: 'external-http', metric: 'external-http',
title: 'external',
header: s__('PerformanceBar|External Http calls'), header: s__('PerformanceBar|External Http calls'),
keys: ['label', 'code', 'proxy', 'error'], keys: ['label', 'code', 'proxy', 'error'],
}, },
...@@ -157,15 +158,17 @@ export default { ...@@ -157,15 +158,17 @@ export default {
class="view" class="view"
> >
<a class="gl-text-blue-300" :href="currentRequest.details.tracing.tracing_url">{{ <a class="gl-text-blue-300" :href="currentRequest.details.tracing.tracing_url">{{
s__('PerformanceBar|trace') s__('PerformanceBar|Trace')
}}</a> }}</a>
</div> </div>
<add-request v-on="$listeners" />
<div v-if="currentRequest.details" id="peek-download" class="view"> <div v-if="currentRequest.details" id="peek-download" class="view">
<a class="gl-text-blue-300" :download="downloadName" :href="downloadPath">{{ <a class="gl-text-blue-300" :download="downloadName" :href="downloadPath">{{
s__('PerformanceBar|Download') s__('PerformanceBar|Download')
}}</a> }}</a>
</div> </div>
<div v-if="statsUrl" id="peek-stats" class="view">
<a class="gl-text-blue-300" :href="statsUrl">{{ s__('PerformanceBar|Stats') }}</a>
</div>
<request-selector <request-selector
v-if="currentRequest" v-if="currentRequest"
:current-request="currentRequest" :current-request="currentRequest"
...@@ -173,9 +176,7 @@ export default { ...@@ -173,9 +176,7 @@ export default {
class="ml-auto" class="ml-auto"
@change-current-request="changeCurrentRequest" @change-current-request="changeCurrentRequest"
/> />
<div v-if="statsUrl" id="peek-stats" class="view"> <add-request v-on="$listeners" />
<a class="gl-text-blue-300" :href="statsUrl">{{ s__('PerformanceBar|Stats') }}</a>
</div>
</div> </div>
</div> </div>
</template> </template>
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