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
[APM] Improve performance of GET /internal/apm/has_data #154997
Comments
Pinging @elastic/apm-ui (Team:APM) |
So the coordinating node will wait for all shards to return before returning the result? It feels like it should just wait for the first shard that returns a non-zero result and then ignore/cancel the requests to the remaining shards. Wouldn't that be faster? |
@sqren yes, that's my understanding. perhaps it'll short circuit after the first batch, but not sure. I'll ask some of the search folks. |
@gbamparop can we add this as a candidate for 8.10? |
Got the answer :) |
I hope this solves this SDH - https://github.com/elastic/sdh-kibana/issues/4256#issuecomment-1853747899 |
Closes elastic#154997 Remove console.log Fix Use data_tier instead of timestamp Improve naming Undo change
Closes elastic#154997 Remove console.log Fix Use data_tier instead of timestamp Improve naming Undo change
Closes elastic#154997 Remove console.log Fix Use data_tier instead of timestamp Improve naming Undo change
Closes elastic#154997 This PR adds a data tier filter to the `/has_data` api, thus limitting the number of shards being hit by the request. (cherry picked from commit e7593c0)
# Backport This will backport the following commits from `main` to `8.12`: - [[APM] Add filter to `/has_data` api (#173382)](#173382) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Søren Louv-Jansen","email":"soren.louv@elastic.co"},"sourceCommit":{"committedDate":"2023-12-18T18:18:03Z","message":"[APM] Add filter to `/has_data` api (#173382)\n\nCloses #154997 PR adds a data tier filter to the `/has_data` api, thus limitting\r\nthe number of shards being hit by the request.","sha":"e7593c0e46f1ce707c1b951f8d013e722ac79353","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v8.12.0","v8.10.5","Team:obs-ux-infra_services","v8.13.0","v8.11.4"],"number":173382,"url":"#173382 Add filter to `/has_data` api (#173382)\n\nCloses #154997 PR adds a data tier filter to the `/has_data` api, thus limitting\r\nthe number of shards being hit by the request.","sha":"e7593c0e46f1ce707c1b951f8d013e722ac79353"}},"sourceBranch":"main","suggestedTargetBranches":["8.12","8.10","8.11"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.10","label":"v8.10.5","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"#173382 Add filter to `/has_data` api (#173382)\n\nCloses #154997 PR adds a data tier filter to the `/has_data` api, thus limitting\r\nthe number of shards being hit by the request.","sha":"e7593c0e46f1ce707c1b951f8d013e722ac79353"}},{"branch":"8.11","label":"v8.11.4","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>
The
GET /internal/apm/has_data
returns whether there is any APM data at all. The search we execute here ishas_historical_agent_data
, which is an unbound search for any APM event in any APM index. We set terminate_after to 1, but this search will still hit all shards (terminate_after is a per-shard limit). Here's an example of this search taking significantly longer than another search that is time range bound:We should investigate whether there are alternatives that do not hit all shards. Maybe another API, or perhaps first execute a time range bound search, and only if that returns no hits, execute a broader search.
The text was updated successfully, but these errors were encountered: