Skip to content

Commit 6e98f00

Browse files
committed
Merge remote-tracking branch 'upstream/master' into nls/no-kuery
2 parents e864f75 + df8a8cb commit 6e98f00

File tree

27 files changed

+1549
-22
lines changed

27 files changed

+1549
-22
lines changed

x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/apm/common/elasticsearch_fieldnames.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,17 @@ export const LCP_FIELD = 'transaction.marks.agent.largestContentfulPaint';
132132
export const TBT_FIELD = 'transaction.experience.tbt';
133133
export const FID_FIELD = 'transaction.experience.fid';
134134
export const CLS_FIELD = 'transaction.experience.cls';
135+
136+
export const PROFILE_ID = 'profile.id';
137+
export const PROFILE_DURATION = 'profile.duration';
138+
export const PROFILE_TOP_ID = 'profile.top.id';
139+
export const PROFILE_STACK = 'profile.stack';
140+
141+
export const PROFILE_SAMPLES_COUNT = 'profile.samples.count';
142+
export const PROFILE_CPU_NS = 'profile.cpu.ns';
143+
export const PROFILE_WALL_US = 'profile.wall.us';
144+
145+
export const PROFILE_ALLOC_OBJECTS = 'profile.alloc_objects.count';
146+
export const PROFILE_ALLOC_SPACE = 'profile.alloc_space.bytes';
147+
export const PROFILE_INUSE_OBJECTS = 'profile.inuse_objects.count';
148+
export const PROFILE_INUSE_SPACE = 'profile.inuse_space.bytes';

x-pack/plugins/apm/common/processor_event.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export enum ProcessorEvent {
1010
error = 'error',
1111
metric = 'metric',
1212
span = 'span',
13+
profile = 'profile',
1314
}
1415
/**
1516
* Processor events that are searchable in the UI via the query bar.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
import { i18n } from '@kbn/i18n';
8+
import {
9+
PROFILE_ALLOC_OBJECTS,
10+
PROFILE_ALLOC_SPACE,
11+
PROFILE_CPU_NS,
12+
PROFILE_INUSE_OBJECTS,
13+
PROFILE_INUSE_SPACE,
14+
PROFILE_SAMPLES_COUNT,
15+
PROFILE_WALL_US,
16+
} from './elasticsearch_fieldnames';
17+
18+
export enum ProfilingValueType {
19+
wallTime = 'wall_time',
20+
cpuTime = 'cpu_time',
21+
samples = 'samples',
22+
allocObjects = 'alloc_objects',
23+
allocSpace = 'alloc_space',
24+
inuseObjects = 'inuse_objects',
25+
inuseSpace = 'inuse_space',
26+
}
27+
28+
export enum ProfilingValueTypeUnit {
29+
ns = 'ns',
30+
us = 'us',
31+
count = 'count',
32+
bytes = 'bytes',
33+
}
34+
35+
export interface ProfileNode {
36+
id: string;
37+
label: string;
38+
fqn: string;
39+
value: number;
40+
children: string[];
41+
}
42+
43+
const config = {
44+
[ProfilingValueType.wallTime]: {
45+
unit: ProfilingValueTypeUnit.us,
46+
label: i18n.translate(
47+
'xpack.apm.serviceProfiling.valueTypeLabel.wallTime',
48+
{
49+
defaultMessage: 'Wall',
50+
}
51+
),
52+
field: PROFILE_WALL_US,
53+
},
54+
[ProfilingValueType.cpuTime]: {
55+
unit: ProfilingValueTypeUnit.ns,
56+
label: i18n.translate('xpack.apm.serviceProfiling.valueTypeLabel.cpuTime', {
57+
defaultMessage: 'On-CPU',
58+
}),
59+
field: PROFILE_CPU_NS,
60+
},
61+
[ProfilingValueType.samples]: {
62+
unit: ProfilingValueTypeUnit.count,
63+
label: i18n.translate('xpack.apm.serviceProfiling.valueTypeLabel.samples', {
64+
defaultMessage: 'Samples',
65+
}),
66+
field: PROFILE_SAMPLES_COUNT,
67+
},
68+
[ProfilingValueType.allocObjects]: {
69+
unit: ProfilingValueTypeUnit.count,
70+
label: i18n.translate(
71+
'xpack.apm.serviceProfiling.valueTypeLabel.allocObjects',
72+
{
73+
defaultMessage: 'Alloc. objects',
74+
}
75+
),
76+
field: PROFILE_ALLOC_OBJECTS,
77+
},
78+
[ProfilingValueType.allocSpace]: {
79+
unit: ProfilingValueTypeUnit.bytes,
80+
label: i18n.translate(
81+
'xpack.apm.serviceProfiling.valueTypeLabel.allocSpace',
82+
{
83+
defaultMessage: 'Alloc. space',
84+
}
85+
),
86+
field: PROFILE_ALLOC_SPACE,
87+
},
88+
[ProfilingValueType.inuseObjects]: {
89+
unit: ProfilingValueTypeUnit.count,
90+
label: i18n.translate(
91+
'xpack.apm.serviceProfiling.valueTypeLabel.inuseObjects',
92+
{
93+
defaultMessage: 'In-use objects',
94+
}
95+
),
96+
field: PROFILE_INUSE_OBJECTS,
97+
},
98+
[ProfilingValueType.inuseSpace]: {
99+
unit: ProfilingValueTypeUnit.bytes,
100+
label: i18n.translate(
101+
'xpack.apm.serviceProfiling.valueTypeLabel.inuseSpace',
102+
{
103+
defaultMessage: 'In-use space',
104+
}
105+
),
106+
field: PROFILE_INUSE_SPACE,
107+
},
108+
};
109+
110+
export const getValueTypeConfig = (type: ProfilingValueType) => {
111+
return config[type];
112+
};

x-pack/plugins/apm/public/application/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import ReactDOM from 'react-dom';
1313
import { Route, Router, Switch } from 'react-router-dom';
1414
import 'react-vis/dist/style.css';
1515
import { DefaultTheme, ThemeProvider } from 'styled-components';
16+
import { HeaderMenuPortal } from '../../../observability/public';
1617
import { euiStyled } from '../../../../../src/plugins/kibana_react/common';
1718
import { ConfigSchema } from '../';
1819
import { AppMountParameters, CoreStart } from '../../../../../src/core/public';
@@ -35,13 +36,16 @@ import { createCallApmApi } from '../services/rest/createCallApmApi';
3536
import { createStaticIndexPattern } from '../services/rest/index_pattern';
3637
import { setHelpExtension } from '../setHelpExtension';
3738
import { setReadonlyBadge } from '../updateBadge';
39+
import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context';
40+
import { ActionMenu } from './action_menu';
3841

3942
const MainContainer = euiStyled.div`
4043
height: 100%;
4144
`;
4245

4346
function App() {
4447
const [darkMode] = useUiSetting$<boolean>('theme:darkMode');
48+
const { appMountParameters } = useApmPluginContext();
4549

4650
useBreadcrumbs(routes);
4751

@@ -54,6 +58,11 @@ function App() {
5458
})}
5559
>
5660
<MainContainer data-test-subj="apmMainContainer" role="main">
61+
<HeaderMenuPortal
62+
setHeaderActionMenu={appMountParameters.setHeaderActionMenu}
63+
>
64+
<ActionMenu />
65+
</HeaderMenuPortal>
5766
<Route component={ScrollToTopOnPathChange} />
5867
<Switch>
5968
{routes.map((route, i) => (

x-pack/plugins/apm/public/components/app/Home/__snapshots__/Home.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ function ServiceDetailsTransactions(
114114
return <ServiceDetails {...props} tab="transactions" />;
115115
}
116116

117+
function ServiceDetailsProfiling(
118+
props: RouteComponentProps<{ serviceName: string }>
119+
) {
120+
return <ServiceDetails {...props} tab="profiling" />;
121+
}
122+
117123
function SettingsAgentConfiguration(props: RouteComponentProps<{}>) {
118124
return (
119125
<Settings {...props}>
@@ -307,6 +313,14 @@ export const routes: APMRouteDefinition[] = [
307313
return query.transactionName as string;
308314
},
309315
},
316+
{
317+
exact: true,
318+
path: '/services/:serviceName/profiling',
319+
component: withApmServiceContext(ServiceDetailsProfiling),
320+
breadcrumb: i18n.translate('xpack.apm.breadcrumb.serviceProfilingTitle', {
321+
defaultMessage: 'Profiling',
322+
}),
323+
},
310324
{
311325
exact: true,
312326
path: '/services/:serviceName/service-map',

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import {
1616
import { i18n } from '@kbn/i18n';
1717
import React, { ReactNode, useState } from 'react';
1818
import { RouteComponentProps } from 'react-router-dom';
19-
import { HeaderMenuPortal } from '../../../../../observability/public';
20-
import { ActionMenu } from '../../../application/action_menu';
2119
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
2220
import { getAPMHref } from '../../shared/Links/apm/APMLink';
2321
import { HomeLink } from '../../shared/Links/apm/HomeLink';
@@ -27,7 +25,7 @@ interface SettingsProps extends RouteComponentProps<{}> {
2725
}
2826

2927
export function Settings({ children, location }: SettingsProps) {
30-
const { appMountParameters, core } = useApmPluginContext();
28+
const { core } = useApmPluginContext();
3129
const { basePath } = core.http;
3230
const canAccessML = !!core.application.capabilities.ml?.canAccessML;
3331
const { search, pathname } = location;
@@ -44,11 +42,6 @@ export function Settings({ children, location }: SettingsProps) {
4442

4543
return (
4644
<>
47-
<HeaderMenuPortal
48-
setHeaderActionMenu={appMountParameters.setHeaderActionMenu}
49-
>
50-
<ActionMenu />
51-
</HeaderMenuPortal>
5245
<EuiPage>
5346
<EuiPageSideBar>
5447
<HomeLink>

0 commit comments

Comments
 (0)