<?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 plot linechart from log metric with countDistinctExact in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/plot-linechart-from-log-metric-with-countDistinctExact/m-p/250944#M1067</link>
    <description>&lt;P&gt;I cannot figure out how to introduce custom aggregation to log metrics for dashboarding with dynamic timeframe (plot linechart) use&lt;/P&gt;&lt;P&gt;for example&amp;nbsp;&lt;EM&gt;countDistinctExact&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;timeseries&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;log_custom_metric_value = count(log.custom.metric),&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;by: {dimension}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;| summarize {no_of_uni=countDistinctExact(log_custom_metric_value[])}, by:{interval, timeframe}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is returning:&lt;/P&gt;&lt;P class=""&gt;&lt;EM&gt;This aggregation function currently doesn't support iterative expressions.&lt;/EM&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;is there way how to introduce custom aggregation (for example with summarization) for metrics ?&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;thank you&lt;/DIV&gt;&lt;DIV class=""&gt;R&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jul 2024 08:21:03 GMT</pubDate>
    <dc:creator>_r_k_</dc:creator>
    <dc:date>2024-07-18T08:21:03Z</dc:date>
    <item>
      <title>plot linechart from log metric with countDistinctExact</title>
      <link>https://community.dynatrace.com/t5/DQL/plot-linechart-from-log-metric-with-countDistinctExact/m-p/250944#M1067</link>
      <description>&lt;P&gt;I cannot figure out how to introduce custom aggregation to log metrics for dashboarding with dynamic timeframe (plot linechart) use&lt;/P&gt;&lt;P&gt;for example&amp;nbsp;&lt;EM&gt;countDistinctExact&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;timeseries&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;log_custom_metric_value = count(log.custom.metric),&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;by: {dimension}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;| summarize {no_of_uni=countDistinctExact(log_custom_metric_value[])}, by:{interval, timeframe}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is returning:&lt;/P&gt;&lt;P class=""&gt;&lt;EM&gt;This aggregation function currently doesn't support iterative expressions.&lt;/EM&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;is there way how to introduce custom aggregation (for example with summarization) for metrics ?&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;thank you&lt;/DIV&gt;&lt;DIV class=""&gt;R&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 08:21:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/plot-linechart-from-log-metric-with-countDistinctExact/m-p/250944#M1067</guid>
      <dc:creator>_r_k_</dc:creator>
      <dc:date>2024-07-18T08:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: plot linechart from log metric with countDistinctExact</title>
      <link>https://community.dynatrace.com/t5/DQL/plot-linechart-from-log-metric-with-countDistinctExact/m-p/251080#M1070</link>
      <description>&lt;P&gt;It's true that some aggregation functions are not supported in &lt;EM&gt;&lt;STRONG&gt;makeTimeseries&lt;/STRONG&gt; &lt;/EM&gt;command or they do not work for arrays (iterative expressions) in &lt;EM&gt;&lt;STRONG&gt;summarize&lt;/STRONG&gt; &lt;/EM&gt;but you can always breakdown array into single rows and do what it needed using &lt;STRONG&gt;&lt;EM&gt;summarize&lt;/EM&gt; &lt;/STRONG&gt;and all aggregation functions on any fields and expressions.&lt;/P&gt;&lt;P&gt;Here is example on one of my metrics from log:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries {cnt=count(log.aws.vpc.bytes), timestamp=start()}, by:{vpc_id}, interval:1m
| fieldsAdd d=record(cnt=cnt[], timestamp=timestamp[])
| expand d 
| summarize {cnt=countDistinctExact(d[cnt])}, by: {timestamp=d[timestamp]}
| makeTimeseries cnt=max(cnt), interval:1m&lt;/LI-CODE&gt;&lt;P&gt;First step is to build array of pairs: time and metric value. The next one is to &lt;STRONG&gt;expand&lt;/STRONG&gt; it. At this moment each datapoint is individual row and you can apply any aggregation. To get it back as array using &lt;EM&gt;&lt;STRONG&gt;makeTimeseries&lt;/STRONG&gt; &lt;/EM&gt;is needed, but as before this step you have each value already in its final form, you can use any aggregation function as this will be 1 filed in on record to 1 element in array conversion (I used max).&lt;/P&gt;&lt;P&gt;I used your query as input where you attempt to calculate distinct count of metric values for each interval.&lt;/P&gt;&lt;P&gt;I hope it helps&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 11:25:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/plot-linechart-from-log-metric-with-countDistinctExact/m-p/251080#M1070</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-07-19T11:25:43Z</dc:date>
    </item>
  </channel>
</rss>

