add required layer option to conditionally run runtimes queries#1866
Open
khansaad wants to merge 1 commit intokruize:mvp_demofrom
Open
add required layer option to conditionally run runtimes queries#1866khansaad wants to merge 1 commit intokruize:mvp_demofrom
khansaad wants to merge 1 commit intokruize:mvp_demofrom
Conversation
Signed-off-by: Saad Khan <saakhan@ibm.com>
Contributor
Reviewer's GuideAdds a new optional required_layer attribute to aggregation functions and uses it in the recommendation engine to conditionally execute runtime metrics queries only when matching container layers are detected, updating JVM-related performance profiles to specify applicable runtimes. Sequence diagram for conditional metric query execution based on required_layersequenceDiagram
participant RecommendationEngine
participant KruizeObject
participant ContainerData
participant AggregationFunctions
RecommendationEngine->>KruizeObject: getContainerData(containerName)
KruizeObject-->>RecommendationEngine: ContainerData
RecommendationEngine->>ContainerData: getLayerMap()
ContainerData-->>RecommendationEngine: layerMap
loop for each metricEntry
RecommendationEngine->>metricEntry: getAggregationFunctionsMap()
metricEntry-->>RecommendationEngine: aggregationFunctions
loop for each aggregationFunctionsEntry
RecommendationEngine->>AggregationFunctions: getRequiredLayer()
AggregationFunctions-->>RecommendationEngine: requiredLayer
alt requiredLayer is null or empty
RecommendationEngine->>AggregationFunctions: getQuery()
AggregationFunctions-->>RecommendationEngine: promQL
RecommendationEngine->>RecommendationEngine: executePromQuery(promQL)
else requiredLayer is set
RecommendationEngine->>RecommendationEngine: split requiredLayer into requiredLayers
RecommendationEngine->>ContainerData: getLayerMap()
ContainerData-->>RecommendationEngine: layerMap
alt any requiredLayers in layerMap
RecommendationEngine->>AggregationFunctions: getQuery()
AggregationFunctions-->>RecommendationEngine: promQL
RecommendationEngine->>RecommendationEngine: executePromQuery(promQL)
else no requiredLayers detected
RecommendationEngine->>RecommendationEngine: skip metric (no query executed)
end
end
end
end
Class diagram for updated AggregationFunctions with required_layerclassDiagram
class AggregationFunctions {
- String function
- String query
- String version
- String requiredLayer
+ AggregationFunctions(String function, String query, String version)
+ String getFunction()
+ void setFunction(String function)
+ String getQuery()
+ void setQuery(String query)
+ String getVersion()
+ void setVersion(String version)
+ String getRequiredLayer()
+ void setRequiredLayer(String requiredLayer)
+ String toString()
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
fetchContainerMetricsBasedOnDataSourceAndProfile, you repeatedly callcontainerData.getLayerMap()and null-check it inside the inner loop; consider pulling the map into a local variable and short-circuiting when it's null to simplify the logic and avoid repeated lookups. - The
AggregationFunctionsclass now has arequiredLayerfield but no constructor path to set it explicitly; if this type is ever instantiated programmatically (not just via deserialization), you may want to add an overloaded constructor or builder method that acceptsrequiredLayerto avoid partially initialized instances.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `fetchContainerMetricsBasedOnDataSourceAndProfile`, you repeatedly call `containerData.getLayerMap()` and null-check it inside the inner loop; consider pulling the map into a local variable and short-circuiting when it's null to simplify the logic and avoid repeated lookups.
- The `AggregationFunctions` class now has a `requiredLayer` field but no constructor path to set it explicitly; if this type is ever instantiated programmatically (not just via deserialization), you may want to add an overloaded constructor or builder method that accepts `requiredLayer` to avoid partially initialized instances.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new
required_layerattribute in theaggregation_functionsalongside thequeryto conditionally run the runtime queries based on the corresponding layer detection.Fixes # (issue)
Type of change
How has this been tested?
Please describe the tests that were run to verify your changes and steps to reproduce. Please specify any test configuration required.
Test Configuration
Checklist 🎯
Additional information
Include any additional information such as links, test results, screenshots here
Summary by Sourcery
Add support for conditionally executing runtime aggregation queries based on detected container layers via a new required layer attribute on aggregation functions.
New Features:
Enhancements: