From ee1b3a48e9fe426046901fa5c57de27ffaf8eb4e Mon Sep 17 00:00:00 2001 From: Haleygo Date: Mon, 24 Jul 2023 21:40:14 +0800 Subject: [PATCH] vmalert: unittest support stale datapoint (#4696) * vmalert: unittest support stale datapoint * add stale ut case --- app/vmalert/README.md | 7 ++++--- docs/vmalert.md | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/vmalert/README.md b/app/vmalert/README.md index 544576d976..71e0f15df8 100644 --- a/app/vmalert/README.md +++ b/app/vmalert/README.md @@ -813,16 +813,17 @@ external_labels: series: # values support several special equations: -# 'a+bxc' becomes 'a a+b a+(2*b) a+(3*b) … a+(c*b)' +# 'a+bxc' becomes 'a a+b a+(2*b) a+(3*b) … a+(c*b)' # Read this as series starts at a, then c further samples incrementing by b. -# 'a-bxc' becomes 'a a-b a-(2*b) a-(3*b) … a-(c*b)' +# 'a-bxc' becomes 'a a-b a-(2*b) a-(3*b) … a-(c*b)' # Read this as series starts at a, then c further samples decrementing by b (or incrementing by negative b). # '_' represents a missing sample from scrape +# 'stale' indicates a stale sample # Examples: # 1. '-2+4x3' becomes '-2 2 6 10' - series starts at -2, then 3 further samples incrementing by 4. # 2. ' 1-2x4' becomes '1 -1 -3 -5 -7' - series starts at 1, then 4 further samples decrementing by 2. # 3. ' 1x4' becomes '1 1 1 1 1' - shorthand for '1+0x4', series starts at 1, then 4 further samples incrementing by 0. -# 4. ' 1 _x3' becomes '1 _ _ _ ' - the missing sample cannot increment, so 3 missing samples are produced by the '_x3' expression. +# 4. ' 1 _x3 stale' becomes '1 _ _ _ stale' - the missing sample cannot increment, so 3 missing samples are produced by the '_x3' expression. values: ``` diff --git a/docs/vmalert.md b/docs/vmalert.md index 085f3c3cb0..84d212b6d4 100644 --- a/docs/vmalert.md +++ b/docs/vmalert.md @@ -824,16 +824,17 @@ external_labels: series: # values support several special equations: -# 'a+bxc' becomes 'a a+b a+(2*b) a+(3*b) … a+(c*b)' +# 'a+bxc' becomes 'a a+b a+(2*b) a+(3*b) … a+(c*b)' # Read this as series starts at a, then c further samples incrementing by b. -# 'a-bxc' becomes 'a a-b a-(2*b) a-(3*b) … a-(c*b)' +# 'a-bxc' becomes 'a a-b a-(2*b) a-(3*b) … a-(c*b)' # Read this as series starts at a, then c further samples decrementing by b (or incrementing by negative b). # '_' represents a missing sample from scrape +# 'stale' indicates a stale sample # Examples: # 1. '-2+4x3' becomes '-2 2 6 10' - series starts at -2, then 3 further samples incrementing by 4. # 2. ' 1-2x4' becomes '1 -1 -3 -5 -7' - series starts at 1, then 4 further samples decrementing by 2. # 3. ' 1x4' becomes '1 1 1 1 1' - shorthand for '1+0x4', series starts at 1, then 4 further samples incrementing by 0. -# 4. ' 1 _x3' becomes '1 _ _ _ ' - the missing sample cannot increment, so 3 missing samples are produced by the '_x3' expression. +# 4. ' 1 _x3 stale' becomes '1 _ _ _ stale' - the missing sample cannot increment, so 3 missing samples are produced by the '_x3' expression. values: ```