Skip to content

Commit

Permalink
Merge branch 'main' into 154929-logs-onboarding-system-logs-server-ro…
Browse files Browse the repository at this point in the history
…utes
  • Loading branch information
yngrdyn authored Aug 4, 2023
2 parents f9075e7 + 0a8d32a commit da0970b
Show file tree
Hide file tree
Showing 21 changed files with 698 additions and 492 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,6 @@
"deep-freeze-strict": "^1.1.1",
"deepmerge": "^4.2.2",
"del": "^6.1.0",
"elastic-apm-http-client": "^11.0.1",
"elastic-apm-node": "^3.48.0",
"email-addresses": "^5.0.0",
"execa": "^4.0.2",
Expand Down Expand Up @@ -1391,7 +1390,7 @@
"babel-plugin-require-context-hook": "^1.0.0",
"babel-plugin-styled-components": "^2.0.7",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"backport": "^8.9.7",
"backport": "^8.9.8",
"blob-polyfill": "^7.0.20220408",
"callsites": "^3.1.0",
"chance": "1.0.18",
Expand Down

This file was deleted.

13 changes: 6 additions & 7 deletions x-pack/plugins/apm/common/mobile_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
* 2.0.
*/

export enum MobilePropertyType {
export enum MobileProperty {
Device = 'device',
NetworkConnectionType = 'netConnectionType',
OsVersion = 'osVersion',
AppVersion = 'appVersion',
}

export type MobilePropertyNctType = MobilePropertyType.NetworkConnectionType;

export type MobilePropertyDeviceOsAppVersionType =
| MobilePropertyType.Device
| MobilePropertyType.OsVersion
| MobilePropertyType.AppVersion;
export type MobilePropertyType =
| MobileProperty.Device
| MobileProperty.OsVersion
| MobileProperty.AppVersion
| MobileProperty.NetworkConnectionType;
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { i18n } from '@kbn/i18n';
import React from 'react';
import { useHistory } from 'react-router-dom';
import { MobileProperty } from '../../../../../../common/mobile_types';
import { useTimeRange } from '../../../../../hooks/use_time_range';
import { useApmServiceContext } from '../../../../../context/apm_service/use_apm_service_context';
import { useAnyOfApmParams } from '../../../../../hooks/use_apm_params';
Expand All @@ -31,25 +32,25 @@ const ALL_OPTION = {

const MOBILE_FILTERS: Array<{ key: MobileFilter['key']; label: string }> = [
{
key: 'device',
key: MobileProperty.Device,
label: i18n.translate('xpack.apm.mobile.filters.device', {
defaultMessage: 'Device',
}),
},
{
key: 'osVersion',
key: MobileProperty.OsVersion,
label: i18n.translate('xpack.apm.mobile.filters.osVersion', {
defaultMessage: 'OS version',
}),
},
{
key: 'appVersion',
key: MobileProperty.AppVersion,
label: i18n.translate('xpack.apm.mobile.filters.appVersion', {
defaultMessage: 'App version',
}),
},
{
key: 'netConnectionType',
key: MobileProperty.NetworkConnectionType,
label: i18n.translate('xpack.apm.mobile.filters.nct', {
defaultMessage: 'NCT',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@ import { SunburstChart } from './sunburst_chart';
import { useBreakpoints } from '../../../../../hooks/use_breakpoints';
import { APIReturnType } from '../../../../../services/rest/create_call_apm_api';
import { useFetcher } from '../../../../../hooks/use_fetcher';
import { MobilePropertyType } from '../../../../../../common/mobile_types';
import { MobileProperty } from '../../../../../../common/mobile_types';

type MostUsedCharts =
APIReturnType<'GET /internal/apm/mobile-services/{serviceName}/most_used_charts'>['mostUsedCharts'][0];

const MOST_USED_CHARTS: Array<{ key: MostUsedCharts['key']; label: string }> = [
{
key: MobilePropertyType.Device,
key: MobileProperty.Device,
label: i18n.translate('xpack.apm.mobile.charts.device', {
defaultMessage: 'Devices',
}),
},
{
key: MobilePropertyType.NetworkConnectionType,
key: MobileProperty.NetworkConnectionType,
label: i18n.translate('xpack.apm.mobile.charts.nct', {
defaultMessage: 'Network Connection Type',
}),
},
{
key: MobilePropertyType.OsVersion,
key: MobileProperty.OsVersion,
label: i18n.translate('xpack.apm.mobile.charts.osVersion', {
defaultMessage: 'OS version',
}),
},
{
key: MobilePropertyType.AppVersion,
key: MobileProperty.AppVersion,
label: i18n.translate('xpack.apm.mobile.charts.appVersion', {
defaultMessage: 'App version',
}),
Expand Down
83 changes: 83 additions & 0 deletions x-pack/plugins/apm/server/routes/mobile/get_device_os_app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* 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 {
termQuery,
kqlQuery,
rangeQuery,
} from '@kbn/observability-plugin/server';
import { ProcessorEvent } from '@kbn/observability-plugin/common';
import {
DEVICE_MODEL_IDENTIFIER,
HOST_OS_VERSION,
SERVICE_NAME,
SERVICE_VERSION,
TRANSACTION_TYPE,
} from '../../../common/es_fields/apm';
import { environmentQuery } from '../../../common/utils/environment_query';
import { APMEventClient } from '../../lib/helpers/create_es_client/create_apm_event_client';

export async function getDeviceOSApp({
kuery,
apmEventClient,
serviceName,
transactionType,
environment,
start,
end,
size,
}: {
kuery: string;
apmEventClient: APMEventClient;
serviceName: string;
transactionType?: string;
environment: string;
start: number;
end: number;
size: number;
}) {
return await apmEventClient.search('get_mobile_device_os_app', {
apm: {
events: [ProcessorEvent.transaction],
},
body: {
track_total_hits: false,
size: 0,
query: {
bool: {
filter: [
...termQuery(SERVICE_NAME, serviceName),
...termQuery(TRANSACTION_TYPE, transactionType),
...rangeQuery(start, end),
...environmentQuery(environment),
...kqlQuery(kuery),
],
},
},
aggs: {
devices: {
terms: {
field: DEVICE_MODEL_IDENTIFIER,
size,
},
},
osVersions: {
terms: {
field: HOST_OS_VERSION,
size,
},
},
appVersions: {
terms: {
field: SERVICE_VERSION,
size,
},
},
},
},
});
}
Loading

0 comments on commit da0970b

Please sign in to comment.