-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2202ea
commit 22f016a
Showing
14 changed files
with
59 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
3 changes: 2 additions & 1 deletion
3
robusta_krr/core/integrations/prometheus/metrics/base_filtered_metric.py
This file contains 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
This file contains 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
8 changes: 4 additions & 4 deletions
8
robusta_krr/core/integrations/prometheus/metrics/cpu_metric.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
from robusta_krr.core.models.allocations import ResourceType | ||
from robusta_krr.core.models.objects import K8sObjectData | ||
|
||
from .base_metric import bind_metric | ||
from .base_filtered_metric import BaseFilteredMetricLoader | ||
from robusta_krr.core.models.objects import K8sObjectData | ||
from .base_metric import bind_metric | ||
|
||
|
||
@bind_metric(ResourceType.CPU) | ||
class CPUMetricLoader(BaseFilteredMetricLoader): | ||
def get_query(self, object: K8sObjectData) -> str: | ||
pods_selector = "|".join(pod.name for pod in object.pods) | ||
return ( | ||
'sum(irate(container_cpu_usage_seconds_total{' | ||
"sum(irate(container_cpu_usage_seconds_total{" | ||
f'namespace="{object.namespace}", ' | ||
f'pod=~"{pods_selector}", ' | ||
f'container="{object.container}"' | ||
'}[5m])) by (container, pod, job)' | ||
"}[5m])) by (container, pod, job)" | ||
) |
8 changes: 4 additions & 4 deletions
8
robusta_krr/core/integrations/prometheus/metrics/memory_metric.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
from robusta_krr.core.models.allocations import ResourceType | ||
from robusta_krr.core.models.objects import K8sObjectData | ||
|
||
from .base_metric import bind_metric | ||
from .base_filtered_metric import BaseFilteredMetricLoader | ||
from robusta_krr.core.models.objects import K8sObjectData | ||
from .base_metric import bind_metric | ||
|
||
|
||
@bind_metric(ResourceType.Memory) | ||
class MemoryMetricLoader(BaseFilteredMetricLoader): | ||
def get_query(self, object: K8sObjectData) -> str: | ||
pods_selector = "|".join(pod.name for pod in object.pods) | ||
return ( | ||
'sum(container_memory_working_set_bytes{' | ||
"sum(container_memory_working_set_bytes{" | ||
f'namespace="{object.namespace}", ' | ||
f'pod=~"{pods_selector}", ' | ||
f'container="{object.container}"' | ||
'}) by (container, pod, job)' | ||
"}) by (container, pod, job)" | ||
) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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