<?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: DQL - Execution in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295426#M3180</link>
    <description>&lt;P&gt;Sure, in the long term, a custom metric created on spans is preferred or DQL on spans.&lt;BR /&gt;An OpenPipeline example, don't forget to add the http reponse status, so you can filter on it afterwards.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="openpipeline.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/32153i9C3EA4A31A24CBA4/image-size/large?v=v2&amp;amp;px=999" role="button" title="openpipeline.png" alt="openpipeline.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;DQL query on spans:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans
| filter span.kind == "client" and dt.smartscape.service == toSmartscapeId("SERVICE-123") and http.url == "XYZ"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Depending on your service detection rules, if you have the target endpoint as a dedicated service (Service detection rules v1 external webrequest or webservice rules), it has a service with metrics directly.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Feb 2026 14:47:47 GMT</pubDate>
    <dc:creator>Julius_Loman</dc:creator>
    <dc:date>2026-02-27T14:47:47Z</dc:date>
    <item>
      <title>DQL - Execution</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295186#M3160</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;How can I achieve this with DQL?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Trigger an error if the 5XX error rate &amp;gt; 1% of the 2XX / 15m&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've a timeseries metric preceding to the above condition.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;MH&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2026 09:55:19 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295186#M3160</guid>
      <dc:creator>munawarhossain3</dc:creator>
      <dc:date>2026-02-24T09:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: DQL - Execution</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295196#M3161</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Yes, you can do this in DQL: compute 2xx and 5xx counts over the last 15 minutes, calculate the ratio, and filter when it exceeds 1%. Below is a working example based on spans using http.response.status_code. The important bit is using named optional parameters (else:) in if(), otherwise you may hit “Too many positional parameters…”.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans
| filter request.is_root_span == true
| filter isNotNull(http.response.status_code)
| makeTimeseries {
    r2xx = sum(if(http.response.status_code &amp;gt;= 200 and http.response.status_code &amp;lt;= 299, 1, else: 0)),
    r5xx = sum(if(http.response.status_code &amp;gt;= 500 and http.response.status_code &amp;lt;= 599, 1, else: 0))
  },
  by: { dt.entity.service },
  interval: 1m,
  from: -15m
| fieldsAdd rate_pct = 100 * r5xx[] / if(r2xx[] == 0, null, else: r2xx[])
| filter arrayMax(rate_pct) &amp;gt; 1
| sort arrayMax(rate_pct) desc&lt;/LI-CODE&gt;&lt;P&gt;What it returns: only services where, in the last 15 minutes (1-minute buckets), the maximum 5xx/2xx ratio exceeds 1%.&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;If you want to triiger it, like&amp;nbsp;trigger an error/alert, DQL&amp;nbsp;itself won’t throw an error, but you can:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;run this in a Workflow on a schedule and if the result is not empty → notify / create an event,&lt;/LI&gt;&lt;LI&gt;or (if you already have this as a metric) use a metric event threshold (&amp;gt;1%).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zrzut ekranu 2026-02-24 132735.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/32114i286CD52229949679/image-size/large?v=v2&amp;amp;px=999" role="button" title="Zrzut ekranu 2026-02-24 132735.jpg" alt="Zrzut ekranu 2026-02-24 132735.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2026 12:28:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295196#M3161</guid>
      <dc:creator>t_pawlak</dc:creator>
      <dc:date>2026-02-24T12:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: DQL - Execution</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295201#M3163</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/42367"&gt;@t_pawlak&lt;/a&gt;&amp;nbsp;I would strongly discourage using DQL directly on spans for this purpose, especially if you need to define an anomaly detector (implies costs and needs to read data constantly). The metric&amp;nbsp;dt.service.request.count contains the http.response.status.code dimension among other dimensions.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2026 13:09:53 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295201#M3163</guid>
      <dc:creator>Julius_Loman</dc:creator>
      <dc:date>2026-02-24T13:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: DQL - Execution</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295203#M3164</link>
      <description>&lt;P&gt;Thanks, agree. For detection/anomaly use-cases I’d also prefer a metric-based approach (lighter/cheaper than scanning spans). dt.service.request.count indeed exposes http.response.status.code.&lt;BR /&gt;In my tenant/context, however, DQL doesn’t allow fetch metrics (I get “metrics isn’t a valid data object”), so I can’t query that metric via DQL directly.&lt;BR /&gt;The practical solution is to configure a Metric event using the metric selector expression (5xx / 2xx over 15m) and use DQL on spans only for ad-hoc analysis / when metrics aren’t available.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2026 13:16:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295203#M3164</guid>
      <dc:creator>t_pawlak</dc:creator>
      <dc:date>2026-02-24T13:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: DQL - Execution</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295205#M3165</link>
      <description>&lt;P&gt;It's timeseries command, not fetch.&lt;BR /&gt;&lt;BR /&gt;A more complex command to query metrics and query 4xx/5xx as both timeseries and scalar values in a single timeseries command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries { 
  `requests`=sum(dt.service.request.count), `requests.total` = sum(dt.service.request.count, scalar: true) 
  , `4xx`=sum(dt.service.request.count, filter: http.response.status_code &amp;gt;= 400 and http.response.status_code &amp;lt; 500)
  , `4xx_total` = sum(dt.service.request.count, filter: http.response.status_code &amp;gt;= 400 and http.response.status_code &amp;lt; 500, scalar: true)
  , `5xx`=sum(dt.service.request.count, filter: http.response.status_code &amp;gt;= 500 and http.response.status_code &amp;lt; 600)
  , `5xx_total` = sum(dt.service.request.count, filter: http.response.status_code &amp;gt;= 500 and http.response.status_code &amp;lt; 600, scalar: true) 
}, union:true
, by: { dt.entity.service }&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;You just need to adjust filters and compute the ratio you want.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2026 13:43:21 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295205#M3165</guid>
      <dc:creator>Julius_Loman</dc:creator>
      <dc:date>2026-02-24T13:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: DQL - Execution</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295402#M3179</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thanks, if I want to go with a service (123) and its target url (xyz). Is that doable?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2026 11:22:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295402#M3179</guid>
      <dc:creator>munawarhossain3</dc:creator>
      <dc:date>2026-02-27T11:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: DQL - Execution</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295426#M3180</link>
      <description>&lt;P&gt;Sure, in the long term, a custom metric created on spans is preferred or DQL on spans.&lt;BR /&gt;An OpenPipeline example, don't forget to add the http reponse status, so you can filter on it afterwards.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="openpipeline.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/32153i9C3EA4A31A24CBA4/image-size/large?v=v2&amp;amp;px=999" role="button" title="openpipeline.png" alt="openpipeline.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;DQL query on spans:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans
| filter span.kind == "client" and dt.smartscape.service == toSmartscapeId("SERVICE-123") and http.url == "XYZ"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Depending on your service detection rules, if you have the target endpoint as a dedicated service (Service detection rules v1 external webrequest or webservice rules), it has a service with metrics directly.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2026 14:47:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-Execution/m-p/295426#M3180</guid>
      <dc:creator>Julius_Loman</dc:creator>
      <dc:date>2026-02-27T14:47:47Z</dc:date>
    </item>
  </channel>
</rss>

