Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5461cf8
wip
shahzad31 Apr 28, 2021
195ad59
Merge branch 'master' into mobile-experience
shahzad31 Apr 30, 2021
9e261b8
Merge branch 'master' into mobile-experience
shahzad31 May 7, 2021
9626988
wip
shahzad31 May 7, 2021
850f555
Merge branch 'master' into mobile-experience
kibanamachine May 27, 2021
b522c08
Merge branch 'master' into mobile-experience
shahzad31 Jun 2, 2021
720c68f
update
shahzad31 Jun 2, 2021
e8a678f
updated agent filter name to 'iOS/swift'
bryce-b Jun 2, 2021
5a260b2
Merge pull request #4 from bryce-b/mobile-experience
shahzad31 Jun 3, 2021
e2a6e1b
Merge branch 'master' into mobile-experience
shahzad31 Jun 8, 2021
32d36c2
Merge branch 'mobile-experience' of https://github.com/shahzad31/kiba…
shahzad31 Jun 8, 2021
9884d27
update memory and cpu
shahzad31 Jun 8, 2021
487e9c4
fix
shahzad31 Jun 8, 2021
24768ea
Merge branch 'master' into mobile-experience
kibanamachine Jun 9, 2021
41a76f3
Merge branch 'master' into mobile-experience
shahzad31 Jun 9, 2021
9ea07ec
Merge branch 'master' into mobile-experience
shahzad31 Jun 10, 2021
f71aa48
fix types
shahzad31 Jun 10, 2021
dde04c3
Merge branch 'mobile-experience' of https://github.com/shahzad31/kiba…
shahzad31 Jun 10, 2021
2cb4f1a
fix type and filters
shahzad31 Jun 10, 2021
51569fa
Merge branch 'master' into mobile-experience
shahzad31 Jun 10, 2021
e54969c
fix image
shahzad31 Jun 10, 2021
1631c07
Merge branch 'master' into mobile-experience
shahzad31 Jun 10, 2021
1f9c6ad
added mobile experience
shahzad31 Jun 10, 2021
17786ca
Merge branch 'master' into mobile-experience
shahzad31 Jun 14, 2021
9421c50
resolve conflicts
shahzad31 Jun 14, 2021
5192aa0
refactor code for has data
shahzad31 Jun 14, 2021
716184f
added throughput and distribution configs for mobile data
AlexanderWert Jun 15, 2021
6a1390d
Merge pull request #5 from AlexanderWert/mobile-exploratory-view
shahzad31 Jun 15, 2021
3a8bb82
Merge branch 'master' into mobile-experience
shahzad31 Jun 15, 2021
48ece1f
update
shahzad31 Jun 15, 2021
26de779
Merge branch 'master' into mobile-experience
shahzad31 Jun 15, 2021
6754f80
fix types
shahzad31 Jun 15, 2021
541df52
Merge branch 'master' into mobile-experience
shahzad31 Jun 16, 2021
fe641a0
added environment
shahzad31 Jun 16, 2021
423fba9
fix test
shahzad31 Jun 16, 2021
a802015
fix type
shahzad31 Jun 16, 2021
dfc1690
use i18n
shahzad31 Jun 16, 2021
8ab2ddd
Merge branch 'master' into mobile-experience
shahzad31 Jun 16, 2021
7f3bbc3
fix i18n
shahzad31 Jun 16, 2021
b1005cd
Added mobile device distribution config + fixed mobile field names
AlexanderWert Jun 17, 2021
c949862
fixing chart type options and label for distribution
AlexanderWert Jun 17, 2021
ec009fb
Merge pull request #6 from AlexanderWert/mobile-exploratory-view
shahzad31 Jun 17, 2021
2a9e540
Merge branch 'master' into mobile-experience
shahzad31 Jun 17, 2021
22ef586
fix types
shahzad31 Jun 17, 2021
ebf4ec5
fix 18n
shahzad31 Jun 17, 2021
0ecb538
fix test
shahzad31 Jun 17, 2021
2289c58
fix lint
shahzad31 Jun 17, 2021
067a7c3
Merge branch 'master' into mobile-experience
shahzad31 Jun 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ export const fetchObservabilityOverviewPageData = async ({
};

export async function getHasData() {
const res = await callApmApi({
return await callApmApi({
endpoint: 'GET /api/apm/observability_overview/has_data',
signal: null,
});

return res.hasData;
}
10 changes: 8 additions & 2 deletions x-pack/plugins/apm/server/lib/observability_overview/has_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ export async function getHasData({ setup }: { setup: Setup }) {
'observability_overview_has_apm_data',
params
);
return response.hits.total.value > 0;
return {
hasData: response.hits.total.value > 0,
indices: setup.indices,
};
} catch (e) {
return false;
return {
hasData: false,
indices: setup.indices,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,11 @@ import {
import { APMConfig } from '../../..';
import { APMRouteHandlerResources } from '../../../routes/typings';
import { withApmSpan } from '../../../utils/with_apm_span';
import { ApmIndicesConfig } from '../../../../../observability/common/typings';

type ISavedObjectsClient = Pick<SavedObjectsClient, 'get'>;
export { ApmIndicesConfig };

export interface ApmIndicesConfig {
/* eslint-disable @typescript-eslint/naming-convention */
'apm_oss.sourcemapIndices': string;
'apm_oss.errorIndices': string;
'apm_oss.onboardingIndices': string;
'apm_oss.spanIndices': string;
'apm_oss.transactionIndices': string;
'apm_oss.metricsIndices': string;
/* eslint-enable @typescript-eslint/naming-convention */
apmAgentConfigurationIndex: string;
apmCustomLinkIndex: string;
}
type ISavedObjectsClient = Pick<SavedObjectsClient, 'get'>;

export type ApmIndicesName = keyof ApmIndicesConfig;

Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/apm/server/routes/observability_overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ const observabilityOverviewHasDataRoute = createApmServerRoute({
options: { tags: ['access:apm'] },
handler: async (resources) => {
const setup = await setupRequest(resources);
const res = await getHasData({ setup });
return { hasData: res };
return await getHasData({ setup });
},
});

Expand Down
13 changes: 13 additions & 0 deletions x-pack/plugins/observability/common/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,16 @@ export type Maybe<T> = T | null | undefined;

export const alertStatusRt = t.union([t.literal('all'), t.literal('open'), t.literal('closed')]);
export type AlertStatus = t.TypeOf<typeof alertStatusRt>;

export interface ApmIndicesConfig {
/* eslint-disable @typescript-eslint/naming-convention */
'apm_oss.sourcemapIndices': string;
'apm_oss.errorIndices': string;
'apm_oss.onboardingIndices': string;
'apm_oss.spanIndices': string;
'apm_oss.transactionIndices': string;
'apm_oss.metricsIndices': string;
/* eslint-enable @typescript-eslint/naming-convention */
apmAgentConfigurationIndex: string;
apmCustomLinkIndex: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,24 @@ import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import { useHasData } from '../../../hooks/use_has_data';
import { usePluginContext } from '../../../hooks/use_plugin_context';
import { getEmptySections } from '../../../pages/overview/empty_section';
import { UXHasDataResponse } from '../../../typings';
import { EmptySection } from './empty_section';

export function EmptySections() {
const { core } = usePluginContext();
const theme = useContext(ThemeContext);
const { hasData } = useHasData();
const { hasDataMap } = useHasData();

const appEmptySections = getEmptySections({ core }).filter(({ id }) => {
if (id === 'alert') {
const { status, hasData: alerts } = hasData.alert || {};
const { status, hasData: alerts } = hasDataMap.alert || {};
return (
status === FETCH_STATUS.FAILURE ||
(status === FETCH_STATUS.SUCCESS && (alerts as Alert[]).length === 0)
);
} else {
const app = hasData[id];
const app = hasDataMap[id];
if (app) {
const _hasData = id === 'ux' ? (app.hasData as UXHasDataResponse)?.hasData : app.hasData;
return app.status === FETCH_STATUS.FAILURE || !_hasData;
return app.status === FETCH_STATUS.FAILURE || !app.hasData;
}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jest.mock('react-router-dom', () => ({
describe('APMSection', () => {
beforeAll(() => {
jest.spyOn(hasDataHook, 'useHasData').mockReturnValue({
hasData: {
hasDataMap: {
apm: {
status: fetcherHook.FETCH_STATUS.SUCCESS,
hasData: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function APMSection({ bucketSize }: Props) {
const theme = useContext(ThemeContext);
const chartTheme = useChartTheme();
const history = useHistory();
const { forceUpdate, hasData } = useHasData();
const { forceUpdate, hasDataMap } = useHasData();
const { relativeStart, relativeEnd, absoluteStart, absoluteEnd } = useTimeRange();

const { data, status } = useFetcher(
Expand All @@ -66,7 +66,7 @@ export function APMSection({ bucketSize }: Props) {
[bucketSize, relativeStart, relativeEnd, forceUpdate]
);

if (!hasData.apm?.hasData) {
if (!hasDataMap.apm?.hasData) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function getColorPerItem(series?: LogsFetchDataResponse['series']) {
export function LogsSection({ bucketSize }: Props) {
const history = useHistory();
const chartTheme = useChartTheme();
const { forceUpdate, hasData } = useHasData();
const { forceUpdate, hasDataMap } = useHasData();
const { relativeStart, relativeEnd, absoluteStart, absoluteEnd } = useTimeRange();

const { data, status } = useFetcher(
Expand All @@ -65,7 +65,7 @@ export function LogsSection({ bucketSize }: Props) {
[bucketSize, relativeStart, relativeEnd, forceUpdate]
);

if (!hasData.infra_logs?.hasData) {
if (!hasDataMap.infra_logs?.hasData) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const bytesPerSecondFormatter = (value: NumberOrNull) =>
value === null ? '' : numeral(value).format('0b') + '/s';

export function MetricsSection({ bucketSize }: Props) {
const { forceUpdate, hasData } = useHasData();
const { forceUpdate, hasDataMap } = useHasData();
const { relativeStart, relativeEnd, absoluteStart, absoluteEnd } = useTimeRange();
const [sortDirection, setSortDirection] = useState<Direction>('asc');
const [sortField, setSortField] = useState<keyof MetricsFetchDataSeries>('uptime');
Expand Down Expand Up @@ -88,7 +88,7 @@ export function MetricsSection({ bucketSize }: Props) {
[data, setSortField, setSortDirection]
);

if (!hasData.infra_metrics?.hasData) {
if (!hasDataMap.infra_metrics?.hasData) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function UptimeSection({ bucketSize }: Props) {
const theme = useContext(ThemeContext);
const chartTheme = useChartTheme();
const history = useHistory();
const { forceUpdate, hasData } = useHasData();
const { forceUpdate, hasDataMap } = useHasData();
const { relativeStart, relativeEnd, absoluteStart, absoluteEnd } = useTimeRange();

const { data, status } = useFetcher(
Expand All @@ -58,7 +58,7 @@ export function UptimeSection({ bucketSize }: Props) {
[bucketSize, relativeStart, relativeEnd, forceUpdate]
);

if (!hasData.synthetics?.hasData) {
if (!hasDataMap.synthetics?.hasData) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jest.mock('react-router-dom', () => ({
describe('UXSection', () => {
beforeAll(() => {
jest.spyOn(hasDataHook, 'useHasData').mockReturnValue({
hasData: {
hasDataMap: {
ux: {
status: fetcherHook.FETCH_STATUS.SUCCESS,
hasData: { hasData: true, serviceName: 'elastic-co-frontend' },
hasData: true,
serviceName: 'elastic-co-frontend',
},
},
} as HasDataContextValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ import { getDataHandler } from '../../../../data_handler';
import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher';
import { useHasData } from '../../../../hooks/use_has_data';
import { useTimeRange } from '../../../../hooks/use_time_range';
import { UXHasDataResponse } from '../../../../typings';
import CoreVitals from '../../../shared/core_web_vitals';

interface Props {
bucketSize: string;
}

export function UXSection({ bucketSize }: Props) {
const { forceUpdate, hasData } = useHasData();
const { forceUpdate, hasDataMap } = useHasData();
const { relativeStart, relativeEnd, absoluteStart, absoluteEnd } = useTimeRange();
const uxHasDataResponse = (hasData.ux?.hasData as UXHasDataResponse) || {};
const serviceName = uxHasDataResponse.serviceName as string;
const uxHasDataResponse = hasDataMap.ux;
const serviceName = uxHasDataResponse?.serviceName as string;

const { data, status } = useFetcher(
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
*/

import { FieldFormat } from '../../types';
import { TRANSACTION_DURATION } from '../constants/elasticsearch_fieldnames';
import {
METRIC_SYSTEM_CPU_USAGE,
METRIC_SYSTEM_MEMORY_USAGE,
TRANSACTION_DURATION,
} from '../constants/elasticsearch_fieldnames';

export const apmFieldFormats: FieldFormat[] = [
{
Expand All @@ -18,7 +22,16 @@ export const apmFieldFormats: FieldFormat[] = [
outputFormat: 'asMilliseconds',
outputPrecision: 0,
showSuffix: true,
useShortSuffix: true,
},
},
},
{
field: METRIC_SYSTEM_MEMORY_USAGE,
format: { id: 'bytes', params: {} },
},
{
field: METRIC_SYSTEM_CPU_USAGE,
format: { id: 'percent', params: {} },
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import {
BROWSER_VERSION_LABEL,
CLS_LABEL,
CORE_WEB_VITALS_LABEL,
DEVICE_DISTRIBUTION_LABEL,
DEVICE_LABEL,
ENVIRONMENT_LABEL,
FCP_LABEL,
FID_LABEL,
HOST_NAME_LABEL,
KIP_OVER_TIME_LABEL,
KPI_OVER_TIME_LABEL,
KPI_LABEL,
LCP_LABEL,
LOCATION_LABEL,
Expand All @@ -31,6 +32,7 @@ import {
OS_LABEL,
PERF_DIST_LABEL,
PORT_LABEL,
REQUEST_METHOD,
SERVICE_NAME_LABEL,
TAGS_LABEL,
TBT_LABEL,
Expand Down Expand Up @@ -72,14 +74,17 @@ export const FieldLabels: Record<string, string> = {

'performance.metric': METRIC_LABEL,
'Business.KPI': KPI_LABEL,
'http.request.method': REQUEST_METHOD,
};

export const DataViewLabels: Record<ReportViewTypeId, string> = {
dist: PERF_DIST_LABEL,
kpi: KIP_OVER_TIME_LABEL,
kpi: KPI_OVER_TIME_LABEL,
cwv: CORE_WEB_VITALS_LABEL,
mdd: DEVICE_DISTRIBUTION_LABEL,
};

export const USE_BREAK_DOWN_COLUMN = 'USE_BREAK_DOWN_COLUMN';
export const FILTER_RECORDS = 'FILTER_RECORDS';
export const TERMS_COLUMN = 'TERMS_COLUMN';
export const OPERATION_COLUMN = 'operation';
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export const ERROR_PAGE_URL = 'error.page.url';

// METRICS
export const METRIC_SYSTEM_FREE_MEMORY = 'system.memory.actual.free';
export const METRIC_SYSTEM_MEMORY_USAGE = 'system.memory.usage';
export const METRIC_SYSTEM_CPU_USAGE = 'system.cpu.usage';
export const METRIC_SYSTEM_TOTAL_MEMORY = 'system.memory.total';
export const METRIC_SYSTEM_CPU_PERCENT = 'system.cpu.total.norm.pct';
export const METRIC_PROCESS_CPU_PERCENT = 'system.process.cpu.total.norm.pct';
Expand Down
Loading