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

[wip] Fixes a weekly-report query that sometimes fails #2490

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions users/weeklyreports/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ const (

// Queries for getting resource consumption data from Prometheus
const (
//
// FIXME: including job here in these two queries is a bit of hack to
// make this work more consistently. Details:
// https://github.com/weaveworks/service/issues/2472. job appears to
// always be 'cadvisor' so I believe its a noop
//
// For the derivation of this query, see https://frontend.dev.weave.works/proud-wind-05/monitor/notebook/5ea020df-6220-405f-9f01-af0234a6744a
promTopMemoryWorkloadsQuery = `sum by (namespace, pod_name) (sum_over_time(container_memory_usage_bytes{image!=""}[1w])) / ignoring(namespace, pod_name) group_left sum(sum_over_time(node_memory_MemTotal[1w]))`
promTopMemoryWorkloadsQuery = `sum by (namespace, pod_name, job) (sum_over_time(container_memory_usage_bytes{image!=""}[1w])) / ignoring(namespace, pod_name, job) group_left sum(sum_over_time(node_memory_MemTotal[1w]))`
// CPU query seems to be more stable over longer time periods, so it's probably safe to assume it doesn't need the same kind of tweaking
promTopCPUWorkloadsQuery = `sum by (namespace, pod_name) (rate(container_cpu_usage_seconds_total{image!=''}[1w])) / ignoring(namespace, pod_name) group_left count(node_cpu{mode='idle'})`
promTopCPUWorkloadsQuery = `sum by (namespace, pod_name, job) (rate(container_cpu_usage_seconds_total{image!=''}[1w])) / ignoring(namespace, pod_name, job) group_left count(node_cpu{mode='idle'})`
// Normalizes the service name labels to work on systems with different setups (adapted from https://github.com/weaveworks/service-ui/blob/19fcaed0ee4a1adc76cb6c9fb721a0b5559e961f/client/src/pages/prom/dashboards/workload-resources/layout.jsx#L11)
podsByWorkloadsQuery = `
max by (namespace, service, pod_name) (
Expand Down