<?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: Null values returned for pending pods in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218532#M147</link>
    <description>&lt;P&gt;Hi Sini,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the clarification. It helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2023 11:25:12 GMT</pubDate>
    <dc:creator>VivekRagupathy</dc:creator>
    <dc:date>2023-07-19T11:25:12Z</dc:date>
    <item>
      <title>Null values returned for pending pods</title>
      <link>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218379#M141</link>
      <description>&lt;P&gt;I am trying to filter the pending pods in one of the clusters and also only from any of the two namespaces, so I have written query like mentioned below,&lt;/P&gt;
&lt;P&gt;I am getting null values as series,&amp;nbsp;If there are no pending pods, I do expect that the query does not return any record.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually I take the last item from the array and consider that as the current state.&lt;/P&gt;
&lt;P&gt;Am I missing anything here?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Query Used:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;timeseries series=sum(dt.kubernetes.pods), by:{k8s.workload.name,k8s.namespace.name,k8s.cluster.name,pod_phase}&lt;BR /&gt;| filter k8s.cluster.name == "&amp;lt;myclustername&amp;gt;" and (startsWith(k8s.namespace.name, "&amp;lt;startofmynamespace1&amp;gt;") or contains(k8s.namespace.name, "&amp;lt;substringmynamespace2&amp;gt;")) and pod_phase == "Pending"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{&lt;BR /&gt;"series": [&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null,&lt;BR /&gt;null&lt;BR /&gt;],&lt;BR /&gt;"k8s.workload.name": "&amp;lt;myworkloadname&amp;gt;",&lt;BR /&gt;"k8s.namespace.name": "&amp;lt;mynamespace1&amp;gt;",&lt;BR /&gt;"k8s.cluster.name": "&amp;lt;Mycluster&amp;gt;",&lt;BR /&gt;"pod_phase": "Pending",&lt;BR /&gt;"timeframe": {&lt;BR /&gt;"start": "2023-07-18T10:19:00.000Z",&lt;BR /&gt;"end": "2023-07-18T10:30:00.000Z"&lt;BR /&gt;},&lt;BR /&gt;"interval": "60000000000"&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 12:55:02 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218379#M141</guid>
      <dc:creator>VivekRagupathy</dc:creator>
      <dc:date>2023-07-18T12:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Null values returned for pending pods</title>
      <link>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218381#M142</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/64806"&gt;@VivekRagupathy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't see in your query where you t&lt;SPAN&gt;ake the last item from the array and consider that as the current state?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can you try out following query, it works for me in my environment&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;timeseries series=sum(dt.kubernetes.pods), by:{k8s.workload.name,k8s.namespace.name,k8s.cluster.name,pod_phase}, 
  filter:pod_phase == "Pending" and k8s.workload.name == "" and k8s.namespace.name == "" and k8s.cluster.name == ""
| fields countPendingPods = arrayLast(series), k8s.workload.name,k8s.namespace.name,k8s.cluster.name
| filter isNotNull(countPendingPods)&lt;/LI-CODE&gt;
&lt;P&gt;with the arrayLast, I am retrieving the most recent value of the array.&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Sini&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 11:33:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218381#M142</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2023-07-18T11:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Null values returned for pending pods</title>
      <link>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218409#M143</link>
      <description>&lt;P&gt;Hi Sini,&amp;nbsp;&lt;BR /&gt;Thanks for looking in to this query.&lt;BR /&gt;Yes I removed the arrayLast() function to show all the null records returned.&amp;nbsp;&lt;BR /&gt;Agree filtering with isNotNull() function is removing all the null records. Thanks for sharing this function.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am curious to know when we are specifying pod_phase == "Pending" it should not return any null values right?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 16:02:26 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218409#M143</guid>
      <dc:creator>VivekRagupathy</dc:creator>
      <dc:date>2023-07-18T16:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Null values returned for pending pods</title>
      <link>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218521#M145</link>
      <description>&lt;P&gt;for querying the dt.kubernetes.pods metric the pod_phase is a dimension, so you are filtering to that dimension. So the dimension with the value "Pending" of that metric is written usually once per minute only if a pod is in "Pending" state. If not, no it remains "null". that is the reason why the timeseries consists of null values (no pod was at that point in time in "Pending").&lt;/P&gt;
&lt;P&gt;The result of the timeseries command is at least one record (depends on the dimension splitting you can specify). And a record consists of an array of datapoints which represent the value of a certain point in time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this explanation helps to understand you better what is happening?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 10:40:39 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218521#M145</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2023-07-19T10:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Null values returned for pending pods</title>
      <link>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218532#M147</link>
      <description>&lt;P&gt;Hi Sini,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the clarification. It helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 11:25:12 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Null-values-returned-for-pending-pods/m-p/218532#M147</guid>
      <dc:creator>VivekRagupathy</dc:creator>
      <dc:date>2023-07-19T11:25:12Z</dc:date>
    </item>
  </channel>
</rss>

