You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{# when there is an anomaly we would want to use the last value of the metric (lag), otherwise visually the expectations would look out of bounds #}
81
68
case
82
69
when is_anomalous = TRUE and'{{ test_configuration.anomaly_direction }}'='spike' then
83
-
lag(metric_value) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
70
+
{{ elementary.lag('metric_value') }} over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
84
71
when is_anomalous = TRUE and'{{ test_configuration.anomaly_direction }}'!='spike' then
85
-
lag(min_metric_value) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
72
+
{{ elementary.lag('min_metric_value') }} over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
86
73
when '{{ test_configuration.anomaly_direction }}'='spike' then metric_value
87
74
else min_metric_value
88
75
end as min_value,
89
76
case
90
77
when is_anomalous = TRUE and'{{ test_configuration.anomaly_direction }}'='drop' then
91
-
lag(metric_value) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
78
+
{{ elementary.lag('metric_value') }} over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
92
79
when is_anomalous = TRUE and'{{ test_configuration.anomaly_direction }}'!='drop' then
93
-
lag(max_metric_value) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
80
+
{{ elementary.lag('max_metric_value') }} over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
94
81
when '{{ test_configuration.anomaly_direction }}'='drop' then metric_value
{# when there is an anomaly we would want to use the last value of the metric (lag), otherwise visually the expectations would look out of bounds #}
111
-
case
112
-
when is_anomalous = TRUE and'{{ test_configuration.anomaly_direction }}'='spike' then
113
-
lagInFrame(metric_value, 1) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
114
-
when is_anomalous = TRUE and'{{ test_configuration.anomaly_direction }}'!='spike' then
115
-
lagInFrame(min_metric_value, 1) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
116
-
when '{{ test_configuration.anomaly_direction }}'='spike' then metric_value
117
-
else min_metric_value
118
-
end as min_value,
119
-
case
120
-
when is_anomalous = TRUE and'{{ test_configuration.anomaly_direction }}'='drop' then
121
-
lagInFrame(metric_value, 1) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
122
-
when is_anomalous = TRUE and'{{ test_configuration.anomaly_direction }}'!='drop' then
123
-
lagInFrame(max_metric_value, 1) over (partition by full_table_name, column_name, metric_name, dimension, dimension_value, bucket_seasonality order by bucket_end)
124
-
when '{{ test_configuration.anomaly_direction }}'='drop' then metric_value
125
-
else max_metric_value
126
-
end as max_value,
127
-
bucket_start as start_time,
128
-
bucket_end as end_time,
129
-
*
130
-
from anomaly_scores_with_is_anomalous
131
-
order by bucket_end, dimension_value
132
-
)
91
+
select*from final_results
92
+
where {{ test_configuration.exclude_final_results }}
0 commit comments