-
Notifications
You must be signed in to change notification settings - Fork 258
Split out summary generator code with minor improvements #8258
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
base: main
Are you sure you want to change the base?
Conversation
Dependency Review✅ No vulnerabilities or OpenSSF Scorecard issues found.Scanned FilesNone |
|
There are luminork endpoint changes on this branch that do not appear to have associated tests. Please ensure you add or update tests under |
62f8b5b to
b837bca
Compare
7831320 to
579446b
Compare
579446b to
befedc0
Compare
| // TODO(nick): enable this and add docs. | ||
| // missing_docs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not important for this PR
| #[instrument(level = "info", skip(ctx))] | ||
| #[instrument( | ||
| name = "diagram.assemble", | ||
| level = "info", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chopped down all spans in this file into one: used fields instead and renamed to be more clear
| let (component_details, next_cursor) = list_components_inner( | ||
| ctx, | ||
| limit, | ||
| cursor, | ||
| include_codegen, | ||
| maybe_summary_generator_config, | ||
| ) | ||
| .await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "inner" function contains all the logic without having to content with route-relevant semantics like extractors and return types
| // Get all component IDs. This ensures that we do not access CAS. Then, sort for consistent | ||
| // pagination. | ||
| let mut all_component_ids = Component::list_ids(ctx).await?; | ||
| all_component_ids.sort(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sort is functionally the same
| schema_name, | ||
| codegen: None, | ||
| for paginated_component_id in paginated_component_ids.iter().copied() { | ||
| component_details_vec.push(ComponentDetailsV1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer a mutable type
| // Build graph summary for the components. Drop the HEAD context from scope as soon as we | ||
| // no longer need it. | ||
| let graph_summaries = { | ||
| let head_ctx = ctx.clone_with_head().await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One head context for the entire lifespan of the route
| #[derive(Debug)] | ||
| struct SummaryGeneratorConfig { | ||
| include_action_functions: bool, | ||
| include_diff_status: bool, | ||
| include_execution_history: bool, | ||
| include_management_functions: bool, | ||
| include_manages: bool, | ||
| include_qualification_functions: bool, | ||
| include_resource_info: bool, | ||
| include_subscriptions: bool, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug dump the config as needed. Maybe we should record this in a span, but I wanted to keep tracing span count impact minimal (this PR reduces the total number of spans).
befedc0 to
f768a3b
Compare
f768a3b to
8064f1e
Compare
This change splits out the summary generator code and provides minor improvements. The improvements include the following: - Not fetching all components by only listing their IDs - Adding instrumentation and span recordings of durations of long-running tasks to both quantify how long the code is truly taking as well as decrese and clean up the total number of spans - Caching "head_ctx" for fewer queries and more consistent HEAD state - Decrease the number of diagram assembly spans, but record the duration of inner parts There is now an integration test for the graph lab code too. Signed-off-by: Nick Gerace <nick@systeminit.com>
8064f1e to
83ed38d
Compare
Description
This change splits out the summary generator code and provides minor improvements. The improvements include the following:
There is now an integration test for the component summary generator too.
Testing and Docs
includeAllfieldFuture Potential Work
Screenshots
Swagger UI query used with
includeAlland 85 components:Overview of traces in Jaeger corresponding to these calls:
The two new spans with their fields populated to help determine performance bottlenecks (note: the spans now have different names):