{# A resource's metric anomalies, for its own page: one line saying how many wait for review and which are out of their normal now, with a button to Alerts → Anomalies narrowed to this resource, where they are reviewed. `anomalies` are anomalies.views() rows; `base_resource` is the page's resource (none for a page covering a whole source, like Traefik). Shown only while one waits for review or is going on. #} {% if anomalies %} {% set waiting = anomalies | selectattr("anomaly.review", "equalto", "to_review") | list %} {% set going = anomalies | selectattr("ongoing") | rejectattr("anomaly.review", "equalto", "normal") | list %} {% if waiting or going %} {% set q = {"source": anomalies[0].anomaly.source_module} %} {% if base_resource %}{% set _ = q.update({"resource": base_resource}) %}{% endif %}

{% if going %}Out of its normal now{% else %}Metric anomalies{% endif %}

{%- if going -%} {%- for v in going -%} {%- if v.anomaly.resource_name != base_resource %}{{ v.anomaly.resource_name }} {% endif -%} {{ metric_label(v.anomaly.metric_name) }}{{ ", " if not loop.last }} {%- endfor -%} {%- if waiting %} · {% endif -%} {%- endif -%} {%- if waiting %}{{ waiting|length }} to review{% endif -%} Review
{% endif %} {% endif %}