Skip to content

[APM] Don’t include UI filters when fetching a specific transaction#57934

Merged
sorenlouv merged 3 commits intoelastic:masterfrom
sorenlouv:omit-ui-filters-whe-fetching-transaction
Feb 19, 2020
Merged

[APM] Don’t include UI filters when fetching a specific transaction#57934
sorenlouv merged 3 commits intoelastic:masterfrom
sorenlouv:omit-ui-filters-whe-fetching-transaction

Conversation

@sorenlouv
Copy link
Member

@sorenlouv sorenlouv commented Feb 18, 2020

Closes #57855

On the error groups page an error sample and the related transaction is shown. This transaction is currently fetched by id, and filtered by ui filters as usual. However, the ui filters may cause the transaction to not be found, since they are written with the error document in mind, and thus will contain error specific parameters which will never match the transaction. Therefore I suggest to remove the ui filters from the query for fetching the transaction.

As a general rule of thumb I think the ui filters (query bar + local filters) should only affect the primary document type on a page. Thus when the primary document type on a page is X, any secondary data types on the same page should not be filtered by ui filters.

For more details this issue.

Before
image

After
image

When fetching an error sample, the related transaction is also fetched. This transaction should not be filtered by ui filters
transactionId: string;
traceId: string;
setup: Setup & SetupTimeRange & SetupUIFilters;
}) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I converted the function signature to use a destructured object. Therefore the noise.

{ term: { [TRACE_ID]: traceId } },
{ range: rangeFilter(start, end) },
...uiFiltersES
{ range: rangeFilter(start, end) }
Copy link
Member Author

Choose a reason for hiding this comment

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

Reviewer, look here: this is the meat of the PR. ...uiFiltersES was removed.

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' } }],
Copy link
Member Author

Choose a reason for hiding this comment

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

Collapsed these for readability and changed term: { 'service.environment': 'prod' } to term: { 'my.custom.ui.filter': 'foo-bar' to make it clear in the snapshots that it's the ui filter value.

Copy link
Contributor

@ogupte ogupte left a comment

Choose a reason for hiding this comment

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

looks good!

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

Choose a reason for hiding this comment

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

Using destructuring for consistency with other functions.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

sorenlouv added a commit that referenced this pull request Feb 19, 2020
…57934) (#58029)

* [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
@sorenlouv sorenlouv deleted the omit-ui-filters-whe-fetching-transaction branch February 19, 2020 18:34
mbondyra added a commit to mbondyra/kibana that referenced this pull request Feb 20, 2020
* master: (136 commits)
  [Visualize] Remove legacy appState in visualize (elastic#57330)
  Use static time for tsvb rollup test (elastic#57701)
  [SIEM] Fix ResizeObserver polyfill (elastic#58046)
  [SIEM][Detection Engine] Fixes return codes where some were rule_id instead of id
  skip flaky suite (elastic#56816)
  skip flaky suite (elastic#58059)
  skip flaky suite (elastic#45348)
  migrates notification server routes to NP (elastic#57906)
  Moved all of the show/hide toggles outside of ordered lists. (elastic#57163)
  [APM] NP Migration - Moves plugin server files out of legacy (elastic#57532)
  [Maps][Telemetry] Migrate Maps telemetry to NP (elastic#55055)
  Embeddable add panel examples (elastic#57319)
  Fix useRequest to support query change (elastic#57723)
  Allow custom paths in plugin generator (elastic#57766)
  [SIEM][Case] Merge header components (elastic#57816)
  [ML] New Platform server shim: update job audit messages routes (elastic#57925)
  [kbn/optimizer] emit success event from reducer when all bundles cached (elastic#57945)
  [APM] Don’t include UI filters when fetching a specific transaction (elastic#57934)
  Upgrade yargs (elastic#57720)
  skip flaky suite (elastic#57762) (elastic#57997) (elastic#57998)
  ...

# Conflicts:
#	src/plugins/advanced_settings/public/management_app/components/field/__snapshots__/field.test.tsx.snap
#	src/plugins/advanced_settings/public/management_app/components/field/field.tsx
#	x-pack/plugins/translations/translations/ja-JP.json
#	x-pack/plugins/translations/translations/zh-CN.json
@cauemarcondes cauemarcondes self-assigned this Apr 9, 2020
@cauemarcondes
Copy link
Contributor

Tests ok:
✅Chrome
✅Safari
✅Firefox

@cauemarcondes cauemarcondes added the apm:test-plan-done Pull request that was successfully tested during the test plan label Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apm:test-plan-done Pull request that was successfully tested during the test plan release_note:fix v7.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transaction sample not linked if filtering APM errors with search

4 participants