<?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: Distributed tracing - filter requests by child span attributes in Open Q&amp;A</title>
    <link>https://community.dynatrace.com/t5/Open-Q-A/Distributed-tracing-filter-requests-by-child-span-attributes/m-p/277730#M36561</link>
    <description>&lt;P&gt;In gen2 (classic view) with OA traces it is possible via backtraces/service flow feature. Currently this feature is not available as gen3 app for Opentelemetry spans, but probably it will be in future.&lt;BR /&gt;&lt;BR /&gt;Via DQL this is feasible, you need to perform a query like this:&lt;BR /&gt;(note: it is for DB queries, but you can replicate the logic)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans
| filter db.namespace == "DB1"
| filter code.function == "executeQuery"
| filter duration &amp;gt; 100ms
| fields start_time, Service = entityName(dt.entity.service), Database = db.namespace, Query = db.query.text, QueryTime = duration, trace.id, subtrace.id, span.id
| join [fetch spans
        | filter isNotNull(duration) and isNotNull(endpoint.name)
        | summarize {
          child_requests = arrayRemoveNulls(collectDistinct(
          record(
                 endpoint.name,
                 duration
                 )))}, 
          by: {trace.id, subtrace.id}
        ],
        kind: leftOuter,
        on: {subtrace.id},
        executionOrder:leftFirst
| expand right.child_requests
| fields start_time, 
         Service,
         EndPoint = right.child_requests[endpoint.name],
         Duration = right.child_requests[duration],
         Database,
         Query,
         QueryTime,
         trace.id,
         span.id
| sort QueryTime desc
| filterOut isNull(EndPoint)
| summarize { requestCount = count(), avgQueryTime = avg(QueryTime), avg(Duration), collectDistinct(concat(Service, "|", EndPoint)) }, by: {Query}
//| filter requestCount &amp;gt; 100 
| sort avgQueryTime desc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 May 2025 20:00:38 GMT</pubDate>
    <dc:creator>yanezza</dc:creator>
    <dc:date>2025-05-21T20:00:38Z</dc:date>
    <item>
      <title>Distributed tracing - filter requests by child span attributes</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Distributed-tracing-filter-requests-by-child-span-attributes/m-p/277184#M36510</link>
      <description>&lt;P&gt;Hi, I am new to Dynatrace and I would like to know if there is a way, in the&amp;nbsp;&lt;STRONG&gt;Dynamic Tracing &lt;/STRONG&gt;app, to show all the requests with a nested child span that has a specific attribute. I am currently using OpenTelemetry ingestion, and the closest i was able to get to that is to select "Span" view instead of "Requests", and then the filter input shows me all the span attributes.&lt;/P&gt;&lt;P&gt;EDIT: Another way I obtained the same result, was to manually add each attribute that I wanted to track to both the current span and the root span (walking the span tree upwards) in my program, but this solution is useless if the trace was started by another services.&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 12:22:34 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Distributed-tracing-filter-requests-by-child-span-attributes/m-p/277184#M36510</guid>
      <dc:creator>matcap</dc:creator>
      <dc:date>2025-05-14T12:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Distributed tracing - filter requests by child span attributes</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Distributed-tracing-filter-requests-by-child-span-attributes/m-p/277730#M36561</link>
      <description>&lt;P&gt;In gen2 (classic view) with OA traces it is possible via backtraces/service flow feature. Currently this feature is not available as gen3 app for Opentelemetry spans, but probably it will be in future.&lt;BR /&gt;&lt;BR /&gt;Via DQL this is feasible, you need to perform a query like this:&lt;BR /&gt;(note: it is for DB queries, but you can replicate the logic)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans
| filter db.namespace == "DB1"
| filter code.function == "executeQuery"
| filter duration &amp;gt; 100ms
| fields start_time, Service = entityName(dt.entity.service), Database = db.namespace, Query = db.query.text, QueryTime = duration, trace.id, subtrace.id, span.id
| join [fetch spans
        | filter isNotNull(duration) and isNotNull(endpoint.name)
        | summarize {
          child_requests = arrayRemoveNulls(collectDistinct(
          record(
                 endpoint.name,
                 duration
                 )))}, 
          by: {trace.id, subtrace.id}
        ],
        kind: leftOuter,
        on: {subtrace.id},
        executionOrder:leftFirst
| expand right.child_requests
| fields start_time, 
         Service,
         EndPoint = right.child_requests[endpoint.name],
         Duration = right.child_requests[duration],
         Database,
         Query,
         QueryTime,
         trace.id,
         span.id
| sort QueryTime desc
| filterOut isNull(EndPoint)
| summarize { requestCount = count(), avgQueryTime = avg(QueryTime), avg(Duration), collectDistinct(concat(Service, "|", EndPoint)) }, by: {Query}
//| filter requestCount &amp;gt; 100 
| sort avgQueryTime desc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 20:00:38 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Distributed-tracing-filter-requests-by-child-span-attributes/m-p/277730#M36561</guid>
      <dc:creator>yanezza</dc:creator>
      <dc:date>2025-05-21T20:00:38Z</dc:date>
    </item>
  </channel>
</rss>

