cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to filter built-in CPU usage metric by cluster & namespace (and get max per workload)?

Aboud1
Participant

Hi Community,

I’m using the built-in metric query in Dynatrace for CPU usage per workload, for example:

builtin:containers.cpu.usageMilliCores:filter(in("dt.entity.container_group_instance", entitySelector("type(CONTAINER_GROUP_INSTANCE), fromRelationships.IS_CGI_OF_CA(type(CLOUD_APPLICATION), entityId(CLOUD_APPLICATION-XXXXX))"))):parents:parents:splitBy("dt.entity.cloud_application"):sum
 

👉 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?

1 REPLY 1

p_devulapalli
Leader

@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))

 

Phani Devulapalli

Featured Posts