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

[Discover] Less requests for total hits #172880

Closed
wants to merge 2 commits into from

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Dec 7, 2023

Summary

Summarize your PR. If it involves visual changes include a screenshot or gif.

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@jughosta jughosta added Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) labels Dec 7, 2023
@jughosta jughosta self-assigned this Dec 7, 2023
@davismcphee
Copy link
Contributor

@jughosta Thanks for looking into this! One way to check if this is solving the issue would be to update the _request_count tests to expect the correct number of requests for saved searches:

describe('ES|QL mode', () => {
const type = 'esql';
beforeEach(async () => {
await PageObjects.discover.selectTextBaseLang();
monacoEditor.setCodeEditorValue(
'from logstash-* | where bytes > 1000 | stats countB = count(bytes)'
);
await queryBar.clickQuerySubmitButton();
await waitForLoadingToFinish();
});
getSharedTests({
type,
savedSearch: 'esql test',
query1: 'from logstash-* | where bytes > 1000 | stats countB = count(bytes) ',
query2: 'from logstash-* | where bytes < 2000 | stats countB = count(bytes) ',
savedSearchesRequests: 4,
setQuery: (query) => monacoEditor.setCodeEditorValue(query),
});
});

It would also be good to add test cases for any scenario from #165192 that we don't already cover in the current tests before resolving the issue.

@jughosta
Copy link
Contributor Author

jughosta commented Dec 8, 2023

/ci

@kibana-ci
Copy link
Collaborator

kibana-ci commented Dec 8, 2023

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #85 / discover/group3 discover request counts ES|QL mode should send 2 requests for saved search changes
  • [job] [logs] FTR Configs #85 / discover/group3 discover request counts ES|QL mode should send 2 requests for saved search changes
  • [job] [logs] FTR Configs #9 / discover/group4 indexpattern without timefield should allow switching from a saved search with a time field to a saved search without a time field
  • [job] [logs] FTR Configs #9 / discover/group4 indexpattern without timefield should allow switching from a saved search with a time field to a saved search without a time field
  • [job] [logs] FTR Configs #63 / lens app - group 1 lens ad hoc data view tests should navigate to discover correctly
  • [job] [logs] FTR Configs #63 / lens app - group 1 lens ad hoc data view tests should navigate to discover correctly
  • [job] [logs] FTR Configs #52 / management Index patterns on aliases should be able to discover and verify no of hits for alias1
  • [job] [logs] FTR Configs #52 / management Index patterns on aliases should be able to discover and verify no of hits for alias1
  • [job] [logs] FTR Configs #17 / security app dls user East should only see EAST doc
  • [job] [logs] FTR Configs #17 / security app dls user East should only see EAST doc
  • [job] [logs] FTR Configs #10 / transform - creation - index pattern creation_index_pattern batch transform with terms group and percentiles agg navigates to discover and displays results of the destination index
  • [job] [logs] FTR Configs #10 / transform - creation - index pattern creation_index_pattern batch transform with terms group and percentiles agg navigates to discover and displays results of the destination index
  • [job] [logs] FTR Configs #13 / transform basic license transform - creation - index pattern creation_index_pattern batch transform with terms group and percentiles agg navigates to discover and displays results of the destination index
  • [job] [logs] FTR Configs #13 / transform basic license transform - creation - index pattern creation_index_pattern batch transform with terms group and percentiles agg navigates to discover and displays results of the destination index
  • [job] [logs] Jest Tests #10 / useTotalHits should call onTotalHitsChange with an error status if fetch fails
  • [job] [logs] Jest Tests #10 / useTotalHits should call searchSource.setOverwriteDataViewType if dataView is a rollup
  • [job] [logs] Jest Tests #10 / useTotalHits should fetch a second time if refetch$ is triggered
  • [job] [logs] Jest Tests #10 / useTotalHits should fetch total hits if isPlainRecord is true
  • [job] [logs] Jest Tests #10 / useTotalHits should fetch total hits on first execution
  • [job] [logs] Jest Tests #10 / useTotalHits should not fetch a second time if refetch$ is not triggered

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
unifiedHistogram 51.1KB 51.0KB -17.0B

History

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

cc @jughosta

@jughosta
Copy link
Contributor Author

Closing in favor of #171638

@jughosta jughosta closed this Dec 20, 2023
@jughosta jughosta deleted the 165192-chart-less-requests branch December 20, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants