github.com/m3db/m3@v1.5.0/src/query/test/compatibility/testdata/legacy.test (about)

     1  load 5m
     2  	http_requests{job="api-server", instance="0", group="production"}	0+10x10
     3  	http_requests{job="api-server", instance="1", group="production"}	0+20x10
     4  	http_requests{job="api-server", instance="0", group="canary"}		0+30x10
     5  	http_requests{job="api-server", instance="1", group="canary"}		0+40x10
     6  	http_requests{job="app-server", instance="0", group="production"}	0+50x10
     7  	http_requests{job="app-server", instance="1", group="production"}	0+60x10
     8  	http_requests{job="app-server", instance="0", group="canary"}		0+70x10
     9  	http_requests{job="app-server", instance="1", group="canary"}		0+80x10
    10  
    11  load 5m
    12  	x{y="testvalue"} 0+10x10
    13  
    14  load 5m
    15  	testcounter_reset_middle	0+10x4 0+10x5
    16  	testcounter_reset_end    	0+10x9 0 10
    17  
    18  load 4m
    19  	testcounter_zero_cutoff{start="0m"}	0+240x10
    20  	testcounter_zero_cutoff{start="1m"}	60+240x10
    21  	testcounter_zero_cutoff{start="2m"}	120+240x10
    22  	testcounter_zero_cutoff{start="3m"}	180+240x10
    23  	testcounter_zero_cutoff{start="4m"}	240+240x10
    24  	testcounter_zero_cutoff{start="5m"}	300+240x10
    25  
    26  load 5m
    27  	label_grouping_test{a="aa", b="bb"}	0+10x10
    28  	label_grouping_test{a="a", b="abb"}	0+20x10
    29  
    30  load 5m
    31  	vector_matching_a{l="x"} 0+1x100
    32  	vector_matching_a{l="y"} 0+2x50
    33  	vector_matching_b{l="x"} 0+4x25
    34  
    35  load 5m
    36  	cpu_count{instance="0", type="numa"}	0+30x10
    37  	cpu_count{instance="0", type="smp"} 	0+10x20
    38  	cpu_count{instance="1", type="smp"} 	0+20x10
    39  
    40  
    41  eval instant at 50m SUM(http_requests)
    42  	{} 3600
    43  
    44  eval instant at 50m SUM(http_requests{instance="0"}) BY(job)
    45  	{job="api-server"} 400
    46  	{job="app-server"} 1200
    47  
    48  eval instant at 50m SUM(http_requests) BY (job)
    49  	{job="api-server"} 1000
    50  	{job="app-server"} 2600
    51  
    52  # Non-existent labels mentioned in BY-clauses shouldn't propagate to output.
    53  eval instant at 50m SUM(http_requests) BY (job, nonexistent)
    54  	{job="api-server"} 1000
    55  	{job="app-server"} 2600
    56  
    57  
    58  eval instant at 50m COUNT(http_requests) BY (job)
    59  	{job="api-server"} 4
    60  	{job="app-server"} 4
    61  
    62  
    63  eval instant at 50m SUM(http_requests) BY (job, group)
    64  	{group="canary", job="api-server"} 700
    65  	{group="canary", job="app-server"} 1500
    66  	{group="production", job="api-server"} 300
    67  	{group="production", job="app-server"} 1100
    68  
    69  
    70  eval instant at 50m AVG(http_requests) BY (job)
    71  	{job="api-server"} 250
    72  	{job="app-server"} 650
    73  
    74  
    75  eval instant at 50m MIN(http_requests) BY (job)
    76  	{job="api-server"} 100
    77  	{job="app-server"} 500
    78  
    79  
    80  eval instant at 50m MAX(http_requests) BY (job)
    81  	{job="api-server"} 400
    82  	{job="app-server"} 800
    83  
    84  
    85  # Single-letter label names and values.
    86  eval instant at 50m x{y="testvalue"}
    87  	x{y="testvalue"} 100
    88  
    89  
    90  # Rates should calculate per-second rates.
    91  eval instant at 50m rate(http_requests{group="canary", instance="1", job="app-server"}[50m])
    92  	{group="canary", instance="1", job="app-server"} 0.26666666666666666
    93  
    94  
    95  # Counter resets at in the middle of range are handled correctly by rate().
    96  eval instant at 50m rate(testcounter_reset_middle[50m])
    97  	{} 0.03
    98  
    99  
   100  # Counter resets at end of range are ignored by rate().
   101  eval instant at 50m rate(testcounter_reset_end[5m])
   102  	{} 0
   103  
   104  
   105  # Zero cutoff for left-side extrapolation.
   106  eval instant at 10m rate(testcounter_zero_cutoff[20m])
   107  	{start="0m"} 0.5
   108  	{start="1m"} 0.55
   109  	{start="2m"} 0.6
   110  	{start="3m"} 0.65
   111  	{start="4m"} 0.7
   112  	{start="5m"} 0.6
   113  
   114  # Normal half-interval cutoff for left-side extrapolation.
   115  eval instant at 50m rate(testcounter_zero_cutoff[20m])
   116  	{start="0m"} 0.6
   117  	{start="1m"} 0.6
   118  	{start="2m"} 0.6
   119  	{start="3m"} 0.6
   120  	{start="4m"} 0.6
   121  	{start="5m"} 0.6
   122  
   123  
   124  eval instant at 50m http_requests{group!="canary"}
   125  	http_requests{group="production", instance="1", job="app-server"} 600
   126  	http_requests{group="production", instance="0", job="app-server"} 500
   127  	http_requests{group="production", instance="1", job="api-server"} 200
   128  	http_requests{group="production", instance="0", job="api-server"} 100
   129  
   130  eval instant at 50m http_requests{job=~".+-server",group!="canary"}
   131  	http_requests{group="production", instance="1", job="app-server"} 600
   132  	http_requests{group="production", instance="0", job="app-server"} 500
   133  	http_requests{group="production", instance="1", job="api-server"} 200
   134  	http_requests{group="production", instance="0", job="api-server"} 100
   135  
   136  eval instant at 50m http_requests{job!~"api-.+",group!="canary"}
   137  	http_requests{group="production", instance="1", job="app-server"} 600
   138  	http_requests{group="production", instance="0", job="app-server"} 500
   139  
   140  eval instant at 50m http_requests{group="production",job=~"api-.+"}
   141  	http_requests{group="production", instance="0", job="api-server"} 100
   142  	http_requests{group="production", instance="1", job="api-server"} 200
   143  
   144  eval instant at 50m abs(-1 * http_requests{group="production",job="api-server"})
   145  	{group="production", instance="0", job="api-server"} 100
   146  	{group="production", instance="1", job="api-server"} 200
   147  
   148  eval instant at 50m floor(0.004 * http_requests{group="production",job="api-server"})
   149  	{group="production", instance="0", job="api-server"} 0
   150  	{group="production", instance="1", job="api-server"} 0
   151  
   152  eval instant at 50m ceil(0.004 * http_requests{group="production",job="api-server"})
   153  	{group="production", instance="0", job="api-server"} 1
   154  	{group="production", instance="1", job="api-server"} 1
   155  
   156  eval instant at 50m round(0.004 * http_requests{group="production",job="api-server"})
   157  	{group="production", instance="0", job="api-server"} 0
   158  	{group="production", instance="1", job="api-server"} 1
   159  
   160  # Round should correctly handle negative numbers.
   161  eval instant at 50m round(-1 * (0.004 * http_requests{group="production",job="api-server"}))
   162  	{group="production", instance="0", job="api-server"} 0
   163  	{group="production", instance="1", job="api-server"} -1
   164  
   165  # Round should round half up.
   166  eval instant at 50m round(0.005 * http_requests{group="production",job="api-server"})
   167  	{group="production", instance="0", job="api-server"} 1
   168  	{group="production", instance="1", job="api-server"} 1
   169  
   170  eval instant at 50m round(-1 * (0.005 * http_requests{group="production",job="api-server"}))
   171  	{group="production", instance="0", job="api-server"} 0
   172  	{group="production", instance="1", job="api-server"} -1
   173  
   174  eval instant at 50m round(1 + 0.005 * http_requests{group="production",job="api-server"})
   175  	{group="production", instance="0", job="api-server"} 2
   176  	{group="production", instance="1", job="api-server"} 2
   177  
   178  eval instant at 50m round(-1 * (1 + 0.005 * http_requests{group="production",job="api-server"}))
   179  	{group="production", instance="0", job="api-server"} -1
   180  	{group="production", instance="1", job="api-server"} -2
   181  
   182  # Round should accept the number to round nearest to.
   183  eval instant at 50m round(0.0005 * http_requests{group="production",job="api-server"}, 0.1)
   184  	{group="production", instance="0", job="api-server"} 0.1
   185  	{group="production", instance="1", job="api-server"} 0.1
   186  
   187  eval instant at 50m round(2.1 + 0.0005 * http_requests{group="production",job="api-server"}, 0.1)
   188  	{group="production", instance="0", job="api-server"} 2.2
   189  	{group="production", instance="1", job="api-server"} 2.2
   190  
   191  eval instant at 50m round(5.2 + 0.0005 * http_requests{group="production",job="api-server"}, 0.1)
   192  	{group="production", instance="0", job="api-server"} 5.3
   193  	{group="production", instance="1", job="api-server"} 5.3
   194  
   195  # Round should work correctly with negative numbers and multiple decimal places.
   196  eval instant at 50m round(-1 * (5.2 + 0.0005 * http_requests{group="production",job="api-server"}), 0.1)
   197  	{group="production", instance="0", job="api-server"} -5.2
   198  	{group="production", instance="1", job="api-server"} -5.3
   199  
   200  # Round should work correctly with big toNearests.
   201  eval instant at 50m round(0.025 * http_requests{group="production",job="api-server"}, 5)
   202  	{group="production", instance="0", job="api-server"} 5
   203  	{group="production", instance="1", job="api-server"} 5
   204  
   205  eval instant at 50m round(0.045 * http_requests{group="production",job="api-server"}, 5)
   206  	{group="production", instance="0", job="api-server"} 5
   207  	{group="production", instance="1", job="api-server"} 10
   208  
   209  eval instant at 50m avg_over_time(http_requests{group="production",job="api-server"}[1h])
   210  	{group="production", instance="0", job="api-server"} 50
   211  	{group="production", instance="1", job="api-server"} 100
   212  
   213  eval instant at 50m count_over_time(http_requests{group="production",job="api-server"}[1h])
   214  	{group="production", instance="0", job="api-server"} 11
   215  	{group="production", instance="1", job="api-server"} 11
   216  
   217  eval instant at 50m max_over_time(http_requests{group="production",job="api-server"}[1h])
   218  	{group="production", instance="0", job="api-server"} 100
   219  	{group="production", instance="1", job="api-server"} 200
   220  
   221  eval instant at 50m min_over_time(http_requests{group="production",job="api-server"}[1h])
   222  	{group="production", instance="0", job="api-server"} 0
   223  	{group="production", instance="1", job="api-server"} 0
   224  
   225  eval instant at 50m sum_over_time(http_requests{group="production",job="api-server"}[1h])
   226  	{group="production", instance="0", job="api-server"} 550
   227  	{group="production", instance="1", job="api-server"} 1100
   228  
   229  # FAILING. eval instant at 50m time()
   230  #	3000
   231  
   232  eval instant at 50m {__name__=~".+"}
   233  	http_requests{group="canary", instance="0", job="api-server"} 300
   234  	http_requests{group="canary", instance="0", job="app-server"} 700
   235  	http_requests{group="canary", instance="1", job="api-server"} 400
   236  	http_requests{group="canary", instance="1", job="app-server"} 800
   237  	http_requests{group="production", instance="0", job="api-server"} 100
   238  	http_requests{group="production", instance="0", job="app-server"} 500
   239  	http_requests{group="production", instance="1", job="api-server"} 200
   240  	http_requests{group="production", instance="1", job="app-server"} 600
   241  	testcounter_reset_end 0
   242  	testcounter_reset_middle 50
   243  	x{y="testvalue"} 100
   244  	label_grouping_test{a="a", b="abb"} 200
   245  	label_grouping_test{a="aa", b="bb"} 100
   246  	vector_matching_a{l="x"} 10
   247  	vector_matching_a{l="y"} 20
   248  	vector_matching_b{l="x"} 40
   249  	cpu_count{instance="1", type="smp"} 200
   250  	cpu_count{instance="0", type="smp"} 100
   251  	cpu_count{instance="0", type="numa"} 300
   252  
   253  
   254  eval instant at 50m {job=~".+-server", job!~"api-.+"}
   255  	http_requests{group="canary", instance="0", job="app-server"} 700
   256  	http_requests{group="canary", instance="1", job="app-server"} 800
   257  	http_requests{group="production", instance="0", job="app-server"} 500
   258  	http_requests{group="production", instance="1", job="app-server"} 600
   259  
   260  # eval instant at 50m absent(nonexistent)
   261  #	{} 1
   262  
   263  # FAILING issue #52. eval instant at 50m absent(nonexistent{job="testjob", instance="testinstance", method=~".x"})
   264  #	{instance="testinstance", job="testjob"} 1
   265  
   266  # FAILING issue #52. eval instant at 50m absent(nonexistent{job="testjob",job="testjob2",foo="bar"})
   267  #	{foo="bar"} 1
   268  
   269  # FAILING issue #52. eval instant at 50m absent(nonexistent{job="testjob",job="testjob2",job="three",foo="bar"})
   270  #	{foo="bar"} 1
   271  
   272  # FAILING issue #52. eval instant at 50m absent(nonexistent{job="testjob",job=~"testjob2",foo="bar"})
   273  #	{foo="bar"} 1
   274  
   275  eval instant at 50m absent(http_requests)
   276  
   277  eval instant at 50m absent(sum(http_requests))
   278  
   279  # FAILING issue #52. eval instant at 50m absent(sum(nonexistent{job="testjob", instance="testinstance"}))
   280  #	{} 1
   281  
   282  # FAILING issue #52. eval instant at 50m absent(max(nonexistant))
   283  #	{} 1
   284  
   285  # FAILING issue #52. eval instant at 50m absent(nonexistant > 1)
   286  #	{} 1
   287  
   288  # FAILING issue #52. eval instant at 50m absent(a + b)
   289  #	{} 1
   290  
   291  # FAILING issue #52. eval instant at 50m absent(a and b)
   292  #	{} 1
   293  
   294  # FAILING issue #52. eval instant at 50m absent(rate(nonexistant[5m]))
   295  #	{} 1
   296  
   297  eval instant at 50m http_requests{group="production",job="api-server"} offset 5m
   298  	http_requests{group="production", instance="0", job="api-server"} 90
   299  	http_requests{group="production", instance="1", job="api-server"} 180
   300  
   301  eval instant at 50m rate(http_requests{group="production",job="api-server"}[10m] offset 5m)
   302  	{group="production", instance="0", job="api-server"} 0.03333333333333333
   303  	{group="production", instance="1", job="api-server"} 0.06666666666666667
   304  
   305  eval instant at 50m http_requests{group="canary", instance="0", job="api-server"} / 0
   306  	{group="canary", instance="0", job="api-server"} +Inf
   307  
   308  eval instant at 50m -1 * http_requests{group="canary", instance="0", job="api-server"} / 0
   309  	{group="canary", instance="0", job="api-server"} -Inf
   310  
   311  # Failing with keepNaN feature. eval instant at 50m 0 * http_requests{group="canary", instance="0", job="api-server"} / 0
   312  #	{group="canary", instance="0", job="api-server"} NaN
   313  
   314  # Failing with keepNaN feature. eval instant at 50m 0 * http_requests{group="canary", instance="0", job="api-server"} % 0
   315  #	{group="canary", instance="0", job="api-server"} NaN
   316  
   317  # FAILING issue #53. eval instant at 50m exp(vector_matching_a)
   318  #	{l="x"} 22026.465794806718
   319  #	{l="y"} 485165195.4097903
   320  
   321  eval instant at 50m exp(vector_matching_a - 10)
   322  	{l="y"} 22026.465794806718
   323  	{l="x"} 1
   324  
   325  eval instant at 50m exp(vector_matching_a - 20)
   326  	{l="x"} 4.5399929762484854e-05
   327  	{l="y"} 1
   328  
   329  # FAILING issue #53. eval instant at 50m ln(vector_matching_a)
   330  #	{l="x"} 2.302585092994046
   331  #	{l="y"} 2.995732273553991
   332  
   333  eval instant at 50m ln(vector_matching_a - 10)
   334  	{l="y"} 2.302585092994046
   335  	{l="x"} -Inf
   336  
   337  # FAILING with keepNaN feature. eval instant at 50m ln(vector_matching_a - 20)
   338  #	{l="y"} -Inf
   339  #	{l="x"} NaN
   340  
   341  # FAILING issue #53. eval instant at 50m exp(ln(vector_matching_a))
   342  #	{l="y"} 20
   343  #	{l="x"} 10
   344  
   345  # FAILING issue #53. eval instant at 50m sqrt(vector_matching_a)
   346  #	{l="x"} 3.1622776601683795
   347  #	{l="y"} 4.47213595499958
   348  
   349  # FAILING issue #53. eval instant at 50m log2(vector_matching_a)
   350  #	{l="x"} 3.3219280948873626
   351  #	{l="y"} 4.321928094887363
   352  
   353  eval instant at 50m log2(vector_matching_a - 10)
   354  	{l="y"} 3.3219280948873626
   355  	{l="x"} -Inf
   356  
   357  # FAILING with keepNaN feature. eval instant at 50m log2(vector_matching_a - 20)
   358  #	{l="x"} NaN
   359  #	{l="y"} -Inf
   360  
   361  # FAILING issue #53. eval instant at 50m log10(vector_matching_a)
   362  #	{l="x"} 1
   363  #	{l="y"} 1.301029995663981
   364  
   365  eval instant at 50m log10(vector_matching_a - 10)
   366  	{l="y"} 1
   367  	{l="x"} -Inf
   368  
   369  # FAILING with keepNaN feature. eval instant at 50m log10(vector_matching_a - 20)
   370  #	{l="x"} NaN
   371  #	{l="y"} -Inf
   372  
   373  
   374  # Matrix tests.
   375  clear
   376  
   377  load 1h
   378  	testmetric{aa="bb"} 1
   379  	testmetric{a="abb"} 2
   380  
   381  eval instant at 0h testmetric
   382  	testmetric{aa="bb"} 1
   383  	testmetric{a="abb"} 2
   384  
   385  clear
   386  
   387  # Test duplicate labelset in promql output.
   388  load 5m
   389    testmetric1{src="a",dst="b"} 0
   390    testmetric2{src="a",dst="b"} 1
   391  
   392  # FAILING. eval_fail instant at 0m ceil({__name__=~'testmetric1|testmetric2'})