<div dir="ltr">Hi,<div><br></div><div>I just want to share some ideas about the eventuality of having a language to perform some arithmetic / aggregations on metrics, before it goes out of my head...</div><div><br></div><div>Here&#39;s an example of what I would personally love to see in Hawkular:</div><div><br></div><div>----------------------------------------------</div><div><b>Example:</b></div><div><div><i>sum(stats(rate((id(my_metric), tags(a=foo AND b=bar), regexp(something_.+)), 5m), 10m))</i></div><div>|<br></div><div>|=&gt; &quot;id&quot;, &quot;tags&quot; and &quot;regexp&quot; all return a set of raw metrics (0-1 for id, 0-n for tags and regexp)</div><div>|==&gt; &quot;(a,b,c)&quot; takes n parameters, all sets of metrics, and flatten them in a single set</div><div>|===&gt; rate(set_of_raw_metrics, rate_period) computes the rate for each of them and return a set of metrics (map n=&gt;n)</div><div>|====&gt; stats(set_of_raw_metrics, bucket_size) bucketize the raw metrics, returning the same number of bucketized metrics (map n=&gt;n)</div><div>|=====&gt; sum(set_of_stats_metrics) sums every buckets, returning a single bucketized metric (fold n=&gt;1)</div><div><br></div><div><br></div><div><b>Other:</b></div><div>Functions like &quot;sum&quot; that take stats_metrics could have overloaded shortcut &quot;sum(set_of_raw_metrics, bucket_size)&quot; to perform the bucketing.</div><div>In other words above example could be rewritten:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span><i>sum(rate((id(my_metric), tags(a=foo AND b=bar), regexp(something_.+)), 5m), 10m)</i></div><div><br></div><div>Note: we can do aggregations like &quot;sum&quot; on raw data if necessary, it just means we have to interpolate.</div><div><br></div><div><b>Scalar operations:</b></div><div><i>sum((id(a_metric_in_milliseconds), <b>1000*</b>id(a_metric_in_seconds)), 10m)</i></div></div><div><div>----------------------------------------------</div><div><br></div><div>Of course many other functions could come growing the library.</div><div><br></div><div>Now I suppose the big question, if we want to do such thing, is &quot;are we going to invent our own language?&quot; I don&#39;t know if there are standards for this, and if they are good.</div><div><br></div><div>The Prometheus query language cannot be transposed because a label is not a tag and it makes no sense for us to write something like &quot;my_metric{tag=foo}&quot;, it&#39;s either &quot;my_metric&quot; or &quot;tag=foo&quot;.</div><div><br></div><div>The same language could be used both for read-time on-the-fly aggregations and write-time / cron-based rollups.</div><div><br></div><div>WDYT?</div><div><br></div><div></div></div></div>