Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into nls/no-kuery
Browse files Browse the repository at this point in the history
  • Loading branch information
smith committed Feb 22, 2021
2 parents e864f75 + df8a8cb commit 6e98f00
Show file tree
Hide file tree
Showing 27 changed files with 1,549 additions and 22 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions x-pack/plugins/apm/common/elasticsearch_fieldnames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,17 @@ export const LCP_FIELD = 'transaction.marks.agent.largestContentfulPaint';
export const TBT_FIELD = 'transaction.experience.tbt';
export const FID_FIELD = 'transaction.experience.fid';
export const CLS_FIELD = 'transaction.experience.cls';

export const PROFILE_ID = 'profile.id';
export const PROFILE_DURATION = 'profile.duration';
export const PROFILE_TOP_ID = 'profile.top.id';
export const PROFILE_STACK = 'profile.stack';

export const PROFILE_SAMPLES_COUNT = 'profile.samples.count';
export const PROFILE_CPU_NS = 'profile.cpu.ns';
export const PROFILE_WALL_US = 'profile.wall.us';

export const PROFILE_ALLOC_OBJECTS = 'profile.alloc_objects.count';
export const PROFILE_ALLOC_SPACE = 'profile.alloc_space.bytes';
export const PROFILE_INUSE_OBJECTS = 'profile.inuse_objects.count';
export const PROFILE_INUSE_SPACE = 'profile.inuse_space.bytes';
1 change: 1 addition & 0 deletions x-pack/plugins/apm/common/processor_event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum ProcessorEvent {
error = 'error',
metric = 'metric',
span = 'span',
profile = 'profile',
}
/**
* Processor events that are searchable in the UI via the query bar.
Expand Down
112 changes: 112 additions & 0 deletions x-pack/plugins/apm/common/profiling.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { i18n } from '@kbn/i18n';
import {
PROFILE_ALLOC_OBJECTS,
PROFILE_ALLOC_SPACE,
PROFILE_CPU_NS,
PROFILE_INUSE_OBJECTS,
PROFILE_INUSE_SPACE,
PROFILE_SAMPLES_COUNT,
PROFILE_WALL_US,
} from './elasticsearch_fieldnames';

export enum ProfilingValueType {
wallTime = 'wall_time',
cpuTime = 'cpu_time',
samples = 'samples',
allocObjects = 'alloc_objects',
allocSpace = 'alloc_space',
inuseObjects = 'inuse_objects',
inuseSpace = 'inuse_space',
}

export enum ProfilingValueTypeUnit {
ns = 'ns',
us = 'us',
count = 'count',
bytes = 'bytes',
}

export interface ProfileNode {
id: string;
label: string;
fqn: string;
value: number;
children: string[];
}

const config = {
[ProfilingValueType.wallTime]: {
unit: ProfilingValueTypeUnit.us,
label: i18n.translate(
'xpack.apm.serviceProfiling.valueTypeLabel.wallTime',
{
defaultMessage: 'Wall',
}
),
field: PROFILE_WALL_US,
},
[ProfilingValueType.cpuTime]: {
unit: ProfilingValueTypeUnit.ns,
label: i18n.translate('xpack.apm.serviceProfiling.valueTypeLabel.cpuTime', {
defaultMessage: 'On-CPU',
}),
field: PROFILE_CPU_NS,
},
[ProfilingValueType.samples]: {
unit: ProfilingValueTypeUnit.count,
label: i18n.translate('xpack.apm.serviceProfiling.valueTypeLabel.samples', {
defaultMessage: 'Samples',
}),
field: PROFILE_SAMPLES_COUNT,
},
[ProfilingValueType.allocObjects]: {
unit: ProfilingValueTypeUnit.count,
label: i18n.translate(
'xpack.apm.serviceProfiling.valueTypeLabel.allocObjects',
{
defaultMessage: 'Alloc. objects',
}
),
field: PROFILE_ALLOC_OBJECTS,
},
[ProfilingValueType.allocSpace]: {
unit: ProfilingValueTypeUnit.bytes,
label: i18n.translate(
'xpack.apm.serviceProfiling.valueTypeLabel.allocSpace',
{
defaultMessage: 'Alloc. space',
}
),
field: PROFILE_ALLOC_SPACE,
},
[ProfilingValueType.inuseObjects]: {
unit: ProfilingValueTypeUnit.count,
label: i18n.translate(
'xpack.apm.serviceProfiling.valueTypeLabel.inuseObjects',
{
defaultMessage: 'In-use objects',
}
),
field: PROFILE_INUSE_OBJECTS,
},
[ProfilingValueType.inuseSpace]: {
unit: ProfilingValueTypeUnit.bytes,
label: i18n.translate(
'xpack.apm.serviceProfiling.valueTypeLabel.inuseSpace',
{
defaultMessage: 'In-use space',
}
),
field: PROFILE_INUSE_SPACE,
},
};

export const getValueTypeConfig = (type: ProfilingValueType) => {
return config[type];
};
9 changes: 9 additions & 0 deletions x-pack/plugins/apm/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ReactDOM from 'react-dom';
import { Route, Router, Switch } from 'react-router-dom';
import 'react-vis/dist/style.css';
import { DefaultTheme, ThemeProvider } from 'styled-components';
import { HeaderMenuPortal } from '../../../observability/public';
import { euiStyled } from '../../../../../src/plugins/kibana_react/common';
import { ConfigSchema } from '../';
import { AppMountParameters, CoreStart } from '../../../../../src/core/public';
Expand All @@ -35,13 +36,16 @@ import { createCallApmApi } from '../services/rest/createCallApmApi';
import { createStaticIndexPattern } from '../services/rest/index_pattern';
import { setHelpExtension } from '../setHelpExtension';
import { setReadonlyBadge } from '../updateBadge';
import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context';
import { ActionMenu } from './action_menu';

const MainContainer = euiStyled.div`
height: 100%;
`;

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

useBreadcrumbs(routes);

Expand All @@ -54,6 +58,11 @@ function App() {
})}
>
<MainContainer data-test-subj="apmMainContainer" role="main">
<HeaderMenuPortal
setHeaderActionMenu={appMountParameters.setHeaderActionMenu}
>
<ActionMenu />
</HeaderMenuPortal>
<Route component={ScrollToTopOnPathChange} />
<Switch>
{routes.map((route, i) => (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ function ServiceDetailsTransactions(
return <ServiceDetails {...props} tab="transactions" />;
}

function ServiceDetailsProfiling(
props: RouteComponentProps<{ serviceName: string }>
) {
return <ServiceDetails {...props} tab="profiling" />;
}

function SettingsAgentConfiguration(props: RouteComponentProps<{}>) {
return (
<Settings {...props}>
Expand Down Expand Up @@ -307,6 +313,14 @@ export const routes: APMRouteDefinition[] = [
return query.transactionName as string;
},
},
{
exact: true,
path: '/services/:serviceName/profiling',
component: withApmServiceContext(ServiceDetailsProfiling),
breadcrumb: i18n.translate('xpack.apm.breadcrumb.serviceProfilingTitle', {
defaultMessage: 'Profiling',
}),
},
{
exact: true,
path: '/services/:serviceName/service-map',
Expand Down
9 changes: 1 addition & 8 deletions x-pack/plugins/apm/public/components/app/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import {
import { i18n } from '@kbn/i18n';
import React, { ReactNode, useState } from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { HeaderMenuPortal } from '../../../../../observability/public';
import { ActionMenu } from '../../../application/action_menu';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { getAPMHref } from '../../shared/Links/apm/APMLink';
import { HomeLink } from '../../shared/Links/apm/HomeLink';
Expand All @@ -27,7 +25,7 @@ interface SettingsProps extends RouteComponentProps<{}> {
}

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

return (
<>
<HeaderMenuPortal
setHeaderActionMenu={appMountParameters.setHeaderActionMenu}
>
<ActionMenu />
</HeaderMenuPortal>
<EuiPage>
<EuiPageSideBar>
<HomeLink>
Expand Down
Loading

0 comments on commit 6e98f00

Please sign in to comment.