<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <font face="Calibri">Perhaps you could get some ideas from the
      expression language we put together for the current metrics
      alerter.  It exists today but we could certainly change the
      alerter to use a new query language, if/when it exists.  I'd guess
      a lot of people don't realize you can even query/alert on hMetrics
      using these expressions.  For example, you could do something like
      this to test if the 90th percentile is greater than twice the
      median for a metric set defined by a tagQuery, either combining
      the metrics or testing them each individually.<br>
    </font><br>
    <pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; font-size: 14px; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; color: rgb(51, 51, 51); background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">  ( q(qNow,%90) &gt; ( 2 * q(qNow,median) ) )</pre>
    <font face="Calibri"><br>
<a class="moz-txt-link-freetext" href="http://www.hawkular.org/hawkular-metrics/docs/user-guide/#_query_based_alerting">http://www.hawkular.org/hawkular-metrics/docs/user-guide/#_query_based_alerting</a><br>
    </font><br>
    <div class="moz-cite-prefix">On 7/20/2017 7:58 AM, Joel Takvorian
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJo5TF=Hq+JXia9f6PZBVqHzHf75kkD7RkrDjQGURew+cFsU9Q@mail.gmail.com">
      <div dir="ltr">The only one I've used a lot among those you
        mention is mongodb query language. And honestly I don't like it
        very much, I find it quite counter-intuitive to use. It's all
        JSON, everything must be named and bracketed, I was quickly lost
        in a opened-closed-nested curly-braces hell. For instance,
        querying for age &gt; 40 is "{age:{$gt:40}}". It's probably easy
        to implement as a query language, but it can become a nightmare
        for users. In db world I see it as a big step backward from SQL,
        which is much more "natural". (I just found that blog post that
        explains it better than me: <a
href="http://www.vertabelo.com/blog/notes-from-the-lab/sql-vs-mongo-query"
          moz-do-not-send="true">http://www.vertabelo.com/blog/notes-from-the-lab/sql-vs-mongo-query</a>
        )</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Jul 20, 2017 at 8:51 AM,
          Michael Burman <span dir="ltr">&lt;<a
              href="mailto:miburman@redhat.com" target="_blank"
              moz-do-not-send="true">miburman@redhat.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
            <br>
            I'd personally would want to see another type of functional
            language,<br>
            such that would look like the one when you do Streams /
            RxJava. I guess<br>
            it's closer to the one in MongoDB/RethinkDB/InfluxDB
            2.0/Riemann, than<br>
            the one in Prometheus/Graphite (PromQL is mostly evolution
            of Graphite's<br>
            query language).<br>
            <br>
            And it could allow us to provide features such as streaming
            metrics,<br>
            since we could transform those queries directly to reactive
            queries (we<br>
            should take advantage of the fact that we process the
            metrics by<br>
            reacting to them in the backend).<br>
            <br>
                - Micke<br>
            <span class=""><br>
              <br>
              On 07/19/2017 06:36 PM, Joel Takvorian wrote:<br>
              &gt; Hi,<br>
              &gt;<br>
              &gt; I just want to share some ideas about the eventuality
              of having a<br>
              &gt; language to perform some arithmetic / aggregations on
              metrics, before<br>
              &gt; it goes out of my head...<br>
              &gt;<br>
              &gt; Here's an example of what I would personally love to
              see in Hawkular:<br>
              &gt;<br>
              &gt; ------------------------------<wbr>----------------<br>
            </span>&gt; *Example:*<br>
            &gt; /sum(stats(rate((id(my_metric)<wbr>, tags(a=foo AND
            b=bar),<br>
            &gt; regexp(something_.+)), 5m), 10m))/<br>
            <span class="">&gt; |<br>
              &gt; |=&gt; "id", "tags" and "regexp" all return a set of
              raw metrics (0-1 for<br>
              &gt; id, 0-n for tags and regexp)<br>
              &gt; |==&gt; "(a,b,c)" takes n parameters, all sets of
              metrics, and flatten<br>
              &gt; them in a single set<br>
              &gt; |===&gt; rate(set_of_raw_metrics, rate_period)
              computes the rate for each<br>
              &gt; of them and return a set of metrics (map n=&gt;n)<br>
              &gt; |====&gt; stats(set_of_raw_metrics, bucket_size)
              bucketize the raw<br>
              &gt; metrics, returning the same number of bucketized
              metrics (map n=&gt;n)<br>
              &gt; |=====&gt; sum(set_of_stats_metrics) sums every
              buckets, returning a<br>
              &gt; single bucketized metric (fold n=&gt;1)<br>
              &gt;<br>
              &gt;<br>
            </span>&gt; *Other:*<br>
            <span class="">&gt; Functions like "sum" that take
              stats_metrics could have overloaded<br>
              &gt; shortcut "sum(set_of_raw_metrics, bucket_size)" to
              perform the bucketing.<br>
              &gt; In other words above example could be rewritten:<br>
            </span>&gt; /sum(rate((id(my_metric), tags(a=foo AND b=bar),<br>
            &gt; regexp(something_.+)), 5m), 10m)/<br>
            <span class="">&gt;<br>
              &gt; Note: we can do aggregations like "sum" on raw data
              if necessary, it<br>
              &gt; just means we have to interpolate.<br>
              &gt;<br>
            </span>&gt; *Scalar operations:*<br>
            &gt; /sum((id(a_metric_in_<wbr>milliseconds),
            *1000**id(a_metric_in_seconds)<wbr>), 10m)/<br>
            <span class="im HOEnZb">&gt; ------------------------------<wbr>----------------<br>
              &gt;<br>
              &gt; Of course many other functions could come growing the
              library.<br>
              &gt;<br>
              &gt; Now I suppose the big question, if we want to do such
              thing, is "are<br>
              &gt; we going to invent our own language?" I don't know if
              there are<br>
              &gt; standards for this, and if they are good.<br>
              &gt;<br>
              &gt; The Prometheus query language cannot be transposed
              because a label is<br>
              &gt; not a tag and it makes no sense for us to write
              something like<br>
              &gt; "my_metric{tag=foo}", it's either "my_metric" or
              "tag=foo".<br>
              &gt;<br>
              &gt; The same language could be used both for read-time
              on-the-fly<br>
              &gt; aggregations and write-time / cron-based rollups.<br>
              &gt;<br>
              &gt; WDYT?<br>
              &gt;<br>
              &gt;<br>
              &gt;<br>
            </span>
            <div class="HOEnZb">
              <div class="h5">&gt; ______________________________<wbr>_________________<br>
                &gt; hawkular-dev mailing list<br>
                &gt; <a href="mailto:hawkular-dev@lists.jboss.org"
                  moz-do-not-send="true">hawkular-dev@lists.jboss.org</a><br>
                &gt; <a
                  href="https://lists.jboss.org/mailman/listinfo/hawkular-dev"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">https://lists.jboss.org/<wbr>mailman/listinfo/hawkular-dev</a><br>
                <br>
                ______________________________<wbr>_________________<br>
                hawkular-dev mailing list<br>
                <a href="mailto:hawkular-dev@lists.jboss.org"
                  moz-do-not-send="true">hawkular-dev@lists.jboss.org</a><br>
                <a
                  href="https://lists.jboss.org/mailman/listinfo/hawkular-dev"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">https://lists.jboss.org/<wbr>mailman/listinfo/hawkular-dev</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
hawkular-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:hawkular-dev@lists.jboss.org">hawkular-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/hawkular-dev">https://lists.jboss.org/mailman/listinfo/hawkular-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>