Skip to content

Commit 57f8a6e

Browse files
shahzad31smithelasticmachine
committed
[Rum Dashbaord] Rum selected service view (#70579)
Co-authored-by: Nathan L Smith <nathan.smith@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent b9c5bbd commit 57f8a6e

File tree

12 files changed

+105
-32
lines changed

12 files changed

+105
-32
lines changed

x-pack/plugins/apm/e2e/cypress/integration/rum_dashboard.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ Feature: RUM Dashboard
3737
When the user selected the breakdown
3838
Then breakdown series should appear in chart
3939

40+
Scenario: Service name filter
41+
When a user changes the selected service name
42+
Then it displays relevant client metrics

x-pack/plugins/apm/e2e/cypress/integration/snapshots.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ module.exports = {
99
},
1010
"RUM Dashboard": {
1111
"Client metrics": {
12-
"1": "62 ",
13-
"2": "0.07 sec",
12+
"1": "55 ",
13+
"2": "0.08 sec",
1414
"3": "0.01 sec"
1515
},
1616
"Rum page filters (example #1)": {
17-
"1": "15 ",
18-
"2": "0.07 sec",
17+
"1": "8 ",
18+
"2": "0.08 sec",
1919
"3": "0.01 sec"
2020
},
2121
"Rum page filters (example #2)": {
22-
"1": "35 ",
22+
"1": "28 ",
2323
"2": "0.07 sec",
2424
"3": "0.01 sec"
2525
},
@@ -31,6 +31,11 @@ module.exports = {
3131
},
3232
"Page load distribution chart legends": {
3333
"1": "Overall"
34+
},
35+
"Service name filter": {
36+
"1": "7 ",
37+
"2": "0.07 sec",
38+
"3": "0.01 sec"
3439
}
3540
}
3641
}

x-pack/plugins/apm/e2e/cypress/support/step_definitions/rum/page_load_dist.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Given(`a user click page load breakdown filter`, () => {
1818
});
1919

2020
When(`the user selected the breakdown`, () => {
21-
cy.get('[data-cy=filter-breakdown-item_Browser]').click();
21+
cy.get('[data-cy=filter-breakdown-item_Browser]', {
22+
timeout: DEFAULT_TIMEOUT,
23+
}).click();
2224
// click outside popover to close it
2325
cy.get('[data-cy=pageLoadDist]').click();
2426
});

x-pack/plugins/apm/e2e/cypress/support/step_definitions/rum/rum_filters.ts

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

77
import { When, Then } from 'cypress-cucumber-preprocessor/steps';
8+
import { DEFAULT_TIMEOUT } from './rum_dashboard';
89

910
import { DEFAULT_TIMEOUT } from '../apm';
1011

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { When, Then } from 'cypress-cucumber-preprocessor/steps';
8+
import { DEFAULT_TIMEOUT } from '../apm';
9+
10+
When('a user changes the selected service name', (filterName) => {
11+
// wait for all loading to finish
12+
cy.get('kbnLoadingIndicator').should('not.be.visible');
13+
cy.get(`[data-cy=serviceNameFilter]`, { timeout: DEFAULT_TIMEOUT }).select(
14+
'opbean-client-rum'
15+
);
16+
});
17+
18+
Then(`it displays relevant client metrics`, () => {
19+
const clientMetrics = '[data-cy=client-metrics] .euiStat__title';
20+
21+
// wait for all loading to finish
22+
cy.get('kbnLoadingIndicator').should('not.be.visible');
23+
cy.get('.euiStat__title-isLoading').should('not.be.visible');
24+
25+
cy.get(clientMetrics).eq(2).invoke('text').snapshot();
26+
27+
cy.get(clientMetrics).eq(1).invoke('text').snapshot();
28+
29+
cy.get(clientMetrics).eq(0).invoke('text').snapshot();
30+
});

x-pack/plugins/apm/e2e/ingest-data/replay.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ function incrementSpinnerCount({ success }) {
6969
spinner.text = `Remaining: ${remaining}. Succeeded: ${requestProgress.succeeded}. Failed: ${requestProgress.failed}.`;
7070
}
7171
let iterIndex = 0;
72+
73+
function setRumAgent(item) {
74+
item.body = item.body.replace(
75+
'"name":"client"',
76+
'"name":"opbean-client-rum"'
77+
);
78+
}
79+
7280
async function insertItem(item) {
7381
try {
7482
const url = `${APM_SERVER_URL}${item.url}`;
@@ -78,6 +86,8 @@ async function insertItem(item) {
7886

7987
if (item.url === '/intake/v2/rum/events') {
8088
if (iterIndex === userAgents.length) {
89+
// set some event agent to opbean
90+
setRumAgent(item);
8191
iterIndex = 0;
8292
}
8393
headers['User-Agent'] = userAgents[iterIndex];

x-pack/plugins/apm/public/components/app/Main/route_config/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,13 @@ export const routes: BreadcrumbRoute[] = [
259259
}),
260260
name: RouteName.RUM_OVERVIEW,
261261
},
262+
{
263+
exact: true,
264+
path: '/services/:serviceName/rum-overview',
265+
component: () => <ServiceDetails tab="rum-overview" />,
266+
breadcrumb: i18n.translate('xpack.apm.home.rumOverview.title', {
267+
defaultMessage: 'Real User Monitoring',
268+
}),
269+
name: RouteName.RUM_OVERVIEW,
270+
},
262271
];

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
EuiSpacer,
1212
} from '@elastic/eui';
1313
import React, { useMemo } from 'react';
14+
import { useRouteMatch } from 'react-router-dom';
1415
import { useTrackPageview } from '../../../../../observability/public';
1516
import { LocalUIFilters } from '../../shared/LocalUIFilters';
1617
import { PROJECTION } from '../../../../common/projections/typings';
@@ -37,6 +38,10 @@ export function RumOverview() {
3738
urlParams: { start, end },
3839
} = useUrlParams();
3940

41+
const isRumServiceRoute = useRouteMatch(
42+
'/services/:serviceName/rum-overview'
43+
);
44+
4045
const { data } = useFetcher(
4146
(callApmApi) => {
4247
if (start && end) {
@@ -61,13 +66,17 @@ export function RumOverview() {
6166
<EuiFlexGroup>
6267
<EuiFlexItem grow={1}>
6368
<LocalUIFilters {...localUIFiltersConfig} showCount={true}>
64-
<ServiceNameFilter
65-
serviceNames={
66-
data?.items?.map((service) => service.serviceName) ?? []
67-
}
68-
/>
69-
<EuiSpacer size="xl" />
70-
<EuiHorizontalRule margin="none" />
69+
{!isRumServiceRoute && (
70+
<>
71+
<ServiceNameFilter
72+
serviceNames={
73+
data?.items?.map((service) => service.serviceName) ?? []
74+
}
75+
/>
76+
<EuiSpacer size="xl" />
77+
<EuiHorizontalRule margin="none" />{' '}
78+
</>
79+
)}
7180
</LocalUIFilters>
7281
</EuiFlexItem>
7382
<EuiFlexItem grow={7}>

x-pack/plugins/apm/public/components/app/ServiceDetails/ServiceDetailTabs.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@ import { ServiceMap } from '../ServiceMap';
2222
import { ServiceMetrics } from '../ServiceMetrics';
2323
import { ServiceNodeOverview } from '../ServiceNodeOverview';
2424
import { TransactionOverview } from '../TransactionOverview';
25-
import { RumOverviewLink } from '../../shared/Links/apm/RumOverviewLink';
2625
import { RumOverview } from '../RumDashboard';
26+
import { RumOverviewLink } from '../../shared/Links/apm/RumOverviewLink';
2727

2828
interface Props {
29-
tab: 'transactions' | 'errors' | 'metrics' | 'nodes' | 'service-map';
29+
tab:
30+
| 'transactions'
31+
| 'errors'
32+
| 'metrics'
33+
| 'nodes'
34+
| 'service-map'
35+
| 'rum-overview';
3036
}
3137

3238
export function ServiceDetailTabs({ tab }: Props) {
@@ -115,7 +121,7 @@ export function ServiceDetailTabs({ tab }: Props) {
115121
if (isRumAgentName(agentName)) {
116122
tabs.push({
117123
link: (
118-
<RumOverviewLink>
124+
<RumOverviewLink serviceName={serviceName}>
119125
{i18n.translate('xpack.apm.home.rumTabLabel', {
120126
defaultMessage: 'Real User Monitoring',
121127
})}

x-pack/plugins/apm/public/components/shared/Links/apm/RumOverviewLink.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,17 @@
1111
*/
1212
import React from 'react';
1313
import { APMLink, APMLinkExtendProps } from './APMLink';
14-
import { useUrlParams } from '../../../../hooks/useUrlParams';
15-
import { pickKeys } from '../../../../../common/utils/pick_keys';
1614

17-
const RumOverviewLink = (props: APMLinkExtendProps) => {
18-
const { urlParams } = useUrlParams();
15+
interface RumOverviewLinkProps extends APMLinkExtendProps {
16+
serviceName?: string;
17+
}
18+
export function RumOverviewLink({
19+
serviceName,
20+
...rest
21+
}: RumOverviewLinkProps) {
22+
const path = serviceName
23+
? `/services/${serviceName}/rum-overview`
24+
: '/rum-overview';
1925

20-
const persistedFilters = pickKeys(
21-
urlParams,
22-
'transactionResult',
23-
'host',
24-
'containerId',
25-
'podName'
26-
);
27-
28-
return <APMLink path="/rum-overview" query={persistedFilters} {...props} />;
29-
};
30-
31-
export { RumOverviewLink };
26+
return <APMLink path={path} {...rest} />;
27+
}

0 commit comments

Comments
 (0)