Say we have a metric of web request rates and are interested in how much traffic we have compared to last week. The following diagram shows how such a comparison might look like with CAQL:



The three line-plots are generated as follows:

  1. [green] web request metric, generated by:

        metric:average(<check_id>, <metric_name>)

  2. [black] web request metric delayed by 7 days:

        metric:average(<check_id>, <metric_name>) | delay(7d)

  3. [red, right axis] Growth compared to last week

        metric:average(<check_id>, <metric_name>) / 
        (metric:average(<check_id>, <metric_name>) | delay(7d))


Variant: With windowed smoothing


To make the method more robust against small traffic spikes, we can smooth the initial metric with this:


    metric:average(<check_id>, <metric_name>) | rolling:mean(3h)


The results looks like this: