<?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 write multiple fetch spans query in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/How-to-write-multiple-fetch-spans-query/m-p/289230#M2743</link>
    <description>&lt;P&gt;Thanks It works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Nov 2025 13:35:46 GMT</pubDate>
    <dc:creator>rishirajk</dc:creator>
    <dc:date>2025-11-07T13:35:46Z</dc:date>
    <item>
      <title>How to write multiple fetch spans query</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-write-multiple-fetch-spans-query/m-p/289151#M2738</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;I wish to know how to write multiple fetch spans queries plus i want to use them to perform basic arithmetic operations .&lt;BR /&gt;I have tried using join statement however I am missing something .&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;fetch spans, scanLimitGBytes: -1&lt;BR /&gt;| filter request.is_root_span == true AND isNotNull(endpoint.name)&lt;BR /&gt;| filter (matchesValue(`k8s.workload.name`, "services")&lt;BR /&gt;OR matchesValue(`dt.kubernetes.workload.name`, "services"))&lt;BR /&gt;| filter matchesValue(`endpoint.name`, "ID")&lt;BR /&gt;| summarize generated_count = toLong(count())&lt;BR /&gt;| fieldsAdd join_key = 1&lt;BR /&gt;| join [&lt;BR /&gt;fetch spans, scanLimitGBytes: -1&lt;BR /&gt;| filter request.is_root_span == true AND isNotNull(endpoint.name)&lt;BR /&gt;| filter (matchesValue(`k8s.workload.name`, "services")&lt;BR /&gt;OR matchesValue(`dt.kubernetes.workload.name`, "services"))&lt;BR /&gt;| filter matchesValue(`endpoint.name`, "Verify")&lt;BR /&gt;and (`http.response.status_code` == 202 OR toLong(http.status_code) == 202&lt;BR /&gt;OR `http.response.status_code` == 200 OR toLong(http.status_code) == 200)&lt;BR /&gt;| summarize verified_count = toLong(count())&lt;BR /&gt;| fieldsAdd join_key = 1&lt;BR /&gt;],&lt;BR /&gt;on: { left[join_key] == right[join_key] },&lt;BR /&gt;fields: { generated_count, verified_count }&lt;BR /&gt;| join [&lt;BR /&gt;fetch spans, scanLimitGBytes: -1&lt;BR /&gt;| filter request.is_root_span == true AND isNotNull(endpoint.name)&lt;BR /&gt;| filter (matchesValue(`k8s.workload.name`, "services")&lt;BR /&gt;OR matchesValue(`dt.kubernetes.workload.name`, "services"))&lt;BR /&gt;| filter matchesValue(`endpoint.name`, "Verify")&lt;BR /&gt;and (`http.response.status_code` == 409 OR toLong(http.status_code) == 409)&lt;BR /&gt;| summarize failed_count = toLong(count())&lt;BR /&gt;| fieldsAdd join_key = 1&lt;BR /&gt;],&lt;BR /&gt;on: { left[join_key] == right[join_key] },&lt;BR /&gt;fields: { generated_count, verified_count, failed_count }&lt;BR /&gt;| fieldsAdd unused_otp = generated_count - (verified_count + failed_count)&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 08:07:05 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-write-multiple-fetch-spans-query/m-p/289151#M2738</guid>
      <dc:creator>rishirajk</dc:creator>
      <dc:date>2025-11-07T08:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to write multiple fetch spans query</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-write-multiple-fetch-spans-query/m-p/289219#M2742</link>
      <description>&lt;P&gt;Hi! You don’t need multiple fetch + join queries for this. It’s much faster and simpler to do a single pass over spans and compute conditional counts directly.&lt;BR /&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans, scanLimitGBytes: -1
| filter request.is_root_span == true
| filter isNotNull(endpoint.name)
| filter matchesValue(k8s.workload.name, "services")
      OR matchesValue(dt.kubernetes.workload.name, "services")
| fieldsAdd status = toLong(coalesce(http.response.status_code, http.status_code))
| summarize
  generated_count = toLong(countIf(matchesValue(endpoint.name, "ID"))),
  verified_count  = toLong(countIf(matchesValue(endpoint.name, "Verify") AND (status == 200 OR status == 202))),
  failed_count    = toLong(countIf(matchesValue(endpoint.name, "Verify") AND status == 409))
| fieldsAdd unused_otp = generated_count - (verified_count + failed_count)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Nov 2025 12:11:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-write-multiple-fetch-spans-query/m-p/289219#M2742</guid>
      <dc:creator>t_pawlak</dc:creator>
      <dc:date>2025-11-07T12:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to write multiple fetch spans query</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-write-multiple-fetch-spans-query/m-p/289230#M2743</link>
      <description>&lt;P&gt;Thanks It works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 13:35:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-write-multiple-fetch-spans-query/m-p/289230#M2743</guid>
      <dc:creator>rishirajk</dc:creator>
      <dc:date>2025-11-07T13:35:46Z</dc:date>
    </item>
  </channel>
</rss>

