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

[APM] Optimize services overview #69648

Merged
merged 12 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
28 changes: 20 additions & 8 deletions x-pack/plugins/apm/common/projections/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,37 @@ import { rangeFilter } from '../utils/range_filter';

export function getServicesProjection({
setup,
noEvents,
}: {
setup: Setup & SetupTimeRange & SetupUIFilters;
noEvents?: boolean;
}) {
const { start, end, uiFiltersES, indices } = setup;

return {
index: [
indices['apm_oss.metricsIndices'],
indices['apm_oss.errorIndices'],
indices['apm_oss.transactionIndices'],
],
...(noEvents
? {}
: {
index: [
indices['apm_oss.metricsIndices'],
indices['apm_oss.errorIndices'],
indices['apm_oss.transactionIndices'],
],
}),
Copy link
Member

Choose a reason for hiding this comment

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

will this be changed by your PR for new client?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep! there will no longer be a need for noEvents.

body: {
size: 0,
query: {
bool: {
filter: [
{
terms: { [PROCESSOR_EVENT]: ['transaction', 'error', 'metric'] },
},
...(noEvents
? []
: [
{
terms: {
[PROCESSOR_EVENT]: ['transaction', 'error', 'metric'],
},
},
]),
{ range: rangeFilter(start, end) },
...uiFiltersES,
],
Expand Down
14 changes: 14 additions & 0 deletions x-pack/plugins/apm/common/utils/array_union_to_callable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ValuesType } from 'utility-types';

// work around a TypeScript limitation described in https://stackoverflow.com/posts/49511416

export const arrayUnionToCallable = <T extends any[]>(
array: T
): Array<ValuesType<T>> => {
return array;
};

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

Loading