Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into apm-mobile-agent-map
Browse files Browse the repository at this point in the history
  • Loading branch information
gbamparop committed Oct 31, 2022
2 parents 2837546 + e92b384 commit 48e9dae
Show file tree
Hide file tree
Showing 37 changed files with 748 additions and 330 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
"compare-versions": "3.5.1",
"constate": "^3.3.2",
"copy-to-clipboard": "^3.0.8",
"core-js": "^3.25.5",
"core-js": "^3.26.0",
"cronstrue": "^1.51.0",
"cuid": "^2.1.8",
"cytoscape": "^3.10.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-babel-preset/node_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = (_, options = {}) => {
// Because of that we should use for that value the same version we install
// in the package.json in order to have the same polyfills between the environment
// and the tests
corejs: '3.25.5',
corejs: '3.26.0',
bugfixes: true,

...(options['@babel/preset-env'] || {}),
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-babel-preset/webpack_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (_, options = {}) => {
modules: false,
// Please read the explanation for this
// in node_preset.js
corejs: '3.25.5',
corejs: '3.26.0',
bugfixes: true,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function registerPerformanceMetricEventType(
/**
* Report a `performance_metric` event type.
* @param analytics The {@link AnalyticsClient} to report the events.
* @param eventData The data to send, conforming the structure of a {@link MetricEvent}.
* @param eventData The data to send, conforming the structure of a {@link PerformanceMetricEvent}.
*/
export function reportPerformanceMetricEvent(
analytics: Pick<AnalyticsClient, 'reportEvent'>,
Expand Down
7 changes: 2 additions & 5 deletions packages/kbn-ebt-tools/src/performance_metric_events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export type { PerformanceMetricEvent as MetricEvent } from './schema';
export {
registerPerformanceMetricEventType as registerPerformanceMetricEventType,
reportPerformanceMetricEvent,
} from './helpers';
export type { PerformanceMetricEvent } from './schema';
export { registerPerformanceMetricEventType, reportPerformanceMetricEvent } from './helpers';
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/src/node/node_auto_tranpilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function registerNodeAutoTranspilation() {

const cache = new Cache({
pathRoot: REPO_ROOT,
dir: Path.resolve(REPO_ROOT, 'data/node_auto_transpilation_cache_v3', UPSTREAM_BRANCH),
dir: Path.resolve(REPO_ROOT, 'data/node_auto_transpilation_cache_v4', UPSTREAM_BRANCH),
prefix: determineCachePrefix(),
log: process.env.DEBUG_NODE_TRANSPILER_CACHE
? Fs.createWriteStream(Path.resolve(REPO_ROOT, 'node_auto_transpilation_cache.log'), {
Expand Down
7 changes: 3 additions & 4 deletions test/functional/apps/management/_index_pattern_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');
const PageObjects = getPageObjects(['settings']);
const esArchiver = getService('esArchiver');

// Failing: See https://github.com/elastic/kibana/issues/143109
describe.skip('index pattern filter', function describeIndexTests() {
describe('index pattern filter', function describeIndexTests() {
before(async function () {
await esArchiver.emptyKibanaIndex();
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.uiSettings.replace({});
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndexPatterns();
Expand All @@ -30,6 +28,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

afterEach(async function () {
await PageObjects.settings.removeIndexPattern();
await kibanaServer.savedObjects.cleanStandardList();
});

it('should filter indexed fields', async function () {
Expand Down
14 changes: 10 additions & 4 deletions test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,11 @@ export class SettingsPageObject extends FtrService {
}

async clearFieldTypeFilter(type: string) {
await this.testSubjects.clickWhenNotDisabledWithoutRetry('indexedFieldTypeFilterDropdown');
await this.retry.try(async () => {
await this.testSubjects.existOrFail('indexedFieldTypeFilterDropdown-popover');
await this.testSubjects.clickWhenNotDisabledWithoutRetry('indexedFieldTypeFilterDropdown');
await this.find.byCssSelector(
'.euiPopover-isOpen[data-test-subj="indexedFieldTypeFilterDropdown-popover"]'
);
});
await this.retry.try(async () => {
await this.testSubjects.existOrFail(`indexedFieldTypeFilterDropdown-option-${type}-checked`);
Expand All @@ -319,8 +321,12 @@ export class SettingsPageObject extends FtrService {
}

async setFieldTypeFilter(type: string) {
await this.testSubjects.clickWhenNotDisabledWithoutRetry('indexedFieldTypeFilterDropdown');
await this.testSubjects.existOrFail('indexedFieldTypeFilterDropdown-popover');
await this.retry.try(async () => {
await this.testSubjects.clickWhenNotDisabledWithoutRetry('indexedFieldTypeFilterDropdown');
await this.find.byCssSelector(
'.euiPopover-isOpen[data-test-subj="indexedFieldTypeFilterDropdown-popover"]'
);
});
await this.testSubjects.existOrFail(`indexedFieldTypeFilterDropdown-option-${type}`);
await this.testSubjects.click(`indexedFieldTypeFilterDropdown-option-${type}`);
await this.testSubjects.existOrFail(`indexedFieldTypeFilterDropdown-option-${type}-checked`);
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/apm/common/elasticsearch_fieldnames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const HOST = 'host';
export const HOST_HOSTNAME = 'host.hostname'; // Do not use. Please use `HOST_NAME` instead.
export const HOST_NAME = 'host.name';
export const HOST_OS_PLATFORM = 'host.os.platform';
export const HOST_OS_VERSION = 'host.os.version';
export const CONTAINER_ID = 'container.id';
export const CONTAINER = 'container';
export const CONTAINER_IMAGE = 'container.image.name';
Expand Down Expand Up @@ -157,3 +158,7 @@ export const FAAS_BILLED_DURATION = 'faas.billed_duration';
// Metadata
export const TIER = '_tier';
export const INDEX = '_index';

// Mobile
export const DEVICE_MODEL_IDENTIFIER = 'device.model.identifier';
export const NETWORK_CONNECTION_TYPE = 'network.connection.type';
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* 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 { EuiFlexGroup, EuiFlexItem, EuiSelect } from '@elastic/eui';
import React from 'react';
import { useHistory } from 'react-router-dom';
import { Environment } from '../../../../../../common/environment_rt';
import { useApmServiceContext } from '../../../../../context/apm_service/use_apm_service_context';
import { useFetcher } from '../../../../../hooks/use_fetcher';
import type { APIReturnType } from '../../../../../services/rest/create_call_apm_api';
import { push } from '../../../../shared/links/url_helpers';

type MobileFilter =
APIReturnType<'GET /internal/apm/services/{serviceName}/mobile/filters'>['mobileFilters'][0];

interface Props {
end: string;
environment: Environment;
kuery: string;
start: string;
filters: Record<MobileFilter['key'], string | undefined>;
}

const ALL_OPTION = {
value: 'all',
text: 'All',
};

export function MobileFilters({
end,
environment,
kuery,
start,
filters,
}: Props) {
const history = useHistory();
const { serviceName } = useApmServiceContext();
const { data = { mobileFilters: [] } } = useFetcher(
(callApmApi) => {
return callApmApi(
'GET /internal/apm/services/{serviceName}/mobile/filters',
{
params: {
path: { serviceName },
query: { end, environment, kuery, start },
},
}
);
},
[end, environment, kuery, serviceName, start]
);

function toSelectOptions(items?: string[]) {
return [
ALL_OPTION,
...(items?.map((item) => ({ value: item, text: item })) || []),
];
}

function onChangeFilter(key: MobileFilter['key'], value: string) {
push(history, {
query: { [key]: value === ALL_OPTION.value ? '' : value },
});
}

return (
<EuiFlexGroup justifyContent="flexEnd">
{data.mobileFilters.map((filter) => {
return (
<EuiFlexItem grow={false} key={filter.key}>
<EuiSelect
prepend={filter.label}
options={toSelectOptions(filter.options)}
value={filters[filter.key]}
onChange={(e) => {
onChangeFilter(filter.key, e.target.value);
}}
/>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { AggregatedTransactionsBadge } from '../../../shared/aggregated_transact
import { useApmParams } from '../../../../hooks/use_apm_params';
import { useTimeRange } from '../../../../hooks/use_time_range';
import { LatencyMap } from './latency_map';
import { MobileFilters } from './filters';

interface Props {
latencyChartHeight: number;
Expand All @@ -38,7 +39,16 @@ export function ServiceOverviewMobileCharts({

const {
query,
query: { environment, kuery, rangeFrom, rangeTo },
query: {
environment,
kuery,
rangeFrom,
rangeTo,
device,
osVersion,
appVersion,
netConnectionType,
},
} = useApmParams('/services/{serviceName}/overview');

const { start, end } = useTimeRange({ rangeFrom, rangeTo });
Expand All @@ -52,6 +62,20 @@ export function ServiceOverviewMobileCharts({

return (
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem>
<MobileFilters
start={start}
end={end}
environment={environment}
kuery={kuery}
filters={{
device,
osVersion,
appVersion,
netConnectionType,
}}
/>
</EuiFlexItem>
{fallbackToTransactions && (
<EuiFlexItem>
<AggregatedTransactionsBadge />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ export const serviceDetail = {
pageSize: toNumberRt,
sortField: t.string,
sortDirection: t.union([t.literal('asc'), t.literal('desc')]),
device: t.string,
osVersion: t.string,
appVersion: t.string,
netConnectionType: t.string,
}),
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { traceRouteRepository } from '../traces/route';
import { transactionRouteRepository } from '../transactions/route';
import { storageExplorerRouteRepository } from '../storage_explorer/route';
import { labsRouteRepository } from '../settings/labs/route';
import { mobileRouteRepository } from '../mobile/route';

function getTypedGlobalApmServerRouteRepository() {
const repository = {
Expand Down Expand Up @@ -75,6 +76,7 @@ function getTypedGlobalApmServerRouteRepository() {
...debugTelemetryRoute,
...timeRangeMetadataRoute,
...labsRouteRepository,
...mobileRouteRepository,
};

return repository;
Expand Down
Loading

0 comments on commit 48e9dae

Please sign in to comment.