Skip to content

Commit

Permalink
[APM] Don’t include UI filters when fetching a specific transaction (#…
Browse files Browse the repository at this point in the history
…57934)

* [APM] Don’t include UI filters when fetching transaction

When fetching an error sample, the related transaction is also fetched. This transaction should not be filtered by ui filters

* Fix snapshot

* Update term mock term used for ui filter
  • Loading branch information
sorenlouv authored Feb 19, 2020
1 parent 2c78be3 commit 0340fac
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 65 deletions.
21 changes: 4 additions & 17 deletions x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,10 @@ export async function inspectSearchParams(
const mockSetup = {
start: 1528113600000,
end: 1528977600000,
client: {
search: spy
} as any,
internalClient: {
search: spy
} as any,
config: new Proxy(
{},
{
get: () => 'myIndex'
}
) as APMConfig,
uiFiltersES: [
{
term: { 'service.environment': 'prod' }
}
],
client: { search: spy } as any,
internalClient: { search: spy } as any,
config: new Proxy({}, { get: () => 'myIndex' }) as APMConfig,
uiFiltersES: [{ term: { 'my.custom.ui.filter': 'foo-bar' } }],
indices: {
'apm_oss.sourcemapIndices': 'myIndex',
'apm_oss.errorIndices': 'myIndex',
Expand Down

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function getErrorGroup({

let transaction;
if (transactionId && traceId) {
transaction = await getTransaction(transactionId, traceId, setup);
transaction = await getTransaction({ transactionId, traceId, setup });
}

return {
Expand Down

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

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ import {
} from '../../helpers/setup_request';
import { ProcessorEvent } from '../../../../common/processor_event';

export async function getTransaction(
transactionId: string,
traceId: string,
setup: Setup & SetupTimeRange & SetupUIFilters
) {
const { start, end, uiFiltersES, client, indices } = setup;
export async function getTransaction({
transactionId,
traceId,
setup
}: {
transactionId: string;
traceId: string;
setup: Setup & SetupTimeRange & SetupUIFilters;
}) {
const { start, end, client, indices } = setup;

const params = {
index: indices['apm_oss.transactionIndices'],
Expand All @@ -35,8 +39,7 @@ export async function getTransaction(
{ term: { [PROCESSOR_EVENT]: ProcessorEvent.transaction } },
{ term: { [TRANSACTION_ID]: transactionId } },
{ term: { [TRACE_ID]: traceId } },
{ range: rangeFilter(start, end) },
...uiFiltersES
{ range: rangeFilter(start, end) }
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('transaction queries', () => {

it('fetches a transaction', async () => {
mock = await inspectSearchParams(setup =>
getTransaction('foo', 'bar', setup)
getTransaction({ transactionId: 'foo', traceId: 'bar', setup })
);

expect(mock.params).toMatchSnapshot();
Expand Down

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

0 comments on commit 0340fac

Please sign in to comment.