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

[Infra UI] Convert terms aggregation to composite for field selection filtering #47500

Merged
merged 9 commits into from
Oct 18, 2019

Conversation

simianhacker
Copy link
Member

Summary

This PR fixes #47048 by converting the terms aggregation to a composite aggregation to improve performance on slower clusters. This also fixes a bug with the snapshot aggregation where the additional queries for pagination didn't include the after key.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

@simianhacker simianhacker added release_note:fix Feature:Metrics UI Metrics UI feature v8.0.0 Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v7.5.0 v7.4.1 labels Oct 7, 2019
@simianhacker simianhacker requested a review from a team October 7, 2019 19:08
@simianhacker simianhacker self-assigned this Oct 7, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-logs-ui (Team:infra-logs-ui)

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@simianhacker simianhacker marked this pull request as ready for review October 9, 2019 20:10
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@weltenwort
Copy link
Member

@elasticmachine update branch

@Kerry350 Kerry350 self-requested a review October 16, 2019 09:56
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@Kerry350 Kerry350 left a comment

Choose a reason for hiding this comment

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

This does work and fixes the original issue, so I've approved this in the hope it makes the FF cutoff.

However, the response times are still very long for me testing against the shared Observability cluster. I was seeing this sort of average:

Screenshot 2019-10-16 13 56 33

17 seconds is a long time in general, but given this affects the entirety of Infra or Logs loading it feels a lot worse 😬

Otherwise just some small comments.

@@ -63,6 +69,24 @@ export class InfraSnapshot {
}
}

// This is used by the getAllCompositeData to select the bucket to return.
Copy link
Contributor

Choose a reason for hiding this comment

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

I love comments, but I'm not sure we need these given the parameters for getAllCompositeData() are fully typed and explain themselves?

) => (response.aggregations && response.aggregations.nodes.buckets) || [];

// This is used by getAllCompositeData to add the after key to the subsequent requests
const handleAfterKey = (
Copy link
Contributor

Choose a reason for hiding this comment

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

As the two uses of handleAfterKey in this PR are very, very similar - with only the actual keys and portions of the response to be used changing - is it worth making this into a helper function too? I imagine the

  if (!response.aggregations) {
    return options;
  }

check and the merging of the options will always be the same.

InfraDatabaseSearchResponse,
} from '../lib/adapters/framework';

export const getAllCompositeData = async <
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍

@simianhacker
Copy link
Member Author

@Kerry350 We could add:

{
  range: {
     '@timestamp': {
       gte: 'now-24h',
       lte: 'now',
   }
}

Which would limit the data to the last 24 hours (according to the server).

@simianhacker
Copy link
Member Author

Here is what the query looks like on my machine without filtering for the last 24 hours:

image

Here is what it looks like with filtering for the last 24 hours

image

And here is what it looks like for the last 4 hours

image

I was hoping for a more dramatic change by limiting to the last 24 hours but I think this server is just severely under powered. I'm not comfortable with a time frame shorter then 24 hours because some metric sets only report in 24 hour intervals.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@Kerry350
Copy link
Contributor

@simianhacker

I'm not comfortable with a time frame shorter then 24 hours because some metric sets only report in 24 hour intervals.

Yep, makes sense.

Thanks for the changes, they LGTM 👍

@simianhacker simianhacker merged commit 2955ed6 into elastic:master Oct 18, 2019
simianhacker added a commit to simianhacker/kibana that referenced this pull request Oct 18, 2019
… filtering (elastic#47500)

* Convert from large terms agg to multiple smaller composite

* Fixing bug in snapshot

* Reducing duplicate code for composite agg requests

* Adding filter for last 24 hours

* Creating a helper for the afterKey handlers
simianhacker added a commit to simianhacker/kibana that referenced this pull request Oct 18, 2019
… filtering (elastic#47500)

* Convert from large terms agg to multiple smaller composite

* Fixing bug in snapshot

* Reducing duplicate code for composite agg requests

* Adding filter for last 24 hours

* Creating a helper for the afterKey handlers
simianhacker added a commit that referenced this pull request Oct 18, 2019
… filtering (#47500) (#48675)

* Convert from large terms agg to multiple smaller composite

* Fixing bug in snapshot

* Reducing duplicate code for composite agg requests

* Adding filter for last 24 hours

* Creating a helper for the afterKey handlers
simianhacker added a commit that referenced this pull request Oct 18, 2019
… filtering (#47500) (#48664)

* Convert from large terms agg to multiple smaller composite

* Fixing bug in snapshot

* Reducing duplicate code for composite agg requests

* Adding filter for last 24 hours

* Creating a helper for the afterKey handlers
@simianhacker simianhacker deleted the fixes-47048 branch April 17, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Metrics UI Metrics UI feature release_note:fix Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v7.4.1 v7.5.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Infra UI] Terms aggregation query for modules and datasets times out
4 participants