<?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: Match nested span data based on time in DQL in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Match-nested-span-data-based-on-time-in-DQL/m-p/293472#M3074</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;IMO&amp;nbsp;Yes, it’s possible, but lookup can’t reliably pick the “closest in time” span when multiple pipeline spans exist.&lt;BR /&gt;Try use&amp;nbsp;join, compute the time delta, keep only positive deltas.&lt;BR /&gt;here example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans
| filter jenkins.instance.name == "jenkins-prod"
| filter jenkins.computer.name == "agent-01"
| fields trace.id,
         computer_start = start_time,
         computer_span = span.name,
         jenkins.computer.name
| join [
    fetch spans
    | filter jenkins.instance.name == "jenkins-prod"
    | filter isNotNull(ci.pipeline.id)
    | fields trace.id,
             pipeline_start = start_time,
             ci.pipeline.id,
             ci.pipeline.run.url
  ],
  on: { left[trace.id] == right[trace.id] }
| fieldsAdd delta = computer_start - right.pipeline_start
| filter delta &amp;gt;= 0
| sort delta asc
| dedup trace.id, computer_start
| fields computer_start,
         jenkins.computer.name,
         right.ci.pipeline.id,
         right.ci.pipeline.run.url,
         delta
| sort computer_start asc&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 22 Jan 2026 12:23:33 GMT</pubDate>
    <dc:creator>t_pawlak</dc:creator>
    <dc:date>2026-01-22T12:23:33Z</dc:date>
    <item>
      <title>Match nested span data based on time in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Match-nested-span-data-based-on-time-in-DQL/m-p/293398#M3066</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello, wondering if this is possible using DQL i gave it a solid try but cannot do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the opentelemetry plugin installed on jenkins sending data to dynatrace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to use the trace/span data to see all the pipelines that a given computer was used on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is only the first span contains the pipeline name and url (ci.pipeline.id and ci.pipeline.url)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And later in the trace some spans contain the computer name (jenkins.computer.name). So far no problem. I have the query below that uses a lookup to match the data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There is an exception though , if a pipeline is called by another pipeline they are all part of the same trace. In that case the query below can return wrong results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need a way to find the span that contains the computer name that happened the closest in time after the span that contains the pipeline name. Wondering if a DQL magician knows how to do this?&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what i already have:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans
| filter jenkins.instance.name == $Controller
| filter isNotNull(ci.pipeline.id)
| lookup [
    fetch spans
    | filter jenkins.computer.name == $Computer
    | filter jenkins.instance.name == $Controller
    | fields trace.id,span.name,jenkins.computer.name
  ], sourceField:trace.id, lookupField:trace.id
| filter isNotNull(lookup.trace.id)
| dedup trace.id
| sort start_time asc
| fields start_time,duration,lookup.jenkins.computer.name,ci.pipeline.id,ci.pipeline.run.url&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Jan 2026 14:47:36 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Match-nested-span-data-based-on-time-in-DQL/m-p/293398#M3066</guid>
      <dc:creator>SimGiants92</dc:creator>
      <dc:date>2026-01-21T14:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Match nested span data based on time in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Match-nested-span-data-based-on-time-in-DQL/m-p/293472#M3074</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;IMO&amp;nbsp;Yes, it’s possible, but lookup can’t reliably pick the “closest in time” span when multiple pipeline spans exist.&lt;BR /&gt;Try use&amp;nbsp;join, compute the time delta, keep only positive deltas.&lt;BR /&gt;here example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans
| filter jenkins.instance.name == "jenkins-prod"
| filter jenkins.computer.name == "agent-01"
| fields trace.id,
         computer_start = start_time,
         computer_span = span.name,
         jenkins.computer.name
| join [
    fetch spans
    | filter jenkins.instance.name == "jenkins-prod"
    | filter isNotNull(ci.pipeline.id)
    | fields trace.id,
             pipeline_start = start_time,
             ci.pipeline.id,
             ci.pipeline.run.url
  ],
  on: { left[trace.id] == right[trace.id] }
| fieldsAdd delta = computer_start - right.pipeline_start
| filter delta &amp;gt;= 0
| sort delta asc
| dedup trace.id, computer_start
| fields computer_start,
         jenkins.computer.name,
         right.ci.pipeline.id,
         right.ci.pipeline.run.url,
         delta
| sort computer_start asc&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 22 Jan 2026 12:23:33 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Match-nested-span-data-based-on-time-in-DQL/m-p/293472#M3074</guid>
      <dc:creator>t_pawlak</dc:creator>
      <dc:date>2026-01-22T12:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Match nested span data based on time in DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Match-nested-span-data-based-on-time-in-DQL/m-p/293522#M3075</link>
      <description>&lt;P&gt;Thank you so much for the answer! Unfortunately it does not work it still gives a random pipeline id in the case of nested pipelines. I did not consider the possibility of parallel pipelines in the same trace id. I got something working with nested lookup going to the parent span id each time but its not pretty. i am still looking for an elegant solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jan 2026 19:48:45 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Match-nested-span-data-based-on-time-in-DQL/m-p/293522#M3075</guid>
      <dc:creator>SimGiants92</dc:creator>
      <dc:date>2026-01-22T19:48:45Z</dc:date>
    </item>
  </channel>
</rss>

