Skip to content

Commit

Permalink
[8.12] [Profiling] Adding breadcrumbs (elastic#173031) (elastic#173040)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.12`:
- [[Profiling] Adding breadcrumbs
(elastic#173031)](elastic#173031)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cauê
Marcondes","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-12-11T11:40:55Z","message":"[Profiling]
Adding breadcrumbs (elastic#173031)\n\nAdding missing breadbrcumbs\r\n\r\n<img
width=\"809\" alt=\"Screenshot 2023-12-11 at 10 23
13\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/0d482563-9118-4172-9f8e-6f7f7aaeab10\">\r\n<img
width=\"761\" alt=\"Screenshot 2023-12-11 at 10 23
19\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/ee0faf2b-3ded-4114-b770-0396ce1e2f4c\">\r\n<img
width=\"692\" alt=\"Screenshot 2023-12-11 at 10 23
25\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/2737e8a9-8205-4af4-b5bd-974ea72972c9\">\r\n<img
width=\"881\" alt=\"Screenshot 2023-12-11 at 10 23
31\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/392bfc10-faea-4895-9220-941a2714e558\">\r\n8.12","sha":"f3314075aad13c36937b0cbd4acda89d5f831b42","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","ReleaseStatus","v8.12.0","v8.13.0"],"number":173031,"url":"https://github.com/elastic/kibana/pull/173031","mergeCommit":{"message":"[Profiling]
Adding breadcrumbs (elastic#173031)\n\nAdding missing breadbrcumbs\r\n\r\n<img
width=\"809\" alt=\"Screenshot 2023-12-11 at 10 23
13\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/0d482563-9118-4172-9f8e-6f7f7aaeab10\">\r\n<img
width=\"761\" alt=\"Screenshot 2023-12-11 at 10 23
19\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/ee0faf2b-3ded-4114-b770-0396ce1e2f4c\">\r\n<img
width=\"692\" alt=\"Screenshot 2023-12-11 at 10 23
25\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/2737e8a9-8205-4af4-b5bd-974ea72972c9\">\r\n<img
width=\"881\" alt=\"Screenshot 2023-12-11 at 10 23
31\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/392bfc10-faea-4895-9220-941a2714e558\">\r\n8.12","sha":"f3314075aad13c36937b0cbd4acda89d5f831b42"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173031","number":173031,"mergeCommit":{"message":"[Profiling]
Adding breadcrumbs (elastic#173031)\n\nAdding missing breadbrcumbs\r\n\r\n<img
width=\"809\" alt=\"Screenshot 2023-12-11 at 10 23
13\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/0d482563-9118-4172-9f8e-6f7f7aaeab10\">\r\n<img
width=\"761\" alt=\"Screenshot 2023-12-11 at 10 23
19\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/ee0faf2b-3ded-4114-b770-0396ce1e2f4c\">\r\n<img
width=\"692\" alt=\"Screenshot 2023-12-11 at 10 23
25\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/2737e8a9-8205-4af4-b5bd-974ea72972c9\">\r\n<img
width=\"881\" alt=\"Screenshot 2023-12-11 at 10 23
31\"\r\nsrc=\"https://github.com/elastic/kibana/assets/55978943/392bfc10-faea-4895-9220-941a2714e558\">\r\n8.12","sha":"f3314075aad13c36937b0cbd4acda89d5f831b42"}}]}]
BACKPORT-->

Co-authored-by: Cauê Marcondes <[email protected]>
  • Loading branch information
kibanamachine and cauemarcondes authored Dec 11, 2023
1 parent 1661328 commit fc6fc4d
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 103 deletions.
35 changes: 22 additions & 13 deletions x-pack/plugins/profiling/public/routing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ import { StorageExplorerView } from '../views/storage_explorer';
import { RouteBreadcrumb } from './route_breadcrumb';

const routes = {
'/settings': {
element: (
<RouteBreadcrumb
title={i18n.translate('xpack.profiling.breadcrumb.settings', {
defaultMessage: 'Settings',
})}
href="/settings"
>
<Settings />
</RouteBreadcrumb>
),
},
'/': {
element: (
<RouteBreadcrumb
Expand All @@ -61,8 +49,29 @@ const routes = {
</RouteBreadcrumb>
),
children: {
'/settings': {
element: (
<RouteBreadcrumb
title={i18n.translate('xpack.profiling.breadcrumb.settings', {
defaultMessage: 'Settings',
})}
href="/settings"
>
<Settings />
</RouteBreadcrumb>
),
},
'/add-data-instructions': {
element: <AddDataView />,
element: (
<RouteBreadcrumb
title={i18n.translate('xpack.profiling.breadcrumb.addDataView', {
defaultMessage: 'Add profiling data',
})}
href="/add-data-instructions"
>
<AddDataView />
</RouteBreadcrumb>
),
params: t.type({
query: t.type({
selectedTab: t.union([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* 2.0.
*/

import { EuiPageHeaderContentProps } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { TypeOf } from '@kbn/typed-react-router-config';
import { TopNType } from '@kbn/profiling-utils';
Expand All @@ -18,7 +17,7 @@ export function getStackTracesTabs({
profilingRouter,
}: TypeOf<ProfilingRoutes, '/stacktraces/{topNType}'> & {
profilingRouter: StatefulProfilingRouter;
}): Required<EuiPageHeaderContentProps>['tabs'] {
}) {
return [
{
label: i18n.translate('xpack.profiling.stackTracesView.threadsTabLabel', {
Expand Down
180 changes: 92 additions & 88 deletions x-pack/plugins/profiling/public/views/stack_traces_view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ProfilingAppPageTemplate } from '../../components/profiling_app_page_te
import { StackedBarChart } from '../../components/stacked_bar_chart';
import { getStackTracesTabs } from './get_stack_traces_tabs';
import { getTracesViewRouteParams } from './utils';
import { RouteBreadcrumb } from '../../routing/route_breadcrumb';

export function StackTracesView() {
const routePath = useProfilingRoutePath();
Expand All @@ -41,6 +42,7 @@ export function StackTracesView() {
query,
profilingRouter,
});
const selectedTab = tabs.find((tab) => tab.isSelected);

const {
services: { fetchTopN },
Expand Down Expand Up @@ -89,102 +91,104 @@ export function StackTracesView() {
}

return (
<ProfilingAppPageTemplate tabs={tabs}>
<EuiFlexGroup direction="column">
<EuiFlexItem grow>
<EuiPanel>
<EuiFlexGroup direction="column" gutterSize="m">
<EuiFlexItem>
<EuiButtonGroup
idSelected={displayAs}
type="single"
onChange={(nextValue) => {
profilingRouter.push(routePath, {
path,
query: {
...query,
displayAs: nextValue,
},
});
}}
options={[
{
id: StackTracesDisplayOption.StackTraces,
iconType: 'visLine',
label: i18n.translate(
'xpack.profiling.stackTracesView.stackTracesCountButton',
{
defaultMessage: 'Stack traces',
}
),
},
{
id: StackTracesDisplayOption.Percentage,
iconType: 'percent',
label: i18n.translate('xpack.profiling.stackTracesView.percentagesButton', {
defaultMessage: 'Percentages',
}),
},
]}
legend={i18n.translate('xpack.profiling.stackTracesView.displayOptionLegend', {
defaultMessage: 'Display option',
})}
/>
</EuiFlexItem>
<EuiFlexItem style={{ alignContent: 'center' }}>
<AsyncComponent size="xl" {...state} style={{ height: 400 }}>
<StackedBarChart
height={400}
charts={data?.charts ?? []}
asPercentages={displayAs === StackTracesDisplayOption.Percentage}
onBrushEnd={(nextRange) => {
<RouteBreadcrumb title={selectedTab?.label || ''} href={selectedTab?.href || ''}>
<ProfilingAppPageTemplate tabs={tabs}>
<EuiFlexGroup direction="column">
<EuiFlexItem grow>
<EuiPanel>
<EuiFlexGroup direction="column" gutterSize="m">
<EuiFlexItem>
<EuiButtonGroup
idSelected={displayAs}
type="single"
onChange={(nextValue) => {
profilingRouter.push(routePath, {
path,
query: {
...query,
rangeFrom: nextRange.rangeFrom,
rangeTo: nextRange.rangeTo,
displayAs: nextValue,
},
});
}}
showFrames={topNType === TopNType.Traces}
onClick={topNType === TopNType.Threads ? onStackedBarClick : undefined}
options={[
{
id: StackTracesDisplayOption.StackTraces,
iconType: 'visLine',
label: i18n.translate(
'xpack.profiling.stackTracesView.stackTracesCountButton',
{
defaultMessage: 'Stack traces',
}
),
},
{
id: StackTracesDisplayOption.Percentage,
iconType: 'percent',
label: i18n.translate('xpack.profiling.stackTracesView.percentagesButton', {
defaultMessage: 'Percentages',
}),
},
]}
legend={i18n.translate('xpack.profiling.stackTracesView.displayOptionLegend', {
defaultMessage: 'Display option',
})}
/>
</AsyncComponent>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem grow>
<AsyncComponent size="m" mono {...state} style={{ minHeight: 200 }}>
<ChartGrid
charts={data?.charts ?? []}
limit={limit}
showFrames={topNType === TopNType.Traces}
/>
</AsyncComponent>
</EuiFlexItem>
{(data?.charts.length ?? 0) > limit && (
<EuiFlexItem>
<EuiButton
data-test-subj="profilingStackTracesViewShowMoreButton"
onClick={() => {
profilingRouter.push(routePath, {
path,
query: {
...query,
limit: limit + 10,
},
});
}}
>
{i18n.translate('xpack.profiling.stackTracesView.showMoreButton', {
defaultMessage: 'Show more',
})}
</EuiButton>
</EuiFlexItem>
<EuiFlexItem style={{ alignContent: 'center' }}>
<AsyncComponent size="xl" {...state} style={{ height: 400 }}>
<StackedBarChart
height={400}
charts={data?.charts ?? []}
asPercentages={displayAs === StackTracesDisplayOption.Percentage}
onBrushEnd={(nextRange) => {
profilingRouter.push(routePath, {
path,
query: {
...query,
rangeFrom: nextRange.rangeFrom,
rangeTo: nextRange.rangeTo,
},
});
}}
showFrames={topNType === TopNType.Traces}
onClick={topNType === TopNType.Threads ? onStackedBarClick : undefined}
/>
</AsyncComponent>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem grow>
<AsyncComponent size="m" mono {...state} style={{ minHeight: 200 }}>
<ChartGrid
charts={data?.charts ?? []}
limit={limit}
showFrames={topNType === TopNType.Traces}
/>
</AsyncComponent>
</EuiFlexItem>
)}
</EuiFlexGroup>
</ProfilingAppPageTemplate>
{(data?.charts.length ?? 0) > limit && (
<EuiFlexItem>
<EuiButton
data-test-subj="profilingStackTracesViewShowMoreButton"
onClick={() => {
profilingRouter.push(routePath, {
path,
query: {
...query,
limit: limit + 10,
},
});
}}
>
{i18n.translate('xpack.profiling.stackTracesView.showMoreButton', {
defaultMessage: 'Show more',
})}
</EuiButton>
</EuiFlexItem>
)}
</EuiFlexGroup>
</ProfilingAppPageTemplate>
</RouteBreadcrumb>
);
}

0 comments on commit fc6fc4d

Please sign in to comment.