-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathqueries.libsonnet
186 lines (184 loc) · 8.99 KB
/
queries.libsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
local utils = import 'mixin-utils/utils.libsonnet';
(import 'dashboard-utils.libsonnet') {
'cortex-queries.json':
$.dashboard('Cortex / Queries')
.addClusterSelectorTemplates()
.addRow(
$.row('Query Frontend')
.addPanel(
$.panel('Queue Duration') +
$.latencyPanel('cortex_query_frontend_queue_duration_seconds', '{%s}' % $.jobMatcher('query-frontend')),
)
.addPanel(
$.panel('Retries') +
$.latencyPanel('cortex_query_frontend_retries', '{%s}' % $.jobMatcher('query-frontend'), multiplier=1) +
{ yaxes: $.yaxes('short') },
)
.addPanel(
$.panel('Queue Length') +
$.queryPanel('cortex_query_frontend_queue_length{%s}' % $.jobMatcher('query-frontend'), '{{cluster}} / {{namespace}} / {{instance}}'),
)
)
.addRow(
$.row('Query Frontend - Results Cache')
.addPanel(
$.panel('Cache Hit %') +
$.queryPanel('sum(rate(cortex_cache_hits{%s}[1m])) / sum(rate(cortex_cache_fetched_keys{%s}[1m]))' % [$.jobMatcher('query-frontend'), $.jobMatcher('query-frontend')], 'Hit Rate') +
{ yaxes: $.yaxes({ format: 'percentunit', max: 1 }) },
)
.addPanel(
$.panel('Cache misses') +
$.queryPanel('sum(rate(cortex_cache_fetched_keys{%s}[1m])) - sum(rate(cortex_cache_hits{%s}[1m]))' % [$.jobMatcher('query-frontend'), $.jobMatcher('query-frontend')], 'Miss Rate'),
)
)
.addRow(
$.row('Query Frontend - Sharding/Splitting')
.addPanel(
$.panel('Intervals per Query') +
$.queryPanel('sum(rate(cortex_frontend_split_queries_total{%s}[1m])) / sum(rate(cortex_frontend_query_range_duration_seconds_count{%s, method="split_by_interval"}[1m]))' % [$.jobMatcher('query-frontend'), $.jobMatcher('query-frontend')], 'partition rate'),
)
.addPanel(
$.panel('Sharded Queries %') +
$.queryPanel('sum(rate(cortex_frontend_mapped_asts_total{%s}[1m])) / sum(rate(cortex_frontend_split_queries_total{%s}[1m])) * 100' % [$.jobMatcher('query-frontend'), $.jobMatcher('query-frontend')], 'shard rate'),
)
.addPanel(
$.panel('Sharding factor') +
$.queryPanel('sum(rate(cortex_frontend_sharded_queries_total{%s}[1m])) / sum(rate(cortex_frontend_mapped_asts_total{%s}[1m]))' % [$.jobMatcher('query-frontend'), $.jobMatcher('query-frontend')], 'Average'),
)
)
.addRow(
$.row('Querier')
.addPanel(
$.panel('Stages') +
$.queryPanel('max by (slice) (prometheus_engine_query_duration_seconds{quantile="0.9",%s}) * 1e3' % $.jobMatcher('querier'), '{{slice}}') +
{ yaxes: $.yaxes('ms') } +
$.stack,
)
.addPanel(
$.panel('Chunk cache misses') +
$.queryPanel('sum(rate(cortex_cache_fetched_keys{%s,name="chunksmemcache"}[1m])) - sum(rate(cortex_cache_hits{%s,name="chunksmemcache"}[1m]))' % [$.jobMatcher('querier'), $.jobMatcher('querier')], 'Hit rate'),
)
.addPanel(
$.panel('Chunk cache corruptions') +
$.queryPanel('sum(rate(cortex_cache_corrupt_chunks_total{%s}[1m]))' % $.jobMatcher('querier'), 'Corrupt chunks'),
)
)
.addRowIf(
std.setMember('chunks', $._config.storage_engine),
$.row('Querier - Chunks storage - Index Cache')
.addPanel(
$.panel('Total entries') +
$.queryPanel('sum(querier_cache_added_new_total{cache="store.index-cache-read.fifocache",%s}) - sum(querier_cache_evicted_total{cache="store.index-cache-read.fifocache",%s})' % [$.jobMatcher('querier'), $.jobMatcher('querier')], 'Entries'),
)
.addPanel(
$.panel('Cache Hit %') +
$.queryPanel('(sum(rate(querier_cache_gets_total{cache="store.index-cache-read.fifocache",%s}[1m])) - sum(rate(querier_cache_misses_total{cache="store.index-cache-read.fifocache",%s}[1m]))) / sum(rate(querier_cache_gets_total{cache="store.index-cache-read.fifocache",%s}[1m]))' % [$.jobMatcher('querier'), $.jobMatcher('querier'), $.jobMatcher('querier')], 'hit rate')
{ yaxes: $.yaxes({ format: 'percentunit', max: 1 }) },
)
.addPanel(
$.panel('Churn Rate') +
$.queryPanel('sum(rate(querier_cache_evicted_total{cache="store.index-cache-read.fifocache",%s}[1m]))' % $.jobMatcher('querier'), 'churn rate'),
)
)
.addRow(
$.row('Ingester')
.addPanel(
$.panel('Series per Query') +
utils.latencyRecordingRulePanel('cortex_ingester_queried_series', $.jobSelector('ingester'), multiplier=1) +
{ yaxes: $.yaxes('short') },
)
.addPanel(
$.panel('Chunks per Query') +
utils.latencyRecordingRulePanel('cortex_ingester_queried_chunks', $.jobSelector('ingester'), multiplier=1) +
{ yaxes: $.yaxes('short') },
)
.addPanel(
$.panel('Samples per Query') +
utils.latencyRecordingRulePanel('cortex_ingester_queried_samples', $.jobSelector('ingester'), multiplier=1) +
{ yaxes: $.yaxes('short') },
)
)
.addRowIf(
std.setMember('chunks', $._config.storage_engine),
$.row('Querier - Chunks storage - Store')
.addPanel(
$.panel('Index Lookups per Query') +
utils.latencyRecordingRulePanel('cortex_chunk_store_index_lookups_per_query', $.jobSelector('querier'), multiplier=1) +
{ yaxes: $.yaxes('short') },
)
.addPanel(
$.panel('Series (pre-intersection) per Query') +
utils.latencyRecordingRulePanel('cortex_chunk_store_series_pre_intersection_per_query', $.jobSelector('querier'), multiplier=1) +
{ yaxes: $.yaxes('short') },
)
.addPanel(
$.panel('Series (post-intersection) per Query') +
utils.latencyRecordingRulePanel('cortex_chunk_store_series_post_intersection_per_query', $.jobSelector('querier'), multiplier=1) +
{ yaxes: $.yaxes('short') },
)
.addPanel(
$.panel('Chunks per Query') +
utils.latencyRecordingRulePanel('cortex_chunk_store_chunks_per_query', $.jobSelector('querier'), multiplier=1) +
{ yaxes: $.yaxes('short') },
)
)
.addRowIf(
std.setMember('tsdb', $._config.storage_engine),
$.row('Store-gateway - Blocks')
.addPanel(
$.panel('Blocks queried / sec') +
$.queryPanel('sum(rate(cortex_storegateway_bucket_store_series_blocks_queried_sum{%s}[$__interval]))' % $.jobMatcher('store-gateway'), 'blocks') +
{ yaxes: $.yaxes('ops') },
)
.addPanel(
$.panel('Data fetched / sec') +
$.queryPanel('sum by(data_type) (rate(cortex_storegateway_bucket_store_series_data_fetched_sum{%s}[$__interval]))' % $.jobMatcher('store-gateway'), '{{data_type}}') +
$.stack +
{ yaxes: $.yaxes('ops') },
)
.addPanel(
$.panel('Data touched / sec') +
$.queryPanel('sum by(data_type) (rate(cortex_storegateway_bucket_store_series_data_touched_sum{%s}[$__interval]))' % $.jobMatcher('store-gateway'), '{{data_type}}') +
$.stack +
{ yaxes: $.yaxes('ops') },
)
)
.addRowIf(
std.setMember('tsdb', $._config.storage_engine),
$.row('')
.addPanel(
$.panel('Series fetch duration (per request)') +
$.latencyPanel('cortex_storegateway_bucket_store_series_get_all_duration_seconds', '{%s}' % $.jobMatcher('store-gateway')),
)
.addPanel(
$.panel('Series merge duration (per request)') +
$.latencyPanel('cortex_storegateway_bucket_store_series_merge_duration_seconds', '{%s}' % $.jobMatcher('store-gateway')),
)
.addPanel(
$.panel('Series returned (per request)') +
$.queryPanel('sum(rate(cortex_storegateway_bucket_store_series_result_series_sum{%s}[$__interval])) / sum(rate(cortex_storegateway_bucket_store_series_result_series_count{%s}[$__interval]))' % [$.jobMatcher('store-gateway'), $.jobMatcher('store-gateway')], 'avg series returned'),
)
)
.addRowIf(
std.setMember('tsdb', $._config.storage_engine),
$.row('')
.addPanel(
$.panel('Blocks currently loaded') +
$.queryPanel('cortex_storegateway_bucket_store_blocks_loaded{%s}' % $.jobMatcher('store-gateway'), '{{instance}}')
)
.addPanel(
$.successFailurePanel(
'Blocks loaded / sec',
'sum(rate(cortex_storegateway_bucket_store_block_loads_total{%s}[$__interval])) - sum(rate(cortex_storegateway_bucket_store_block_load_failures_total{%s}[$__interval]))' % [$.jobMatcher('store-gateway'), $.jobMatcher('store-gateway')],
'sum(rate(cortex_storegateway_bucket_store_block_load_failures_total{%s}[$__interval]))' % $.jobMatcher('store-gateway'),
)
)
.addPanel(
$.successFailurePanel(
'Blocks dropped / sec',
'sum(rate(cortex_storegateway_bucket_store_block_drops_total{%s}[$__interval])) - sum(rate(cortex_storegateway_bucket_store_block_drop_failures_total{%s}[$__interval]))' % [$.jobMatcher('store-gateway'), $.jobMatcher('store-gateway')],
'sum(rate(cortex_storegateway_bucket_store_block_drop_failures_total{%s}[$__interval]))' % $.jobMatcher('store-gateway'),
)
)
),
}