<?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 Query Kuberentes workloads in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257466#M1263</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;Hi,&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;Could you please help me better understand how to query entities and the relationships between them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fetch dt.entity.service&lt;BR /&gt;| filter in(id, classicEntitySelector("type(service),fromRelationship.isServiceOf(type(CLOUD_APPLICATION),entityId(\"CLOUD_APPLICATION-D40C6BABEC087314\"))"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;This returns all services related to a specific cloud application. In my case, it includes:&lt;/P&gt;
&lt;P class=""&gt;-Requests executed in background threads of SpringBoot for &lt;SPAN class=""&gt;dine-in-api-*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=""&gt;-Web-server for &lt;SPAN class=""&gt;dine-in-api-*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;What I want to achieve is to get the Kubernetes workload names, which are visible in the “services” application (either in the filter bar or at the top of the service page). I plan to use these names as variables in a dashboard to display metrics like response time or failure rate, split by each service.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Mar 2025 12:52:24 GMT</pubDate>
    <dc:creator>DamianJankowski</dc:creator>
    <dc:date>2025-03-28T12:52:24Z</dc:date>
    <item>
      <title>Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257466#M1263</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;Hi,&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;Could you please help me better understand how to query entities and the relationships between them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fetch dt.entity.service&lt;BR /&gt;| filter in(id, classicEntitySelector("type(service),fromRelationship.isServiceOf(type(CLOUD_APPLICATION),entityId(\"CLOUD_APPLICATION-D40C6BABEC087314\"))"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;This returns all services related to a specific cloud application. In my case, it includes:&lt;/P&gt;
&lt;P class=""&gt;-Requests executed in background threads of SpringBoot for &lt;SPAN class=""&gt;dine-in-api-*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=""&gt;-Web-server for &lt;SPAN class=""&gt;dine-in-api-*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=""&gt;What I want to achieve is to get the Kubernetes workload names, which are visible in the “services” application (either in the filter bar or at the top of the service page). I plan to use these names as variables in a dashboard to display metrics like response time or failure rate, split by each service.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 12:52:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257466#M1263</guid>
      <dc:creator>DamianJankowski</dc:creator>
      <dc:date>2025-03-28T12:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257490#M1264</link>
      <description>&lt;P&gt;You query is correct. We just need to make it "dynamic" and use filtering criteria "by name" instead of "by id".&lt;BR /&gt;In combination with getting metric you mention it will look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries response_time=avg(dt.service.request.response_time), by: {dt.entity.service},
filter: in( dt.entity.service, 
  classicEntitySelector(concat("type(service),fromRelationship.isServiceOf(type(CLOUD_APPLICATION),entityName(",$Entity,"))")))
| fieldsAdd dt.entity.service.name = entityName(dt.entity.service)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As dimensions for this metric contains id of the service, you can add service name using &lt;EM&gt;&lt;STRONG&gt;entityName&lt;/STRONG&gt; &lt;/EM&gt;function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2024 19:54:48 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257490#M1264</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-09-29T19:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257538#M1269</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/25373"&gt;@krzysztof_hoja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot.&lt;/P&gt;&lt;P&gt;I would say it is only a part of the desired solution, so first I would like to get the pure Kubernetes workload name:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image 2024-09-30 at 11.42.25.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23031iBF389D8CACB7829D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image 2024-09-30 at 11.42.25.png" alt="Image 2024-09-30 at 11.42.25.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kubernetes workload name is going to be a variable,&amp;nbsp;&lt;/P&gt;&lt;P&gt;then I would like to query based on that name (e.g. to get 5xx timeseries) to get all related services.&amp;nbsp;&lt;/P&gt;&lt;P&gt;btw. is it possible to trim service-id from your query as I am getting sth like:&amp;nbsp;SERVICE-86915F82C40F74B8•payments-api PaymentLinksController&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 09:49:42 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257538#M1269</guid>
      <dc:creator>DamianJankowski</dc:creator>
      <dc:date>2024-09-30T09:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257547#M1270</link>
      <description>&lt;P&gt;To get list of workload names to use in variable definition:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.cloud_application
| fields entity.name
| dedup entity.name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Of course you can control what fields are in final results using &lt;EM&gt;&lt;STRONG&gt;fields&lt;/STRONG&gt; &lt;/EM&gt;of &lt;EM&gt;&lt;STRONG&gt;fieldsRemove&lt;/STRONG&gt; &lt;/EM&gt;commands.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries response_time=avg(dt.service.request.response_time), by: {dt.entity.service},
filter: in( dt.entity.service, 
  classicEntitySelector(concat("type(service),fromRelationship.isServiceOf(type(CLOUD_APPLICATION),entityName(",$Entity,"))")))
| fields dt.entity.service = entityName(dt.entity.service), response_time, interval, timeframe&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 10:08:56 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257547#M1270</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-09-30T10:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257576#M1271</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/25373"&gt;@krzysztof_hoja&lt;/a&gt;&amp;nbsp;thanks, second query indeed is solving the issue, thanks a lot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there an other option to list workloads?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 12:52:08 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257576#M1271</guid>
      <dc:creator>DamianJankowski</dc:creator>
      <dc:date>2024-09-30T12:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257615#M1272</link>
      <description>&lt;P&gt;If you want data related variable, one fed by DQL results is the easiest one to use.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 16:50:29 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257615#M1272</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-09-30T16:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257637#M1274</link>
      <description>&lt;P class=""&gt;Hmm… the workload name (without a lot of trash) should be usable as a variable to create a tile that queries all related services&lt;/P&gt;&lt;P class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image 2024-09-30 at 22.52.02.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23061iAFB2F3B6A5F7DC11/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image 2024-09-30 at 22.52.02.png" alt="Image 2024-09-30 at 22.52.02.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image 2024-09-30 at 22.54.35.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23062i1745FC40479ACACD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image 2024-09-30 at 22.54.35.png" alt="Image 2024-09-30 at 22.54.35.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 20:56:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257637#M1274</guid>
      <dc:creator>DamianJankowski</dc:creator>
      <dc:date>2024-09-30T20:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257699#M1275</link>
      <description>&lt;P&gt;I am not sure what is your question here....&lt;BR /&gt;&lt;BR /&gt;Query retrieving e.g. response time takes workload name ($Entity matching name of CLOUD_APPLICATION).&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 10:25:35 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257699#M1275</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-10-01T10:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257736#M1276</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/25373"&gt;@krzysztof_hoja&lt;/a&gt;&amp;nbsp;I would like a query that returns only the Kubernetes workloads and another one that returns all entities belonging to a specific workload. So the question is - how to achieve that?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 16:52:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/257736#M1276</guid>
      <dc:creator>DamianJankowski</dc:creator>
      <dc:date>2024-10-01T16:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/273624#M1863</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hi &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/25373"&gt;@krzysztof_hoja&lt;/a&gt;&amp;nbsp;, thanks for sharing!&lt;/P&gt;&lt;P&gt;Do you know if there's an alternative approach to correlate metrics like service response time with total CPU consumption of the pods belonging to its associated workloads?&lt;/P&gt;&lt;P&gt;It works with classicEntitySelector&amp;nbsp;but I can't iterate on each entity without coding or a workflow :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.cloud_application
| filter in( id, classicEntitySelector("type(CLOUD_APPLICATION),toRelationships.isServiceOf(type(SERVICE),entityId(SERVICE-B82BE29035866C21))"))
| fieldsAdd serviceID = "SERVICE-B82BE29035866C21"&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AurelienGravier_0-1743015647565.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27218i50BA39A25DA471CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AurelienGravier_0-1743015647565.png" alt="AurelienGravier_0-1743015647565.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm looking for a way to build an iterative view ideally suitable for rendering in a notebook table, where each row would contain:&lt;BR /&gt;- Service name&lt;BR /&gt;- Avg response time&lt;BR /&gt;- Total CPU usage of its workload’s pods (aggregated)&lt;/P&gt;&lt;P&gt;Would love to know if you've explored something similar, or have any tips on composing the entity graph to support this use case.&lt;/P&gt;&lt;P&gt;Thanks you very much.&lt;BR /&gt;Regard Aurélien.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 19:09:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/273624#M1863</guid>
      <dc:creator>AurelienGravier</dc:creator>
      <dc:date>2025-03-26T19:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Query Kuberentes workloads</title>
      <link>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/273764#M1871</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/25373"&gt;@krzysztof_hoja&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I eventually figured out how to do this iteratively using the belongs_to method :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.service

| filter isnotnull(clustered_by)

// Get namespaces from service
| fieldsAdd namespaceId = belongs_to[dt.entity.cloud_application_namespace]
| expand namespaceId
| fieldsAdd namespace = entityAttr(namespaceId, "entity.name", type:"dt.entity.cloud_application_namespace")
// Get workloads from service
| fieldsAdd workloadId = belongs_to[dt.entity.cloud_application]
| expand workloadId
| fieldsAdd workloadName = entityAttr(workloadId, "entity.name", type:"dt.entity.cloud_application")


// get service median response time
| lookup [
timeseries responseTime_p50_timeseries = percentile(dt.service.request.response_time, 50), by:{dt.entity.service}, bins: 40
], sourceField:id, lookupField:dt.entity.service, fields:{responseTime_p50_timeseries}, executionOrder:leftFirst
| fieldsAdd responseTime = arrayLast(responseTime_p50_timeseries)

// Add CPU % Usage per workload
// Only work for workload with a limit set
| lookup [
timeseries by:{dt.entity.cloud_application}, {
cpu_usage = sum(dt.kubernetes.container.cpu_usage, default:0, rollup:avg),
cpu_limit = sum(dt.kubernetes.container.limits_cpu, rollup:avg)
}
| fieldsAdd cpuPercent = (arrayAvg(cpu_usage) / arrayAvg(cpu_limit)) * 100

] , sourceField:workloadId, lookupField:dt.entity.cloud_application, fields:{cpuPercent}
| fieldsAdd cpuPercent = if(isNull(cpuPercent), "no limit", else: cpuPercent)

....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AurelienGravier_0-1743142370828.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27251i52D124F6055CB8CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AurelienGravier_0-1743142370828.png" alt="AurelienGravier_0-1743142370828.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 06:16:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Query-Kuberentes-workloads/m-p/273764#M1871</guid>
      <dc:creator>AurelienGravier</dc:creator>
      <dc:date>2025-03-28T06:16:07Z</dc:date>
    </item>
  </channel>
</rss>

