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

feat: minimal topology details for rest of the children #288

Merged
merged 4 commits into from
Oct 5, 2023

Conversation

adityathebe
Copy link
Member

Resolves: #285

@github-actions
Copy link

github-actions bot commented Sep 25, 2023

E2E -

0 tests   0 ✔️  0s ⏱️
0 suites  0 💤
0 files    0

Results for commit 1994920.

♻️ This comment has been updated with latest results.

@moshloop
Copy link
Member

@adityathebe can we add some tests for this ?

@adityathebe adityathebe force-pushed the fix/topology-query branch 3 times, most recently from d6ec92a to 921d0f9 Compare October 3, 2023 15:41
* fetch other columns that are essential to create the tree
topology.go Outdated
Comment on lines 45 to 47
// parents, incidents, analysis, checks columns need to fetched to create the topology tree even though they may not be essential to the UI.
return "name, namespace, id, is_leaf, status, status_reason, summary, topology_type, labels, team_names, agent_id, parent_id, type, parents, incidents, analysis, checks"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@moshloop had to add back these columns as they're essential during tree creation.

  • parents
  • incidents
  • analysis
  • checks

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure how much better this will perform - I also think we should use more sql functions / views and have this in a single db query rather than multiple trips to the db.

Generally I think there are phases:

  1. Find all top level components (no parents, or direct descendants) and apply label, type, team, agent filters at this level only.
  2. For each component summarize health, incidents, analysis of its descendants
// find all the descendants of a component, including those via relationships
find_descendants(id): returns id array
descendants =  find_descendants(id)
select components.* from components where filters
with each top level component
select name, id, parent, type, icon, component_summary.* from components where id in @descandents 
inner join component_summary

where component_summary is a view, that maybe becomes a materialized view in the future (which is refreshed on a debonce(check.transitioned, analysis.updated, incident.transitioned) etc..

  1. Union and then post process for top-level summary in go
  • strip off parent(s), agent_id in final topology returned

wdyt @yashmehrotra ?

Copy link
Member

Choose a reason for hiding this comment

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

Agree with point 1 of applying filters just at top level

for point 2, are we selecting all the descendants or just summarizing them ? cause summary right now happens in go not sql, so we might want to change that

@adityathebe adityathebe requested a review from moshloop October 3, 2023 16:19
topology.go Outdated Show resolved Hide resolved
topology.go Outdated Show resolved Hide resolved
@moshloop moshloop merged commit dce61bd into main Oct 5, 2023
6 checks passed
@moshloop moshloop deleted the fix/topology-query branch October 5, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Topology query - don't return details children
3 participants