Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Exploratory View] Mobile experience #99565

Merged
merged 48 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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 @@ -28,9 +28,15 @@ export function getHasData({ setup }: { setup: Setup }) {
};

const response = await apmEventClient.search(params);
return response.hits.total.value > 0;
return {
hasData: response.hits.total.value > 0,
indices: setup.indices['apm_oss.transactionIndices']!,
Copy link
Member

@sorenlouv sorenlouv Jun 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little odd to return the indices from this endpoint, since it's called has_data. If we really want to do it, shouldn't this include all of the indices that are being queried?

Eg:

Suggested change
indices: setup.indices['apm_oss.transactionIndices']!,
indices: [
setup.indices[ProcessorEvent.transaction],
setup.indices[ProcessorEvent.error],
setup.indices[ProcessorEvent.metric]
],

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally i think we should return info like this from all endpoints. I will modify it to return whole APM indices settings, instead of just transaction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should every API return this info? We already have an API (GET /api/apm/settings/apm-index-settings) where you can get this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant in a sense of visiblity perspective, the way we are doing that inspect stuff for debugging purpose, i think it's no harm if we return indices information as an API response, it instanlty give you a view, against which indices that API got executed.

};
} catch (e) {
return false;
return {
hasData: false,
indices: setup.indices['apm_oss.transactionIndices']!,
};
}
});
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ export const FieldLabels: Record<string, string> = {

'performance.metric': METRIC_LABEL,
'Business.KPI': KPI_LABEL,


'labels.net_connection_carrier_name': 'Carrier Name',
shahzad31 marked this conversation as resolved.
Show resolved Hide resolved
'http.request.method': 'Request Method',
'labels.net_connection_type': 'Connection Type',
'host.os.full': 'Host OS',
'host.os.platform': 'OS Platform',
'labels.device_model': ' Device Model',
// eslint-disable-next-line @typescript-eslint/naming-convention
'labels.net_connection_carrier_isoCountryCode': 'Carrier Location',
};

export const DataViewLabels: Record<ReportViewTypeId, string> = {
Expand All @@ -92,6 +102,7 @@ export const DataViewLabels: Record<ReportViewTypeId, string> = {
logs: LOGS_FREQUENCY_LABEL,
mem: MEMORY_USAGE_LABEL,
nwk: NETWORK_ACTIVITY_LABEL,
mrp: 'Mobile response duration',
};

export const ReportToDataTypeMap: Record<ReportViewTypeId, AppDataType> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { getMemoryUsageLensConfig } from './metrics/memory_usage_config';
import { getNetworkActivityLensConfig } from './metrics/network_activity_config';
import { getLogsFrequencyLensConfig } from './logs/logs_frequency_config';
import { IIndexPattern } from '../../../../../../../../src/plugins/data/common/index_patterns';
import { getResponseDurationLensConfig } from './mobile/response_duration_config';

interface Props {
reportType: keyof typeof ReportViewTypes;
Expand All @@ -34,6 +35,8 @@ export const getDefaultConfigs = ({ reportType, seriesId, indexPattern }: Props)
return getMonitorDurationConfig({ seriesId, indexPattern });
case 'uptime-pings':
return getMonitorPingsConfig({ seriesId, indexPattern });
case 'response-duration':
return getResponseDurationLensConfig({ seriesId, indexPattern });
case 'service-latency':
return getServiceLatencyLensConfig({ seriesId, indexPattern });
case 'service-throughput':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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 { ConfigProps, DataSeries } from '../../types';
import { FieldLabels } from '../constants';
import { buildPhraseFilter } from '../utils';
import { SERVICE_NAME, TRANSACTION_DURATION } from '../constants/elasticsearch_fieldnames';

export function getResponseDurationLensConfig({ seriesId, indexPattern }: ConfigProps): DataSeries {
return {
id: seriesId,
reportType: 'service-latency',
defaultSeriesType: 'line',
seriesTypes: ['line', 'bar'],
xAxisColumn: {
sourceField: '@timestamp',
},
yAxisColumns: [
{
operationType: 'average',
sourceField: 'transaction.duration.us',
label: 'Latency',
},
],
hasOperationType: true,
defaultFilters: [
'labels.net_connection_carrier_name',
'labels.device_model',
'labels.net_connection_type',
'host.os.platform',
'host.os.full',
],
breakdowns: [
'labels.net_connection_carrier_name',
'labels.device_model',
'labels.net_connection_type',
'host.os.platform',
'labels.net_connection_carrier_isoCountryCode',
],
filters: [
...buildPhraseFilter('transaction.type', 'request', indexPattern),
shahzad31 marked this conversation as resolved.
Show resolved Hide resolved
...buildPhraseFilter('agent.name', 'opentelemetry/swift', indexPattern),
],
labels: {
...FieldLabels,
[TRANSACTION_DURATION]: 'Response time',
[SERVICE_NAME]: 'Mobile app',
},
reportDefinitions: [
{
field: 'service.name',
required: true,
},
],
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ export function IndexPatternContextProvider({ children }: ProviderProps) {
synthetics: null,
ux: null,
apm: null,
mobile: null,
} as HasAppDataState);

const {
services: { data },
} = useKibana<ObservabilityPublicPluginsStart>();

const checkIfAppHasData = async (dataType: AppDataType) => {
const handler = getDataHandler(dataType);
const handler = getDataHandler(dataType === 'mobile' ? 'apm' : dataType);
return handler?.hasData();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ReportToDataTypeMap } from '../../configurations/constants';
export const dataTypes: Array<{ id: AppDataType; label: string }> = [
{ id: 'synthetics', label: 'Synthetic Monitoring' },
{ id: 'ux', label: 'User Experience (RUM)' },
{ id: 'mobile', label: 'Mobile Experience' },
// { id: 'infra_logs', label: 'Logs' },
// { id: 'infra_metrics', label: 'Metrics' },
// { id: 'apm', label: 'APM' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ export const ReportTypes: Record<AppDataType, Array<{ id: ReportViewTypeId; labe
{ id: 'pld', label: 'Performance distribution' },
{ id: 'kpi', label: 'KPI over time' },
],
mobile: [
{
id: 'mrp',
label: 'Response duration',
},
],
apm: [
{ id: 'svl', label: 'Latency' },
{ id: 'tpt', label: 'Throughput' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const ReportViewTypes = {
cpu: 'cpu-usage',
mem: 'memory-usage',
nwk: 'network-activity',
mrp: 'response-duration',
} as const;

type ValueOf<T> = T[keyof T];
Expand Down Expand Up @@ -95,7 +96,7 @@ export interface ConfigProps {
indexPattern: IIndexPattern;
}

export type AppDataType = 'synthetics' | 'ux' | 'infra_logs' | 'infra_metrics' | 'apm';
export type AppDataType = 'synthetics' | 'ux' | 'infra_logs' | 'infra_metrics' | 'apm' | 'mobile';

type FormatType = 'duration' | 'number';
type InputFormat = 'microseconds' | 'milliseconds' | 'seconds';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const appFieldFormats: Record<AppDataType, FieldFormat[] | null> = {
ux: rumFieldFormats,
apm: apmFieldFormats,
synthetics: syntheticsFieldFormats,
mobile: apmFieldFormats,
};

function getFieldFormatsForApp(app: AppDataType) {
Expand All @@ -35,6 +36,7 @@ export const indexPatternList: Record<AppDataType, string> = {
ux: 'rum_static_index_pattern_id',
infra_logs: 'infra_logs_static_index_pattern_id',
infra_metrics: 'infra_metrics_static_index_pattern_id',
mobile: 'mobile_static_index_pattern_id',
};

const appToPatternMap: Record<AppDataType, string> = {
Expand All @@ -43,6 +45,7 @@ const appToPatternMap: Record<AppDataType, string> = {
ux: '(rum-data-view)*',
infra_logs: '',
infra_metrics: '',
mobile: '(mobile-data-view)*',
};

const getAppIndicesWithPattern = (app: AppDataType, indices: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export interface ObservabilityFetchDataResponse {
}

export interface ObservabilityHasDataResponse {
apm: boolean;
apm: HasDataResponse;
infra_metrics: boolean;
infra_logs: boolean;
synthetics: HasDataResponse;
Expand Down