-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add InstanceUtilization type and resolver for application instances u… #114
Conversation
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.
Pull Request Overview
This PR adds support for querying instance utilization for application instances by introducing a new InstanceUtilization type and resolver.
- Added ApplicationInstanceResolver interface and its implementation in the auto‐generated GraphQL resolver file.
- Extended GraphQL schema definitions for ApplicationInstance and InstanceUtilization types.
- Added or updated query functions and resolvers to calculate CPU/memory usage for instances.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
internal/graph/gengql/generated.go | Added ApplicationInstanceResolver interface, new complexity functions, and field contexts. |
internal/utilization/model.go | Introduced the InstanceUtilization model with a Current field. |
internal/graph/utilization.resolvers.go | Added the InstanceUtilization resolver for application instances. |
internal/graph/applications.resolvers.go | Registered the new ApplicationInstance resolver. |
internal/utilization/queries.go | Updated query functions and constants to support instance CPU/memory utilization. |
Comments suppressed due to low confidence (2)
internal/utilization/queries.go:49
- [nitpick] Verify that the order of arguments (teamSlug, workloadName, instanceName) correctly matches the expected placeholders (namespace, container, pod) in the usage query string for clarity.
current, err := c.query(ctx, env, fmt.Sprintf(usageQ, teamSlug, workloadName, instanceName))
internal/graph/gengql/generated.go:2400
- [nitpick] Consider adding tests for the new ApplicationInstance.InstanceUtilization resolver to ensure correct behavior and error handling across various scenarios.
}
return e.complexity.ApplicationInstance.InstanceUtilization(childComplexity, args["resourceType"].(utilization.UtilizationResourceType)), true | ||
|
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.
Consider adding a type check or error handling before the type assertion on args["resourceType"] to prevent a potential panic if the argument value is not of the expected type.
return e.complexity.ApplicationInstance.InstanceUtilization(childComplexity, args["resourceType"].(utilization.UtilizationResourceType)), true | |
resourceType, ok := args["resourceType"].(utilization.UtilizationResourceType) | |
if !ok { | |
return 0, false | |
} | |
return e.complexity.ApplicationInstance.InstanceUtilization(childComplexity, resourceType), true |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
…ity and consistency in utilization queries and resolvers
…tilization