-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add snapshot tests for query search params * Use projections to fetch data * Add configuration and aggregations for local filters * Add endpoints for local filters * UseLocalUIFilters hook * Parse Local UI filters from URL params * LocalUIFilters component * TransactionTypeFilter * replace useServiceTransactionTypes with useTransactionTypes * Support transactionType for trace projection/api * Configure Local UI Filters * Use units instead of hardcoded px * Fix i18n error * Remove unused labels from translation files * Update URL of API integration test for transaction_types API call * Revert "replace useServiceTransactionTypes with useTransactionTypes" This reverts commit bae7fa44a0fc1ace0b498cc78626fabb2d310437. * Revert "Support transactionType for trace projection/api" This reverts commit 2edb32cf04ca2c38885c457ba57ce0a1547fd199. * Remove transaction type filter for traces,error groups * Address review feedback * Don't clone in mergeProjection; add tests * Address review feedback * Revert transaction_types API path in functional tests * More review feedback * More review feedback: - Add transactions projection - Merge traces/transaction groups projections * Don't persist local UI filters in HistoryTabs * Move projections to server folder * Move transactionName into options * Use pod name instead of pod uid
- Loading branch information
1 parent
1e978ad
commit 4b05fd9
Showing
67 changed files
with
4,679 additions
and
325 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
x-pack/legacy/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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 { Setup } from '../../server/lib/helpers/setup_request'; | ||
import { | ||
PROCESSOR_EVENT, | ||
SERVICE_NAME, | ||
ERROR_GROUP_ID | ||
} from '../elasticsearch_fieldnames'; | ||
import { rangeFilter } from '../../server/lib/helpers/range_filter'; | ||
|
||
export function getErrorGroupsProjection({ | ||
setup, | ||
serviceName | ||
}: { | ||
setup: Setup; | ||
serviceName: string; | ||
}) { | ||
const { start, end, uiFiltersES, config } = setup; | ||
|
||
return { | ||
index: config.get<string>('apm_oss.errorIndices'), | ||
body: { | ||
query: { | ||
bool: { | ||
filter: [ | ||
{ term: { [SERVICE_NAME]: serviceName } }, | ||
{ term: { [PROCESSOR_EVENT]: 'error' } }, | ||
{ range: rangeFilter(start, end) }, | ||
...uiFiltersES | ||
] | ||
} | ||
}, | ||
aggs: { | ||
error_groups: { | ||
terms: { | ||
field: ERROR_GROUP_ID | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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 { Setup } from '../../server/lib/helpers/setup_request'; | ||
import { SERVICE_NAME, PROCESSOR_EVENT } from '../elasticsearch_fieldnames'; | ||
import { rangeFilter } from '../../server/lib/helpers/range_filter'; | ||
|
||
export function getMetricsProjection({ | ||
setup, | ||
serviceName | ||
}: { | ||
setup: Setup; | ||
serviceName: string; | ||
}) { | ||
const { start, end, uiFiltersES, config } = setup; | ||
|
||
return { | ||
index: config.get<string>('apm_oss.metricsIndices'), | ||
body: { | ||
query: { | ||
bool: { | ||
filter: [ | ||
{ term: { [SERVICE_NAME]: serviceName } }, | ||
{ term: { [PROCESSOR_EVENT]: 'metric' } }, | ||
{ | ||
range: rangeFilter(start, end) | ||
}, | ||
...uiFiltersES | ||
] | ||
} | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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 { Setup } from '../../server/lib/helpers/setup_request'; | ||
import { SERVICE_NAME, PROCESSOR_EVENT } from '../elasticsearch_fieldnames'; | ||
import { rangeFilter } from '../../server/lib/helpers/range_filter'; | ||
|
||
export function getServicesProjection({ setup }: { setup: Setup }) { | ||
const { start, end, uiFiltersES, config } = setup; | ||
|
||
return { | ||
index: [ | ||
config.get<string>('apm_oss.metricsIndices'), | ||
config.get<string>('apm_oss.errorIndices'), | ||
config.get<string>('apm_oss.transactionIndices') | ||
], | ||
body: { | ||
size: 0, | ||
query: { | ||
bool: { | ||
filter: [ | ||
{ | ||
terms: { [PROCESSOR_EVENT]: ['transaction', 'error', 'metric'] } | ||
}, | ||
{ range: rangeFilter(start, end) }, | ||
...uiFiltersES | ||
] | ||
} | ||
}, | ||
aggs: { | ||
services: { | ||
terms: { | ||
field: SERVICE_NAME | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} |
46 changes: 46 additions & 0 deletions
46
x-pack/legacy/plugins/apm/common/projections/transaction_groups.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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 { omit } from 'lodash'; | ||
import { Setup } from '../../server/lib/helpers/setup_request'; | ||
import { TRANSACTION_NAME, PARENT_ID } from '../elasticsearch_fieldnames'; | ||
import { Options } from '../../server/lib/transaction_groups/fetcher'; | ||
import { getTransactionsProjection } from './transactions'; | ||
import { mergeProjection } from './util/merge_projection'; | ||
|
||
export function getTransactionGroupsProjection({ | ||
setup, | ||
options | ||
}: { | ||
setup: Setup; | ||
options: Options; | ||
}) { | ||
const transactionsProjection = getTransactionsProjection({ | ||
setup, | ||
...(omit(options, 'type') as Omit<typeof options, 'type'>) | ||
}); | ||
|
||
const bool = | ||
options.type === 'top_traces' | ||
? { | ||
must_not: [{ exists: { field: PARENT_ID } }] | ||
} | ||
: {}; | ||
|
||
return mergeProjection(transactionsProjection, { | ||
body: { | ||
query: { | ||
bool | ||
}, | ||
aggs: { | ||
transactions: { | ||
terms: { | ||
field: TRANSACTION_NAME | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
} |
58 changes: 58 additions & 0 deletions
58
x-pack/legacy/plugins/apm/common/projections/transactions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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 { Setup } from '../../server/lib/helpers/setup_request'; | ||
import { | ||
SERVICE_NAME, | ||
TRANSACTION_TYPE, | ||
PROCESSOR_EVENT, | ||
TRANSACTION_NAME | ||
} from '../elasticsearch_fieldnames'; | ||
import { rangeFilter } from '../../server/lib/helpers/range_filter'; | ||
|
||
export function getTransactionsProjection({ | ||
setup, | ||
serviceName, | ||
transactionName, | ||
transactionType | ||
}: { | ||
setup: Setup; | ||
serviceName?: string; | ||
transactionName?: string; | ||
transactionType?: string; | ||
}) { | ||
const { start, end, uiFiltersES, config } = setup; | ||
|
||
const transactionNameFilter = transactionName | ||
? [{ term: { [TRANSACTION_NAME]: transactionName } }] | ||
: []; | ||
const transactionTypeFilter = transactionType | ||
? [{ term: { [TRANSACTION_TYPE]: transactionType } }] | ||
: []; | ||
const serviceNameFilter = serviceName | ||
? [{ term: { [SERVICE_NAME]: serviceName } }] | ||
: []; | ||
|
||
const bool = { | ||
filter: [ | ||
{ range: rangeFilter(start, end) }, | ||
{ term: { [PROCESSOR_EVENT]: 'transaction' } }, | ||
...transactionNameFilter, | ||
...transactionTypeFilter, | ||
...serviceNameFilter, | ||
...uiFiltersES | ||
] | ||
}; | ||
|
||
return { | ||
index: config.get<string>('apm_oss.transactionIndices'), | ||
body: { | ||
query: { | ||
bool | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* 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 { SearchParams } from 'elasticsearch'; | ||
|
||
export type Projection = Omit<SearchParams, 'body' | 'aggs'> & { | ||
body: { | ||
query: any; | ||
} & { | ||
aggs?: { | ||
[key: string]: { | ||
terms: any; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
export enum PROJECTION { | ||
SERVICES = 'services', | ||
TRANSACTION_GROUPS = 'transactionGroups', | ||
TRACES = 'traces', | ||
TRANSACTIONS = 'transactions', | ||
METRICS = 'metrics', | ||
ERROR_GROUPS = 'errorGroups' | ||
} |
Oops, something went wrong.