Skip to content

Commit

Permalink
use container_memory_working_set_bytesmetric for calculating max memo…
Browse files Browse the repository at this point in the history
…ry utilization
  • Loading branch information
nilsgstrabo committed Jan 21, 2025
1 parent e6f8d8c commit 9670720
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/metrics/prometheus/prometheus_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *Client) GetMemoryRequests(ctx context.Context, namespace string) ([]met

// GetMemoryMaximum returns a list of all pods with their maximum Memory usage. The Namespace can be regex. It will return the labels label_radix_component, namespace, pod and container.
func (c *Client) GetMemoryMaximum(ctx context.Context, namespace, duration string) ([]metrics.LabeledResults, error) {
return c.queryVector(ctx, fmt.Sprintf(`max by(namespace, container, pod) (max_over_time(container_memory_usage_bytes{container!="", namespace=~%q} [%s:])) * on(pod) group_left(label_radix_component) kube_pod_labels{label_radix_component!=""}`, namespace, duration))
return c.queryVector(ctx, fmt.Sprintf(`max by(namespace, container, pod) (max_over_time(container_memory_working_set_bytes{container!="", namespace=~%q} [%s:])) * on(pod) group_left(label_radix_component) kube_pod_labels{label_radix_component!=""}`, namespace, duration))
}

func (c *Client) queryVector(ctx context.Context, query string) ([]metrics.LabeledResults, error) {
Expand Down

0 comments on commit 9670720

Please sign in to comment.