github.com/thanos-io/thanos@v0.32.5/pkg/query/testdata/promql/prometheus/selectors.test (about)

     1  load 10s
     2  	http_requests{job="api-server", instance="0", group="production"}	0+10x1000 100+30x1000
     3  	http_requests{job="api-server", instance="1", group="production"}	0+20x1000 200+30x1000
     4  	http_requests{job="api-server", instance="0", group="canary"}		0+30x1000 300+80x1000
     5  	http_requests{job="api-server", instance="1", group="canary"}		0+40x2000
     6  
     7  eval instant at 8000s rate(http_requests[1m])
     8  	{job="api-server", instance="0", group="production"} 1
     9  	{job="api-server", instance="1", group="production"} 2
    10  	{job="api-server", instance="0", group="canary"} 3
    11  	{job="api-server", instance="1", group="canary"} 4
    12  
    13  eval instant at 18000s rate(http_requests[1m])
    14  	{job="api-server", instance="0", group="production"} 3
    15  	{job="api-server", instance="1", group="production"} 3
    16  	{job="api-server", instance="0", group="canary"} 8
    17  	{job="api-server", instance="1", group="canary"} 4
    18  
    19  eval instant at 8000s rate(http_requests{group=~"pro.*"}[1m])
    20  	{job="api-server", instance="0", group="production"} 1
    21  	{job="api-server", instance="1", group="production"} 2
    22  
    23  eval instant at 18000s rate(http_requests{group=~".*ry", instance="1"}[1m])
    24  	{job="api-server", instance="1", group="canary"} 4
    25  
    26  eval instant at 18000s rate(http_requests{instance!="3"}[1m] offset 10000s)
    27  	{job="api-server", instance="0", group="production"} 1
    28  	{job="api-server", instance="1", group="production"} 2
    29  	{job="api-server", instance="0", group="canary"} 3
    30  	{job="api-server", instance="1", group="canary"} 4
    31  
    32  eval instant at 18000s rate(http_requests[40s]) - rate(http_requests[1m] offset 10000s)
    33  	{job="api-server", instance="0", group="production"} 2
    34  	{job="api-server", instance="1", group="production"} 1
    35  	{job="api-server", instance="0", group="canary"} 5
    36  	{job="api-server", instance="1", group="canary"} 0
    37  
    38  # https://github.com/prometheus/prometheus/issues/3575
    39  eval instant at 0s http_requests{foo!="bar"}
    40  	http_requests{job="api-server", instance="0", group="production"} 0
    41  	http_requests{job="api-server", instance="1", group="production"} 0
    42  	http_requests{job="api-server", instance="0", group="canary"} 0
    43  	http_requests{job="api-server", instance="1", group="canary"} 0
    44  
    45  eval instant at 0s http_requests{foo!="bar", job="api-server"}
    46  	http_requests{job="api-server", instance="0", group="production"} 0
    47  	http_requests{job="api-server", instance="1", group="production"} 0
    48  	http_requests{job="api-server", instance="0", group="canary"} 0
    49  	http_requests{job="api-server", instance="1", group="canary"} 0
    50  
    51  eval instant at 0s http_requests{foo!~"bar", job="api-server"}
    52  	http_requests{job="api-server", instance="0", group="production"} 0
    53  	http_requests{job="api-server", instance="1", group="production"} 0
    54  	http_requests{job="api-server", instance="0", group="canary"} 0
    55  	http_requests{job="api-server", instance="1", group="canary"} 0
    56  
    57  eval instant at 0s http_requests{foo!~"bar", job="api-server", instance="1", x!="y", z="", group!=""}
    58  	http_requests{job="api-server", instance="1", group="production"} 0
    59  	http_requests{job="api-server", instance="1", group="canary"} 0
    60  
    61  # https://github.com/prometheus/prometheus/issues/7994
    62  eval instant at 8000s rate(http_requests{group=~"(?i:PRO).*"}[1m])
    63  	{job="api-server", instance="0", group="production"} 1
    64  	{job="api-server", instance="1", group="production"} 2
    65  
    66  eval instant at 8000s rate(http_requests{group=~".*?(?i:PRO).*"}[1m])
    67  	{job="api-server", instance="0", group="production"} 1
    68  	{job="api-server", instance="1", group="production"} 2
    69  
    70  eval instant at 8000s rate(http_requests{group=~".*(?i:DUC).*"}[1m])
    71  	{job="api-server", instance="0", group="production"} 1
    72  	{job="api-server", instance="1", group="production"} 2
    73  
    74  eval instant at 8000s rate(http_requests{group=~".*(?i:TION)"}[1m])
    75  	{job="api-server", instance="0", group="production"} 1
    76  	{job="api-server", instance="1", group="production"} 2
    77  
    78  eval instant at 8000s rate(http_requests{group=~".*(?i:TION).*?"}[1m])
    79  	{job="api-server", instance="0", group="production"} 1
    80  	{job="api-server", instance="1", group="production"} 2
    81  
    82  
    83  eval instant at 8000s rate(http_requests{group=~"((?i)PRO).*"}[1m])
    84  	{job="api-server", instance="0", group="production"} 1
    85  	{job="api-server", instance="1", group="production"} 2
    86  
    87  eval instant at 8000s rate(http_requests{group=~".*((?i)DUC).*"}[1m])
    88  	{job="api-server", instance="0", group="production"} 1
    89  	{job="api-server", instance="1", group="production"} 2
    90  
    91  eval instant at 8000s rate(http_requests{group=~".*((?i)TION)"}[1m])
    92  	{job="api-server", instance="0", group="production"} 1
    93  	{job="api-server", instance="1", group="production"} 2
    94  
    95  
    96  eval instant at 8000s rate(http_requests{group=~"(?i:PRODUCTION)"}[1m])
    97  	{job="api-server", instance="0", group="production"} 1
    98  	{job="api-server", instance="1", group="production"} 2
    99  
   100  eval instant at 8000s rate(http_requests{group=~".*(?i:C).*"}[1m])
   101  	{job="api-server", instance="0", group="production"} 1
   102  	{job="api-server", instance="1", group="production"} 2
   103  	{job="api-server", instance="0", group="canary"} 3
   104  	{job="api-server", instance="1", group="canary"} 4
   105  
   106  clear
   107  load 1m
   108      metric1{a="a"} 0+1x100
   109      metric2{b="b"} 0+1x50
   110  
   111  eval instant at 90m metric1 offset 15m or metric2 offset 45m
   112      metric1{a="a"} 75
   113      metric2{b="b"} 45
   114  
   115  clear
   116  
   117  load 5m
   118  	x{y="testvalue"} 0+10x10
   119  
   120  load 5m
   121  	cpu_count{instance="0", type="numa"}	0+30x10
   122  	cpu_count{instance="0", type="smp"} 	0+10x20
   123  	cpu_count{instance="1", type="smp"} 	0+20x10
   124  
   125  load 5m
   126  	label_grouping_test{a="aa", b="bb"}	0+10x10
   127  	label_grouping_test{a="a", b="abb"}	0+20x10
   128  
   129  load 5m
   130  	http_requests{job="api-server", instance="0", group="production"}	0+10x10
   131  	http_requests{job="api-server", instance="1", group="production"}	0+20x10
   132  	http_requests{job="api-server", instance="0", group="canary"}		0+30x10
   133  	http_requests{job="api-server", instance="1", group="canary"}		0+40x10
   134  	http_requests{job="app-server", instance="0", group="production"}	0+50x10
   135  	http_requests{job="app-server", instance="1", group="production"}	0+60x10
   136  	http_requests{job="app-server", instance="0", group="canary"}		0+70x10
   137  	http_requests{job="app-server", instance="1", group="canary"}		0+80x10
   138  
   139  # Single-letter label names and values.
   140  eval instant at 50m x{y="testvalue"}
   141  	x{y="testvalue"} 100
   142  
   143  # Basic Regex
   144  eval instant at 50m {__name__=~".+"}
   145  	http_requests{group="canary", instance="0", job="api-server"} 300
   146  	http_requests{group="canary", instance="0", job="app-server"} 700
   147  	http_requests{group="canary", instance="1", job="api-server"} 400
   148  	http_requests{group="canary", instance="1", job="app-server"} 800
   149  	http_requests{group="production", instance="0", job="api-server"} 100
   150  	http_requests{group="production", instance="0", job="app-server"} 500
   151  	http_requests{group="production", instance="1", job="api-server"} 200
   152  	http_requests{group="production", instance="1", job="app-server"} 600
   153  	x{y="testvalue"} 100
   154  	label_grouping_test{a="a", b="abb"} 200
   155  	label_grouping_test{a="aa", b="bb"} 100
   156  	cpu_count{instance="1", type="smp"} 200
   157  	cpu_count{instance="0", type="smp"} 100
   158  	cpu_count{instance="0", type="numa"} 300
   159  
   160  eval instant at 50m {job=~".+-server", job!~"api-.+"}
   161  	http_requests{group="canary", instance="0", job="app-server"} 700
   162  	http_requests{group="canary", instance="1", job="app-server"} 800
   163  	http_requests{group="production", instance="0", job="app-server"} 500
   164  	http_requests{group="production", instance="1", job="app-server"} 600
   165  
   166  eval instant at 50m http_requests{group!="canary"}
   167  	http_requests{group="production", instance="1", job="app-server"} 600
   168  	http_requests{group="production", instance="0", job="app-server"} 500
   169  	http_requests{group="production", instance="1", job="api-server"} 200
   170  	http_requests{group="production", instance="0", job="api-server"} 100
   171  
   172  eval instant at 50m http_requests{job=~".+-server",group!="canary"}
   173  	http_requests{group="production", instance="1", job="app-server"} 600
   174  	http_requests{group="production", instance="0", job="app-server"} 500
   175  	http_requests{group="production", instance="1", job="api-server"} 200
   176  	http_requests{group="production", instance="0", job="api-server"} 100
   177  
   178  eval instant at 50m http_requests{job!~"api-.+",group!="canary"}
   179  	http_requests{group="production", instance="1", job="app-server"} 600
   180  	http_requests{group="production", instance="0", job="app-server"} 500
   181  
   182  eval instant at 50m http_requests{group="production",job=~"api-.+"}
   183  	http_requests{group="production", instance="0", job="api-server"} 100
   184  	http_requests{group="production", instance="1", job="api-server"} 200
   185  
   186  eval instant at 50m http_requests{group="production",job="api-server"} offset 5m
   187  	http_requests{group="production", instance="0", job="api-server"} 90
   188  	http_requests{group="production", instance="1", job="api-server"} 180
   189  
   190  clear
   191  
   192  # Matrix tests.
   193  load 1h
   194  	testmetric{aa="bb"} 1
   195  	testmetric{a="abb"} 2
   196  
   197  eval instant at 0h testmetric
   198  	testmetric{aa="bb"} 1
   199  	testmetric{a="abb"} 2
   200  
   201  clear