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

Update Container Metric Queries #1359

Open
wants to merge 4 commits into
base: mvp_demo
Choose a base branch
from

Conversation

shreyabiradar07
Copy link
Contributor

Description

This PR has the following changes:

  • Updates existing container metric queries similar to the cost operator koku-metrics
  • Add additional metric queries - imageOwners and imageWorkloads to fetch pod owner and workload details

Fixes # (issue)

Type of change

  • Bug fix
  • New feature
  • Docs update
  • Breaking change (What changes might users need to make in their application due to this PR?)
  • Requires DB changes

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.

  • New Test X
  • Functional testsuite

Test Configuration

  • Kubernetes clusters tested on: Tested manually on OpenShift (ResourceHub) cluster

Checklist 🎯

  • Followed coding guidelines
  • Comments added
  • Dependent changes merged
  • Documentation updated
  • Tests added or updated

Additional information

.

@@ -23,17 +23,17 @@ slo:

aggregation_functions:
- function: avg
query: 'avg by(container, namespace) (kube_pod_container_resource_requests{container!="", container!="POD", pod!="", resource="cpu", unit="core", namespace="$NAMESPACE$", container="$CONTAINER_NAME$"})'
query: 'avg by(container, pod, namespace) ((kube_pod_container_resource_requests{container!="", container!="POD", pod!="", resource="cpu", unit="core", namespace="$NAMESPACE$", container="$CONTAINER_NAME$"}) * on(pod, namespace) group_left max by (container, pod, namespace) (kube_pod_status_phase{phase="Running"}))'
Copy link
Contributor

Choose a reason for hiding this comment

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

Irrespective of pod_status_phase - we need to gather all the data. We can remove the grouping * on(pod, namespace) group_left max by (container, pod, namespace) (kube_pod_status_phase{phase="Running"}))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the queries to remove grouping based on the pod status.


# Show sum of cpu requests in bytes for a container in a deployment
- function: sum
query: 'sum by(container, namespace) (kube_pod_container_resource_requests{container!="", container!="POD", pod!="", resource="cpu", unit="core", namespace="$NAMESPACE$", container="$CONTAINER_NAME$"})'
query: 'sum by(container, pod, namespace) ((kube_pod_container_resource_requests{container!="", container!="POD", pod!="", resource="cpu", unit="core", namespace="$NAMESPACE$", container="$CONTAINER_NAME$"}) * on(pod, namespace) group_left max by (container, pod, namespace) (kube_pod_status_phase{phase="Running"}))'
Copy link
Contributor

Choose a reason for hiding this comment

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

removing the pod_status_phase grouping applies to all the queries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated the queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

3 participants