04 Sep 2025
01:47 PM
- last edited on
08 Sep 2025
07:14 AM
by
MaciejNeumann
Hi Community,
I’m using the built-in metric query in Dynatrace for CPU usage per workload, for example:
👉 This built-in [used by dynatrace by default] works perfectly when I analyze a single workload.
What I want to achieve:
Get the maximum CPU usage (peak value) per workload
For all workloads inside a specific cluster (OpenShift Main-Cluster) and a specific namespace (dxl-vf-consumer)
Without having to check each workload individually.
My challenge:
I’m not sure how to add the cluster + namespace filters into this built-in query.
Question:
How can I adjust this built-in query to include cluster and namespace filters so that it returns the max CPU usage per workload within that scope?
05 Sep 2025 01:26 AM
@Aboud1 Can you please try the below and see if it helps ?
builtin:kubernetes.workload.cpu_usage:filter(and(or(in("dt.entity.cloud_application_namespace",entitySelector("type(cloud_application_namespace),entityName.equals(~"namespace_abc~")"))),or(in("dt.entity.kubernetes_cluster",entitySelector("type(kubernetes_cluster),entityName.equals(~"cluster_xyz~")"))))):splitBy("k8s.workload.name"):max:sort(value(max,descending))