<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to filter built-in CPU usage metric by cluster &amp;amp; namespace (and get max per workload)? in Container platforms</title>
    <link>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285677#M3271</link>
    <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/90253"&gt;@Aboud1&lt;/a&gt;&amp;nbsp;There is a bit of difference between both the queries&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;builtin:containers.cpu.usageMilliCores:&lt;/EM&gt; This metric represents CPU usage at the &lt;STRONG&gt;container&lt;/STRONG&gt; level, measured in millicores. It provides detailed insights into individual container performance.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;builtin:kubernetes.workload.cpu_usage:&lt;/EM&gt; This metric aggregates CPU usage at the &lt;STRONG&gt;workload&lt;/STRONG&gt; level, which includes all containers within a specific Kubernetes workload (e.g., Deployment, StatefulSet). Ideally this might include more than one container/pod as per the workload specifications&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you mentioned about reporting on "&lt;STRONG&gt;max CPU usage per workload" &lt;/STRONG&gt;I've suggested using&amp;nbsp;&lt;EM&gt;builtin:kubernetes.workload.cpu_usage &lt;/EM&gt;as it aggregates CPU usage at the workload level and also allows us to split the data by dimensions we are after unlike&amp;nbsp;&lt;EM&gt;builtin:containers.cpu.usageMilliCores &lt;/EM&gt;which do not provide those dimensions&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, if you are on SaaS you can extract the container level CPU using the below DQL with the needed dimensions&lt;/P&gt;&lt;P&gt;Hope this helps&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries max(dt.kubernetes.container.cpu_usage), 
by: { k8s.container.name, k8s.pod.name }, 
filter: { matchesValue(entityAttr(dt.entity.kubernetes_cluster, "entity.name"), "cluster_xyz") AND matchesValue(entityAttr(dt.entity.cloud_application_namespace, "entity.name"), "namespace_abc") }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Sep 2025 09:46:18 GMT</pubDate>
    <dc:creator>p_devulapalli</dc:creator>
    <dc:date>2025-09-10T09:46:18Z</dc:date>
    <item>
      <title>How to filter built-in CPU usage metric by cluster and namespace and get max per workload?</title>
      <link>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285391#M3265</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;
&lt;P&gt;I’m using the built-in metric query in Dynatrace for CPU usage per workload, for example:&lt;/P&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;builtin:&lt;/SPAN&gt;containers.cpu.&lt;SPAN class=""&gt;usageMilliCores:&lt;/SPAN&gt;filter(&lt;SPAN class=""&gt;in&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"dt.entity.container_group_instance"&lt;/SPAN&gt;, entitySelector(&lt;SPAN class=""&gt;"type(CONTAINER_GROUP_INSTANCE), fromRelationships.IS_CGI_OF_CA(type(CLOUD_APPLICATION), entityId(CLOUD_APPLICATION-XXXXX))"&lt;/SPAN&gt;)))&lt;SPAN class=""&gt;:parents&lt;/SPAN&gt;&lt;SPAN class=""&gt;:parents&lt;/SPAN&gt;&lt;SPAN class=""&gt;:splitBy&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"dt.entity.cloud_application"&lt;/SPAN&gt;)&lt;SPAN class=""&gt;:sum&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":backhand_index_pointing_right:"&gt;👉&lt;/span&gt; This built-in [used by dynatrace by default] works perfectly when I analyze a single workload.&lt;/P&gt;
&lt;P&gt;What I want to achieve:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;Get the &lt;STRONG&gt;maximum CPU usage (peak value)&lt;/STRONG&gt; per workload&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;For &lt;STRONG&gt;all workloads&lt;/STRONG&gt; inside a specific &lt;STRONG&gt;cluster (OpenShift Main-Cluster)&lt;/STRONG&gt; and a specific &lt;STRONG&gt;namespace (dxl-vf-consumer)&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Without having to check each workload individually.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;My challenge:&lt;BR /&gt;I’m not sure how to &lt;STRONG&gt;add the cluster + namespace filters&lt;/STRONG&gt; into this built-in query.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt;&lt;BR /&gt;How can I adjust this built-in query to include cluster and namespace filters so that it returns the &lt;STRONG&gt;max CPU usage per workload&lt;/STRONG&gt; within that scope?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Dec 2025 11:37:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285391#M3265</guid>
      <dc:creator>Aboud1</dc:creator>
      <dc:date>2025-12-17T11:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter built-in CPU usage metric by cluster &amp; namespace (and get max per workload)?</title>
      <link>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285439#M3267</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/90253"&gt;@Aboud1&lt;/a&gt;&amp;nbsp;Can you please try the below and see if it helps ?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2025 00:26:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285439#M3267</guid>
      <dc:creator>p_devulapalli</dc:creator>
      <dc:date>2025-09-05T00:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter built-in CPU usage metric by cluster &amp; namespace (and get max per workload)?</title>
      <link>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285656#M3270</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/21657"&gt;@p_devulapalli&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried the query you suggested with builtin:kubernetes.workload.cpu_usage and it works fine in terms of filtering by cluster and namespace.&lt;/P&gt;&lt;P&gt;But what I noticed is that the values are quite different from the ones I get when using builtin:containers.cpu.usageMilliCores (the metric I shared in my original question).&lt;/P&gt;&lt;P&gt;Especially during spikes, the difference becomes very large.&lt;BR /&gt;For example:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;At &lt;STRONG&gt;2025-09-03 02:17&lt;/STRONG&gt;, using containers.cpu.usageMilliCores, the CPU usage for a workload was &lt;STRONG&gt;1.29 cores&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;At the exact same time, with kubernetes.workload.cpu_usage, it showed only &lt;STRONG&gt;496 millicores&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;When there’s no spike, the values are close, but during peaks the workload metric seems much lower.&lt;/P&gt;&lt;P&gt;So my question is:&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":backhand_index_pointing_right:"&gt;👉&lt;/span&gt; Why does this difference happen? Is the workload metric doing some kind of aggregation that smooths out spikes? If yes, does that mean it’s less accurate for identifying peak usage per workload?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 06:01:42 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285656#M3270</guid>
      <dc:creator>Aboud1</dc:creator>
      <dc:date>2025-09-10T06:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter built-in CPU usage metric by cluster &amp; namespace (and get max per workload)?</title>
      <link>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285677#M3271</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/90253"&gt;@Aboud1&lt;/a&gt;&amp;nbsp;There is a bit of difference between both the queries&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;builtin:containers.cpu.usageMilliCores:&lt;/EM&gt; This metric represents CPU usage at the &lt;STRONG&gt;container&lt;/STRONG&gt; level, measured in millicores. It provides detailed insights into individual container performance.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;builtin:kubernetes.workload.cpu_usage:&lt;/EM&gt; This metric aggregates CPU usage at the &lt;STRONG&gt;workload&lt;/STRONG&gt; level, which includes all containers within a specific Kubernetes workload (e.g., Deployment, StatefulSet). Ideally this might include more than one container/pod as per the workload specifications&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you mentioned about reporting on "&lt;STRONG&gt;max CPU usage per workload" &lt;/STRONG&gt;I've suggested using&amp;nbsp;&lt;EM&gt;builtin:kubernetes.workload.cpu_usage &lt;/EM&gt;as it aggregates CPU usage at the workload level and also allows us to split the data by dimensions we are after unlike&amp;nbsp;&lt;EM&gt;builtin:containers.cpu.usageMilliCores &lt;/EM&gt;which do not provide those dimensions&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, if you are on SaaS you can extract the container level CPU using the below DQL with the needed dimensions&lt;/P&gt;&lt;P&gt;Hope this helps&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries max(dt.kubernetes.container.cpu_usage), 
by: { k8s.container.name, k8s.pod.name }, 
filter: { matchesValue(entityAttr(dt.entity.kubernetes_cluster, "entity.name"), "cluster_xyz") AND matchesValue(entityAttr(dt.entity.cloud_application_namespace, "entity.name"), "namespace_abc") }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 09:46:18 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/285677#M3271</guid>
      <dc:creator>p_devulapalli</dc:creator>
      <dc:date>2025-09-10T09:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to filter built-in CPU usage metric by cluster &amp; namespace (and get max per workload)?</title>
      <link>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/286072#M3280</link>
      <description>&lt;P&gt;Thanks a lot &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/21657"&gt;@p_devulapalli&lt;/a&gt; for the detailed clarification &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now it’s much clearer why the values differ between:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;builtin:containers.cpu.usageMilliCores&lt;/STRONG&gt; → container-level, more accurate for spikes&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;builtin:kubernetes.workload.cpu_usage&lt;/STRONG&gt; → workload-level, aggregated across containers, so spikes appear lower&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;My main objective is still to get the &lt;STRONG&gt;peak CPU usage per workload&lt;/STRONG&gt; in a given &lt;STRONG&gt;cluster + namespace&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;As you mentioned, DQL would indeed solve this by combining container-level accuracy with the right filters. Unfortunately, I’m on &lt;STRONG&gt;Dynatrace Managed&lt;/STRONG&gt;, so I don’t have DQL available — and that’s where the limitation bites me.&lt;/P&gt;&lt;P&gt;So basically, I need to decide between:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Accuracy (container-level)&lt;/STRONG&gt; but no cluster/namespace filters, or&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Scope (workload-level with filters)&lt;/STRONG&gt; but with aggregated values.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;That explains the behavior I was seeing. Thanks again for the guidance &lt;span class="lia-unicode-emoji" title=":raising_hands:"&gt;🙌&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 05:12:53 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Container-platforms/How-to-filter-built-in-CPU-usage-metric-by-cluster-and-namespace/m-p/286072#M3280</guid>
      <dc:creator>Aboud1</dc:creator>
      <dc:date>2025-09-16T05:12:53Z</dc:date>
    </item>
  </channel>
</rss>

