Skip to content

Commit 4e55eb4

Browse files
[UX] Add median/percentile info in titles (#79824)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent 1bfa312 commit 4e55eb4

11 files changed

Lines changed: 416 additions & 263 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
"__version": "4.9.0"
2+
"__version": "5.5.0"
33
}

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/url_search_filter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Then(`it displays top pages in the suggestion popover`, () => {
2424
listOfUrls.should('have.length', 5);
2525

2626
const actualUrlsText = [
27-
'http://opbeans-node:3000/dashboardPage views: 17Page load duration: 109 ms',
28-
'http://opbeans-node:3000/ordersPage views: 14Page load duration: 72 ms',
27+
'http://opbeans-node:3000/dashboardTotal page views: 17Page load duration: 109 ms (median)',
28+
'http://opbeans-node:3000/ordersTotal page views: 14Page load duration: 72 ms (median)',
2929
];
3030

3131
cy.get('li.euiSelectableListItem')
@@ -55,7 +55,7 @@ Then(`it should filter results based on query`, () => {
5555
listOfUrls.should('have.length', 1);
5656

5757
const actualUrlsText = [
58-
'http://opbeans-node:3000/customersPage views: 10Page load duration: 76 ms',
58+
'http://opbeans-node:3000/customersTotal page views: 10Page load duration: 76 ms (median)',
5959
];
6060

6161
cy.get('li.euiSelectableListItem')

x-pack/plugins/apm/e2e/yarn.lock

Lines changed: 366 additions & 249 deletions
Large diffs are not rendered by default.

x-pack/plugins/apm/public/components/app/RumDashboard/RumDashboard.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ import { ImpactfulMetrics } from './ImpactfulMetrics';
1919
import { PageLoadAndViews } from './Panels/PageLoadAndViews';
2020
import { VisitorBreakdownsPanel } from './Panels/VisitorBreakdowns';
2121
import { useBreakPoints } from './hooks/useBreakPoints';
22+
import { getPercentileLabel } from './UXMetrics/translations';
23+
import { useUrlParams } from '../../../hooks/useUrlParams';
2224

2325
export function RumDashboard() {
26+
const {
27+
urlParams: { percentile },
28+
} = useUrlParams();
2429
const { isSmall } = useBreakPoints();
2530

2631
return (
@@ -30,7 +35,10 @@ export function RumDashboard() {
3035
<EuiFlexGroup justifyContent="spaceBetween">
3136
<EuiFlexItem grow={1} data-cy={`client-metrics`}>
3237
<EuiTitle size="xs">
33-
<h3>{I18LABELS.pageLoadDuration}</h3>
38+
<h3>
39+
{I18LABELS.pageLoadDuration} (
40+
{getPercentileLabel(percentile!)})
41+
</h3>
3442
</EuiTitle>
3543
<EuiSpacer size="s" />
3644
<ClientMetrics />

x-pack/plugins/apm/public/components/app/RumDashboard/RumHome.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function RumHome() {
3030
wrap
3131
style={{ flexWrap: 'wrap-reverse' }}
3232
justifyContent="flexEnd"
33+
gutterSize="s"
3334
>
3435
<MainFilters />
3536
<EuiFlexItem grow={false}>

x-pack/plugins/apm/public/components/app/RumDashboard/URLFilter/URLSearch/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { formatToSec } from '../../UXMetrics/KeyUXMetrics';
1616
import { SelectableUrlList } from './SelectableUrlList';
1717
import { UrlOption } from './RenderOption';
1818
import { useUxQuery } from '../../hooks/useUxQuery';
19+
import { getPercentileLabel } from '../../UXMetrics/translations';
1920

2021
interface Props {
2122
onChange: (value: string[]) => void;
@@ -26,7 +27,7 @@ export function URLSearch({ onChange: onFilterChange }: Props) {
2627

2728
const { uiFilters, urlParams } = useUrlParams();
2829

29-
const { searchTerm } = urlParams;
30+
const { searchTerm, percentile } = urlParams;
3031

3132
const [popoverIsOpen, setPopoverIsOpen] = useState(false);
3233

@@ -104,12 +105,17 @@ export function URLSearch({ onChange: onFilterChange }: Props) {
104105
setCheckedUrls(clickedItems.map((item) => item.url));
105106
};
106107

108+
const percTitle = getPercentileLabel(percentile!);
109+
107110
const items: UrlOption[] = (data?.items ?? []).map((item) => ({
108111
label: item.url,
109112
key: item.url,
110113
meta: [
111114
I18LABELS.pageViews + ': ' + item.count,
112-
I18LABELS.pageLoadDuration + ': ' + formatToSec(item.pld),
115+
I18LABELS.pageLoadDuration +
116+
': ' +
117+
formatToSec(item.pld) +
118+
` (${percTitle})`,
113119
],
114120
url: item.url,
115121
checked: checkedUrls?.includes(item.url) ? 'on' : undefined,

x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/index.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ import { KeyUXMetrics } from './KeyUXMetrics';
1818
import { useFetcher } from '../../../../hooks/useFetcher';
1919
import { useUxQuery } from '../hooks/useUxQuery';
2020
import { CoreVitals } from '../../../../../../observability/public';
21+
import { useUrlParams } from '../../../../hooks/useUrlParams';
22+
import { getPercentileLabel } from './translations';
2123

2224
export function UXMetrics() {
25+
const {
26+
urlParams: { percentile },
27+
} = useUrlParams();
28+
2329
const uxQuery = useUxQuery();
2430

2531
const { data, status } = useFetcher(
@@ -41,8 +47,10 @@ export function UXMetrics() {
4147
<EuiPanel>
4248
<EuiFlexGroup justifyContent="spaceBetween" wrap>
4349
<EuiFlexItem grow={1} data-cy={`client-metrics`}>
44-
<EuiTitle size="s">
45-
<h2>{I18LABELS.userExperienceMetrics}</h2>
50+
<EuiTitle size="xs">
51+
<h3>
52+
{I18LABELS.metrics} ({getPercentileLabel(percentile!)})
53+
</h3>
4654
</EuiTitle>
4755
<EuiSpacer size="s" />
4856
<KeyUXMetrics data={data} loading={status !== 'success'} />

x-pack/plugins/apm/public/components/app/RumDashboard/UXMetrics/translations.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { i18n } from '@kbn/i18n';
8+
import { I18LABELS } from '../translations';
89

910
export const DATA_UNDEFINED_LABEL = i18n.translate(
1011
'xpack.apm.rum.coreVitals.dataUndefined',
@@ -41,3 +42,14 @@ export const SUM_LONG_TASKS = i18n.translate(
4142
defaultMessage: 'Total long tasks duration',
4243
}
4344
);
45+
46+
export const getPercentileLabel = (value: number) => {
47+
if (value === 50) return I18LABELS.median;
48+
49+
return i18n.translate('xpack.apm.ux.percentiles.label', {
50+
defaultMessage: '{value}th Perc.',
51+
values: {
52+
value,
53+
},
54+
});
55+
};

x-pack/plugins/apm/public/components/app/RumDashboard/translations.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const I18LABELS = {
1717
defaultMessage: 'Frontend',
1818
}),
1919
pageViews: i18n.translate('xpack.apm.rum.dashboard.pageViews', {
20-
defaultMessage: 'Page views',
20+
defaultMessage: 'Total page views',
2121
}),
2222
percPageLoaded: i18n.translate('xpack.apm.rum.dashboard.pagesLoaded.label', {
2323
defaultMessage: 'Pages loaded',
@@ -79,8 +79,11 @@ export const I18LABELS = {
7979
defaultMessage: 'Operating system',
8080
}
8181
),
82-
userExperienceMetrics: i18n.translate('xpack.apm.rum.userExperienceMetrics', {
83-
defaultMessage: 'User experience metrics',
82+
metrics: i18n.translate('xpack.apm.ux.metrics', {
83+
defaultMessage: 'Metrics',
84+
}),
85+
median: i18n.translate('xpack.apm.ux.median', {
86+
defaultMessage: 'median',
8487
}),
8588
avgPageLoadDuration: i18n.translate(
8689
'xpack.apm.rum.visitorBreakdownMap.avgPageLoadDuration',

x-pack/plugins/translations/translations/ja-JP.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5048,7 +5048,6 @@
50485048
"xpack.apm.rum.jsErrors.errorRateValue": "{errorRate} %",
50495049
"xpack.apm.rum.jsErrors.impactedPageLoads": "影響を受けるページ読み込み数",
50505050
"xpack.apm.rum.jsErrors.totalErrors": "合計エラー数",
5051-
"xpack.apm.rum.userExperienceMetrics": "ユーザーエクスペリエンスメトリック",
50525051
"xpack.apm.rum.uxMetrics.longestLongTasks": "最長タスク時間",
50535052
"xpack.apm.rum.uxMetrics.noOfLongTasks": "時間がかかるタスク数",
50545053
"xpack.apm.rum.uxMetrics.sumLongTasks": "時間がかかるタスクの合計時間",

0 commit comments

Comments
 (0)