Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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