blob: ae41c62552588d1642e09096f402b7b02ec5cdaf [file] [log] [blame]
Michal Kobusa16d07e2019-04-11 14:25:27 +02001import unittest
2
3from prometheus_es_exporter.indices_stats_parser import parse_response
4from tests.utils import convert_result
5
6
7# Sample responses generated by querying the endpoint on a Elasticsearch
8# server populated with the following data (http command = Httpie utility):
9# > http -v POST localhost:9200/foo/bar/1 val:=1 group1=a group2=a
10# > http -v POST localhost:9200/foo/bar/2 val:=2 group1=a group2=b
11# > http -v POST localhost:9200/foo/bar/3 val:=3 group1=b group2=b
12# Some details are instance specific, so mileage may vary!
13class Test(unittest.TestCase):
14 maxDiff = None
15
16 # Endpoint: /_stats?pretty
17 response = {
18 '_shards': {
19 'total': 10,
20 'successful': 5,
21 'failed': 0
22 },
23 '_all': {
24 'primaries': {
25 'docs': {
26 'count': 3,
27 'deleted': 0
28 },
29 'store': {
30 'size_in_bytes': 12690,
31 'throttle_time_in_millis': 0
32 },
33 'indexing': {
34 'index_total': 3,
35 'index_time_in_millis': 45,
36 'index_current': 0,
37 'index_failed': 0,
38 'delete_total': 0,
39 'delete_time_in_millis': 0,
40 'delete_current': 0,
41 'noop_update_total': 0,
42 'is_throttled': False,
43 'throttle_time_in_millis': 0
44 },
45 'get': {
46 'total': 0,
47 'time_in_millis': 0,
48 'exists_total': 0,
49 'exists_time_in_millis': 0,
50 'missing_total': 0,
51 'missing_time_in_millis': 0,
52 'current': 0
53 },
54 'search': {
55 'open_contexts': 0,
56 'query_total': 0,
57 'query_time_in_millis': 0,
58 'query_current': 0,
59 'fetch_total': 0,
60 'fetch_time_in_millis': 0,
61 'fetch_current': 0,
62 'scroll_total': 0,
63 'scroll_time_in_millis': 0,
64 'scroll_current': 0,
65 'suggest_total': 0,
66 'suggest_time_in_millis': 0,
67 'suggest_current': 0
68 },
69 'merges': {
70 'current': 0,
71 'current_docs': 0,
72 'current_size_in_bytes': 0,
73 'total': 0,
74 'total_time_in_millis': 0,
75 'total_docs': 0,
76 'total_size_in_bytes': 0,
77 'total_stopped_time_in_millis': 0,
78 'total_throttled_time_in_millis': 0,
79 'total_auto_throttle_in_bytes': 104857600
80 },
81 'refresh': {
82 'total': 3,
83 'total_time_in_millis': 107
84 },
85 'flush': {
86 'total': 0,
87 'total_time_in_millis': 0
88 },
89 'warmer': {
90 'current': 0,
91 'total': 8,
92 'total_time_in_millis': 6
93 },
94 'query_cache': {
95 'memory_size_in_bytes': 0,
96 'total_count': 0,
97 'hit_count': 0,
98 'miss_count': 0,
99 'cache_size': 0,
100 'cache_count': 0,
101 'evictions': 0
102 },
103 'fielddata': {
104 'memory_size_in_bytes': 0,
105 'evictions': 0,
106 'fields': {
107 'group1': {
108 'memory_size_in_bytes': 1024
109 },
110 'group2': {
111 'memory_size_in_bytes': 2048
112 }
113 }
114 },
115 'completion': {
116 'size_in_bytes': 0
117 },
118 'segments': {
119 'count': 3,
120 'memory_in_bytes': 7908,
121 'terms_memory_in_bytes': 5976,
122 'stored_fields_memory_in_bytes': 936,
123 'term_vectors_memory_in_bytes': 0,
124 'norms_memory_in_bytes': 576,
125 'points_memory_in_bytes': 144,
126 'doc_values_memory_in_bytes': 276,
127 'index_writer_memory_in_bytes': 0,
128 'version_map_memory_in_bytes': 0,
129 'fixed_bit_set_memory_in_bytes': 0,
130 'max_unsafe_auto_id_timestamp': -1,
131 'file_sizes': {}
132 },
133 'translog': {
134 'operations': 3,
135 'size_in_bytes': 491
136 },
137 'request_cache': {
138 'memory_size_in_bytes': 0,
139 'evictions': 0,
140 'hit_count': 0,
141 'miss_count': 0
142 },
143 'recovery': {
144 'current_as_source': 0,
145 'current_as_target': 0,
146 'throttle_time_in_millis': 0
147 }
148 },
149 'total': {
150 'docs': {
151 'count': 3,
152 'deleted': 0
153 },
154 'store': {
155 'size_in_bytes': 12690,
156 'throttle_time_in_millis': 0
157 },
158 'indexing': {
159 'index_total': 3,
160 'index_time_in_millis': 45,
161 'index_current': 0,
162 'index_failed': 0,
163 'delete_total': 0,
164 'delete_time_in_millis': 0,
165 'delete_current': 0,
166 'noop_update_total': 0,
167 'is_throttled': False,
168 'throttle_time_in_millis': 0
169 },
170 'get': {
171 'total': 0,
172 'time_in_millis': 0,
173 'exists_total': 0,
174 'exists_time_in_millis': 0,
175 'missing_total': 0,
176 'missing_time_in_millis': 0,
177 'current': 0
178 },
179 'search': {
180 'open_contexts': 0,
181 'query_total': 0,
182 'query_time_in_millis': 0,
183 'query_current': 0,
184 'fetch_total': 0,
185 'fetch_time_in_millis': 0,
186 'fetch_current': 0,
187 'scroll_total': 0,
188 'scroll_time_in_millis': 0,
189 'scroll_current': 0,
190 'suggest_total': 0,
191 'suggest_time_in_millis': 0,
192 'suggest_current': 0
193 },
194 'merges': {
195 'current': 0,
196 'current_docs': 0,
197 'current_size_in_bytes': 0,
198 'total': 0,
199 'total_time_in_millis': 0,
200 'total_docs': 0,
201 'total_size_in_bytes': 0,
202 'total_stopped_time_in_millis': 0,
203 'total_throttled_time_in_millis': 0,
204 'total_auto_throttle_in_bytes': 104857600
205 },
206 'refresh': {
207 'total': 3,
208 'total_time_in_millis': 107
209 },
210 'flush': {
211 'total': 0,
212 'total_time_in_millis': 0
213 },
214 'warmer': {
215 'current': 0,
216 'total': 8,
217 'total_time_in_millis': 6
218 },
219 'query_cache': {
220 'memory_size_in_bytes': 0,
221 'total_count': 0,
222 'hit_count': 0,
223 'miss_count': 0,
224 'cache_size': 0,
225 'cache_count': 0,
226 'evictions': 0
227 },
228 'fielddata': {
229 'memory_size_in_bytes': 0,
230 'evictions': 0,
231 'fields': {
232 'group1': {
233 'memory_size_in_bytes': 1024
234 },
235 'group2': {
236 'memory_size_in_bytes': 2048
237 }
238 }
239 },
240 'completion': {
241 'size_in_bytes': 0
242 },
243 'segments': {
244 'count': 3,
245 'memory_in_bytes': 7908,
246 'terms_memory_in_bytes': 5976,
247 'stored_fields_memory_in_bytes': 936,
248 'term_vectors_memory_in_bytes': 0,
249 'norms_memory_in_bytes': 576,
250 'points_memory_in_bytes': 144,
251 'doc_values_memory_in_bytes': 276,
252 'index_writer_memory_in_bytes': 0,
253 'version_map_memory_in_bytes': 0,
254 'fixed_bit_set_memory_in_bytes': 0,
255 'max_unsafe_auto_id_timestamp': -1,
256 'file_sizes': {}
257 },
258 'translog': {
259 'operations': 3,
260 'size_in_bytes': 491
261 },
262 'request_cache': {
263 'memory_size_in_bytes': 0,
264 'evictions': 0,
265 'hit_count': 0,
266 'miss_count': 0
267 },
268 'recovery': {
269 'current_as_source': 0,
270 'current_as_target': 0,
271 'throttle_time_in_millis': 0
272 }
273 }
274 },
275 'indices': {
276 'foo': {
277 'primaries': {
278 'docs': {
279 'count': 3,
280 'deleted': 0
281 },
282 'store': {
283 'size_in_bytes': 12690,
284 'throttle_time_in_millis': 0
285 },
286 'indexing': {
287 'index_total': 3,
288 'index_time_in_millis': 45,
289 'index_current': 0,
290 'index_failed': 0,
291 'delete_total': 0,
292 'delete_time_in_millis': 0,
293 'delete_current': 0,
294 'noop_update_total': 0,
295 'is_throttled': False,
296 'throttle_time_in_millis': 0
297 },
298 'get': {
299 'total': 0,
300 'time_in_millis': 0,
301 'exists_total': 0,
302 'exists_time_in_millis': 0,
303 'missing_total': 0,
304 'missing_time_in_millis': 0,
305 'current': 0
306 },
307 'search': {
308 'open_contexts': 0,
309 'query_total': 0,
310 'query_time_in_millis': 0,
311 'query_current': 0,
312 'fetch_total': 0,
313 'fetch_time_in_millis': 0,
314 'fetch_current': 0,
315 'scroll_total': 0,
316 'scroll_time_in_millis': 0,
317 'scroll_current': 0,
318 'suggest_total': 0,
319 'suggest_time_in_millis': 0,
320 'suggest_current': 0
321 },
322 'merges': {
323 'current': 0,
324 'current_docs': 0,
325 'current_size_in_bytes': 0,
326 'total': 0,
327 'total_time_in_millis': 0,
328 'total_docs': 0,
329 'total_size_in_bytes': 0,
330 'total_stopped_time_in_millis': 0,
331 'total_throttled_time_in_millis': 0,
332 'total_auto_throttle_in_bytes': 104857600
333 },
334 'refresh': {
335 'total': 3,
336 'total_time_in_millis': 107
337 },
338 'flush': {
339 'total': 0,
340 'total_time_in_millis': 0
341 },
342 'warmer': {
343 'current': 0,
344 'total': 8,
345 'total_time_in_millis': 6
346 },
347 'query_cache': {
348 'memory_size_in_bytes': 0,
349 'total_count': 0,
350 'hit_count': 0,
351 'miss_count': 0,
352 'cache_size': 0,
353 'cache_count': 0,
354 'evictions': 0
355 },
356 'fielddata': {
357 'memory_size_in_bytes': 0,
358 'evictions': 0,
359 'fields': {
360 'group1': {
361 'memory_size_in_bytes': 1024
362 },
363 'group2': {
364 'memory_size_in_bytes': 2048
365 }
366 }
367 },
368 'completion': {
369 'size_in_bytes': 0
370 },
371 'segments': {
372 'count': 3,
373 'memory_in_bytes': 7908,
374 'terms_memory_in_bytes': 5976,
375 'stored_fields_memory_in_bytes': 936,
376 'term_vectors_memory_in_bytes': 0,
377 'norms_memory_in_bytes': 576,
378 'points_memory_in_bytes': 144,
379 'doc_values_memory_in_bytes': 276,
380 'index_writer_memory_in_bytes': 0,
381 'version_map_memory_in_bytes': 0,
382 'fixed_bit_set_memory_in_bytes': 0,
383 'max_unsafe_auto_id_timestamp': -1,
384 'file_sizes': {}
385 },
386 'translog': {
387 'operations': 3,
388 'size_in_bytes': 491
389 },
390 'request_cache': {
391 'memory_size_in_bytes': 0,
392 'evictions': 0,
393 'hit_count': 0,
394 'miss_count': 0
395 },
396 'recovery': {
397 'current_as_source': 0,
398 'current_as_target': 0,
399 'throttle_time_in_millis': 0
400 }
401 },
402 'total': {
403 'docs': {
404 'count': 3,
405 'deleted': 0
406 },
407 'store': {
408 'size_in_bytes': 12690,
409 'throttle_time_in_millis': 0
410 },
411 'indexing': {
412 'index_total': 3,
413 'index_time_in_millis': 45,
414 'index_current': 0,
415 'index_failed': 0,
416 'delete_total': 0,
417 'delete_time_in_millis': 0,
418 'delete_current': 0,
419 'noop_update_total': 0,
420 'is_throttled': False,
421 'throttle_time_in_millis': 0
422 },
423 'get': {
424 'total': 0,
425 'time_in_millis': 0,
426 'exists_total': 0,
427 'exists_time_in_millis': 0,
428 'missing_total': 0,
429 'missing_time_in_millis': 0,
430 'current': 0
431 },
432 'search': {
433 'open_contexts': 0,
434 'query_total': 0,
435 'query_time_in_millis': 0,
436 'query_current': 0,
437 'fetch_total': 0,
438 'fetch_time_in_millis': 0,
439 'fetch_current': 0,
440 'scroll_total': 0,
441 'scroll_time_in_millis': 0,
442 'scroll_current': 0,
443 'suggest_total': 0,
444 'suggest_time_in_millis': 0,
445 'suggest_current': 0
446 },
447 'merges': {
448 'current': 0,
449 'current_docs': 0,
450 'current_size_in_bytes': 0,
451 'total': 0,
452 'total_time_in_millis': 0,
453 'total_docs': 0,
454 'total_size_in_bytes': 0,
455 'total_stopped_time_in_millis': 0,
456 'total_throttled_time_in_millis': 0,
457 'total_auto_throttle_in_bytes': 104857600
458 },
459 'refresh': {
460 'total': 3,
461 'total_time_in_millis': 107
462 },
463 'flush': {
464 'total': 0,
465 'total_time_in_millis': 0
466 },
467 'warmer': {
468 'current': 0,
469 'total': 8,
470 'total_time_in_millis': 6
471 },
472 'query_cache': {
473 'memory_size_in_bytes': 0,
474 'total_count': 0,
475 'hit_count': 0,
476 'miss_count': 0,
477 'cache_size': 0,
478 'cache_count': 0,
479 'evictions': 0
480 },
481 'fielddata': {
482 'memory_size_in_bytes': 0,
483 'evictions': 0,
484 'fields': {
485 'group1': {
486 'memory_size_in_bytes': 1024
487 },
488 'group2': {
489 'memory_size_in_bytes': 2048
490 }
491 }
492 },
493 'completion': {
494 'size_in_bytes': 0
495 },
496 'segments': {
497 'count': 3,
498 'memory_in_bytes': 7908,
499 'terms_memory_in_bytes': 5976,
500 'stored_fields_memory_in_bytes': 936,
501 'term_vectors_memory_in_bytes': 0,
502 'norms_memory_in_bytes': 576,
503 'points_memory_in_bytes': 144,
504 'doc_values_memory_in_bytes': 276,
505 'index_writer_memory_in_bytes': 0,
506 'version_map_memory_in_bytes': 0,
507 'fixed_bit_set_memory_in_bytes': 0,
508 'max_unsafe_auto_id_timestamp': -1,
509 'file_sizes': {}
510 },
511 'translog': {
512 'operations': 3,
513 'size_in_bytes': 491
514 },
515 'request_cache': {
516 'memory_size_in_bytes': 0,
517 'evictions': 0,
518 'hit_count': 0,
519 'miss_count': 0
520 },
521 'recovery': {
522 'current_as_source': 0,
523 'current_as_target': 0,
524 'throttle_time_in_millis': 0
525 }
526 }
527 }
528 }
529 }
530
531 def test_endpoint_cluster(self):
532
533 expected = {
534 'primaries_docs_count{index="_all"}': 3,
535 'primaries_docs_deleted{index="_all"}': 0,
536 'primaries_store_size_in_bytes{index="_all"}': 12690,
537 'primaries_store_throttle_time_in_millis{index="_all"}': 0,
538 'primaries_indexing_index_total{index="_all"}': 3,
539 'primaries_indexing_index_time_in_millis{index="_all"}': 45,
540 'primaries_indexing_index_current{index="_all"}': 0,
541 'primaries_indexing_index_failed{index="_all"}': 0,
542 'primaries_indexing_delete_total{index="_all"}': 0,
543 'primaries_indexing_delete_time_in_millis{index="_all"}': 0,
544 'primaries_indexing_delete_current{index="_all"}': 0,
545 'primaries_indexing_noop_update_total{index="_all"}': 0,
546 'primaries_indexing_is_throttled{index="_all"}': 0,
547 'primaries_indexing_throttle_time_in_millis{index="_all"}': 0,
548 'primaries_get_total{index="_all"}': 0,
549 'primaries_get_time_in_millis{index="_all"}': 0,
550 'primaries_get_exists_total{index="_all"}': 0,
551 'primaries_get_exists_time_in_millis{index="_all"}': 0,
552 'primaries_get_missing_total{index="_all"}': 0,
553 'primaries_get_missing_time_in_millis{index="_all"}': 0,
554 'primaries_get_current{index="_all"}': 0,
555 'primaries_search_open_contexts{index="_all"}': 0,
556 'primaries_search_query_total{index="_all"}': 0,
557 'primaries_search_query_time_in_millis{index="_all"}': 0,
558 'primaries_search_query_current{index="_all"}': 0,
559 'primaries_search_fetch_total{index="_all"}': 0,
560 'primaries_search_fetch_time_in_millis{index="_all"}': 0,
561 'primaries_search_fetch_current{index="_all"}': 0,
562 'primaries_search_scroll_total{index="_all"}': 0,
563 'primaries_search_scroll_time_in_millis{index="_all"}': 0,
564 'primaries_search_scroll_current{index="_all"}': 0,
565 'primaries_search_suggest_total{index="_all"}': 0,
566 'primaries_search_suggest_time_in_millis{index="_all"}': 0,
567 'primaries_search_suggest_current{index="_all"}': 0,
568 'primaries_merges_current{index="_all"}': 0,
569 'primaries_merges_current_docs{index="_all"}': 0,
570 'primaries_merges_current_size_in_bytes{index="_all"}': 0,
571 'primaries_merges_total{index="_all"}': 0,
572 'primaries_merges_total_time_in_millis{index="_all"}': 0,
573 'primaries_merges_total_docs{index="_all"}': 0,
574 'primaries_merges_total_size_in_bytes{index="_all"}': 0,
575 'primaries_merges_total_stopped_time_in_millis{index="_all"}': 0,
576 'primaries_merges_total_throttled_time_in_millis{index="_all"}': 0,
577 'primaries_merges_total_auto_throttle_in_bytes{index="_all"}': 104857600,
578 'primaries_refresh_total{index="_all"}': 3,
579 'primaries_refresh_total_time_in_millis{index="_all"}': 107,
580 'primaries_flush_total{index="_all"}': 0,
581 'primaries_flush_total_time_in_millis{index="_all"}': 0,
582 'primaries_warmer_current{index="_all"}': 0,
583 'primaries_warmer_total{index="_all"}': 8,
584 'primaries_warmer_total_time_in_millis{index="_all"}': 6,
585 'primaries_query_cache_memory_size_in_bytes{index="_all"}': 0,
586 'primaries_query_cache_total_count{index="_all"}': 0,
587 'primaries_query_cache_hit_count{index="_all"}': 0,
588 'primaries_query_cache_miss_count{index="_all"}': 0,
589 'primaries_query_cache_cache_size{index="_all"}': 0,
590 'primaries_query_cache_cache_count{index="_all"}': 0,
591 'primaries_query_cache_evictions{index="_all"}': 0,
592 'primaries_fielddata_memory_size_in_bytes{index="_all"}': 0,
593 'primaries_fielddata_evictions{index="_all"}': 0,
594 'primaries_fielddata_fields_memory_size_in_bytes{index="_all",field="group1"}': 1024,
595 'primaries_fielddata_fields_memory_size_in_bytes{index="_all",field="group2"}': 2048,
596 'primaries_completion_size_in_bytes{index="_all"}': 0,
597 'primaries_segments_count{index="_all"}': 3,
598 'primaries_segments_memory_in_bytes{index="_all"}': 7908,
599 'primaries_segments_terms_memory_in_bytes{index="_all"}': 5976,
600 'primaries_segments_stored_fields_memory_in_bytes{index="_all"}': 936,
601 'primaries_segments_term_vectors_memory_in_bytes{index="_all"}': 0,
602 'primaries_segments_norms_memory_in_bytes{index="_all"}': 576,
603 'primaries_segments_points_memory_in_bytes{index="_all"}': 144,
604 'primaries_segments_doc_values_memory_in_bytes{index="_all"}': 276,
605 'primaries_segments_index_writer_memory_in_bytes{index="_all"}': 0,
606 'primaries_segments_version_map_memory_in_bytes{index="_all"}': 0,
607 'primaries_segments_fixed_bit_set_memory_in_bytes{index="_all"}': 0,
608 'primaries_segments_max_unsafe_auto_id_timestamp{index="_all"}': -1,
609 'primaries_translog_operations{index="_all"}': 3,
610 'primaries_translog_size_in_bytes{index="_all"}': 491,
611 'primaries_request_cache_memory_size_in_bytes{index="_all"}': 0,
612 'primaries_request_cache_evictions{index="_all"}': 0,
613 'primaries_request_cache_hit_count{index="_all"}': 0,
614 'primaries_request_cache_miss_count{index="_all"}': 0,
615 'primaries_recovery_current_as_source{index="_all"}': 0,
616 'primaries_recovery_current_as_target{index="_all"}': 0,
617 'primaries_recovery_throttle_time_in_millis{index="_all"}': 0,
618 'total_docs_count{index="_all"}': 3,
619 'total_docs_deleted{index="_all"}': 0,
620 'total_store_size_in_bytes{index="_all"}': 12690,
621 'total_store_throttle_time_in_millis{index="_all"}': 0,
622 'total_indexing_index_total{index="_all"}': 3,
623 'total_indexing_index_time_in_millis{index="_all"}': 45,
624 'total_indexing_index_current{index="_all"}': 0,
625 'total_indexing_index_failed{index="_all"}': 0,
626 'total_indexing_delete_total{index="_all"}': 0,
627 'total_indexing_delete_time_in_millis{index="_all"}': 0,
628 'total_indexing_delete_current{index="_all"}': 0,
629 'total_indexing_noop_update_total{index="_all"}': 0,
630 'total_indexing_is_throttled{index="_all"}': 0,
631 'total_indexing_throttle_time_in_millis{index="_all"}': 0,
632 'total_get_total{index="_all"}': 0,
633 'total_get_time_in_millis{index="_all"}': 0,
634 'total_get_exists_total{index="_all"}': 0,
635 'total_get_exists_time_in_millis{index="_all"}': 0,
636 'total_get_missing_total{index="_all"}': 0,
637 'total_get_missing_time_in_millis{index="_all"}': 0,
638 'total_get_current{index="_all"}': 0,
639 'total_search_open_contexts{index="_all"}': 0,
640 'total_search_query_total{index="_all"}': 0,
641 'total_search_query_time_in_millis{index="_all"}': 0,
642 'total_search_query_current{index="_all"}': 0,
643 'total_search_fetch_total{index="_all"}': 0,
644 'total_search_fetch_time_in_millis{index="_all"}': 0,
645 'total_search_fetch_current{index="_all"}': 0,
646 'total_search_scroll_total{index="_all"}': 0,
647 'total_search_scroll_time_in_millis{index="_all"}': 0,
648 'total_search_scroll_current{index="_all"}': 0,
649 'total_search_suggest_total{index="_all"}': 0,
650 'total_search_suggest_time_in_millis{index="_all"}': 0,
651 'total_search_suggest_current{index="_all"}': 0,
652 'total_merges_current{index="_all"}': 0,
653 'total_merges_current_docs{index="_all"}': 0,
654 'total_merges_current_size_in_bytes{index="_all"}': 0,
655 'total_merges_total{index="_all"}': 0,
656 'total_merges_total_time_in_millis{index="_all"}': 0,
657 'total_merges_total_docs{index="_all"}': 0,
658 'total_merges_total_size_in_bytes{index="_all"}': 0,
659 'total_merges_total_stopped_time_in_millis{index="_all"}': 0,
660 'total_merges_total_throttled_time_in_millis{index="_all"}': 0,
661 'total_merges_total_auto_throttle_in_bytes{index="_all"}': 104857600,
662 'total_refresh_total{index="_all"}': 3,
663 'total_refresh_total_time_in_millis{index="_all"}': 107,
664 'total_flush_total{index="_all"}': 0,
665 'total_flush_total_time_in_millis{index="_all"}': 0,
666 'total_warmer_current{index="_all"}': 0,
667 'total_warmer_total{index="_all"}': 8,
668 'total_warmer_total_time_in_millis{index="_all"}': 6,
669 'total_query_cache_memory_size_in_bytes{index="_all"}': 0,
670 'total_query_cache_total_count{index="_all"}': 0,
671 'total_query_cache_hit_count{index="_all"}': 0,
672 'total_query_cache_miss_count{index="_all"}': 0,
673 'total_query_cache_cache_size{index="_all"}': 0,
674 'total_query_cache_cache_count{index="_all"}': 0,
675 'total_query_cache_evictions{index="_all"}': 0,
676 'total_fielddata_memory_size_in_bytes{index="_all"}': 0,
677 'total_fielddata_evictions{index="_all"}': 0,
678 'total_fielddata_fields_memory_size_in_bytes{index="_all",field="group1"}': 1024,
679 'total_fielddata_fields_memory_size_in_bytes{index="_all",field="group2"}': 2048,
680 'total_completion_size_in_bytes{index="_all"}': 0,
681 'total_segments_count{index="_all"}': 3,
682 'total_segments_memory_in_bytes{index="_all"}': 7908,
683 'total_segments_terms_memory_in_bytes{index="_all"}': 5976,
684 'total_segments_stored_fields_memory_in_bytes{index="_all"}': 936,
685 'total_segments_term_vectors_memory_in_bytes{index="_all"}': 0,
686 'total_segments_norms_memory_in_bytes{index="_all"}': 576,
687 'total_segments_points_memory_in_bytes{index="_all"}': 144,
688 'total_segments_doc_values_memory_in_bytes{index="_all"}': 276,
689 'total_segments_index_writer_memory_in_bytes{index="_all"}': 0,
690 'total_segments_version_map_memory_in_bytes{index="_all"}': 0,
691 'total_segments_fixed_bit_set_memory_in_bytes{index="_all"}': 0,
692 'total_segments_max_unsafe_auto_id_timestamp{index="_all"}': -1,
693 'total_translog_operations{index="_all"}': 3,
694 'total_translog_size_in_bytes{index="_all"}': 491,
695 'total_request_cache_memory_size_in_bytes{index="_all"}': 0,
696 'total_request_cache_evictions{index="_all"}': 0,
697 'total_request_cache_hit_count{index="_all"}': 0,
698 'total_request_cache_miss_count{index="_all"}': 0,
699 'total_recovery_current_as_source{index="_all"}': 0,
700 'total_recovery_current_as_target{index="_all"}': 0,
701 'total_recovery_throttle_time_in_millis{index="_all"}': 0,
702 }
703 result = convert_result(parse_response(self.response, parse_indices=False))
704 self.assertEqual(expected, result)
705
706 def test_endpoint_indices(self):
707
708 expected = {
709 'primaries_docs_count{index="foo"}': 3,
710 'primaries_docs_deleted{index="foo"}': 0,
711 'primaries_store_size_in_bytes{index="foo"}': 12690,
712 'primaries_store_throttle_time_in_millis{index="foo"}': 0,
713 'primaries_indexing_index_total{index="foo"}': 3,
714 'primaries_indexing_index_time_in_millis{index="foo"}': 45,
715 'primaries_indexing_index_current{index="foo"}': 0,
716 'primaries_indexing_index_failed{index="foo"}': 0,
717 'primaries_indexing_delete_total{index="foo"}': 0,
718 'primaries_indexing_delete_time_in_millis{index="foo"}': 0,
719 'primaries_indexing_delete_current{index="foo"}': 0,
720 'primaries_indexing_noop_update_total{index="foo"}': 0,
721 'primaries_indexing_is_throttled{index="foo"}': 0,
722 'primaries_indexing_throttle_time_in_millis{index="foo"}': 0,
723 'primaries_get_total{index="foo"}': 0,
724 'primaries_get_time_in_millis{index="foo"}': 0,
725 'primaries_get_exists_total{index="foo"}': 0,
726 'primaries_get_exists_time_in_millis{index="foo"}': 0,
727 'primaries_get_missing_total{index="foo"}': 0,
728 'primaries_get_missing_time_in_millis{index="foo"}': 0,
729 'primaries_get_current{index="foo"}': 0,
730 'primaries_search_open_contexts{index="foo"}': 0,
731 'primaries_search_query_total{index="foo"}': 0,
732 'primaries_search_query_time_in_millis{index="foo"}': 0,
733 'primaries_search_query_current{index="foo"}': 0,
734 'primaries_search_fetch_total{index="foo"}': 0,
735 'primaries_search_fetch_time_in_millis{index="foo"}': 0,
736 'primaries_search_fetch_current{index="foo"}': 0,
737 'primaries_search_scroll_total{index="foo"}': 0,
738 'primaries_search_scroll_time_in_millis{index="foo"}': 0,
739 'primaries_search_scroll_current{index="foo"}': 0,
740 'primaries_search_suggest_total{index="foo"}': 0,
741 'primaries_search_suggest_time_in_millis{index="foo"}': 0,
742 'primaries_search_suggest_current{index="foo"}': 0,
743 'primaries_merges_current{index="foo"}': 0,
744 'primaries_merges_current_docs{index="foo"}': 0,
745 'primaries_merges_current_size_in_bytes{index="foo"}': 0,
746 'primaries_merges_total{index="foo"}': 0,
747 'primaries_merges_total_time_in_millis{index="foo"}': 0,
748 'primaries_merges_total_docs{index="foo"}': 0,
749 'primaries_merges_total_size_in_bytes{index="foo"}': 0,
750 'primaries_merges_total_stopped_time_in_millis{index="foo"}': 0,
751 'primaries_merges_total_throttled_time_in_millis{index="foo"}': 0,
752 'primaries_merges_total_auto_throttle_in_bytes{index="foo"}': 104857600,
753 'primaries_refresh_total{index="foo"}': 3,
754 'primaries_refresh_total_time_in_millis{index="foo"}': 107,
755 'primaries_flush_total{index="foo"}': 0,
756 'primaries_flush_total_time_in_millis{index="foo"}': 0,
757 'primaries_warmer_current{index="foo"}': 0,
758 'primaries_warmer_total{index="foo"}': 8,
759 'primaries_warmer_total_time_in_millis{index="foo"}': 6,
760 'primaries_query_cache_memory_size_in_bytes{index="foo"}': 0,
761 'primaries_query_cache_total_count{index="foo"}': 0,
762 'primaries_query_cache_hit_count{index="foo"}': 0,
763 'primaries_query_cache_miss_count{index="foo"}': 0,
764 'primaries_query_cache_cache_size{index="foo"}': 0,
765 'primaries_query_cache_cache_count{index="foo"}': 0,
766 'primaries_query_cache_evictions{index="foo"}': 0,
767 'primaries_fielddata_memory_size_in_bytes{index="foo"}': 0,
768 'primaries_fielddata_evictions{index="foo"}': 0,
769 'primaries_fielddata_fields_memory_size_in_bytes{index="foo",field="group1"}': 1024,
770 'primaries_fielddata_fields_memory_size_in_bytes{index="foo",field="group2"}': 2048,
771 'primaries_completion_size_in_bytes{index="foo"}': 0,
772 'primaries_segments_count{index="foo"}': 3,
773 'primaries_segments_memory_in_bytes{index="foo"}': 7908,
774 'primaries_segments_terms_memory_in_bytes{index="foo"}': 5976,
775 'primaries_segments_stored_fields_memory_in_bytes{index="foo"}': 936,
776 'primaries_segments_term_vectors_memory_in_bytes{index="foo"}': 0,
777 'primaries_segments_norms_memory_in_bytes{index="foo"}': 576,
778 'primaries_segments_points_memory_in_bytes{index="foo"}': 144,
779 'primaries_segments_doc_values_memory_in_bytes{index="foo"}': 276,
780 'primaries_segments_index_writer_memory_in_bytes{index="foo"}': 0,
781 'primaries_segments_version_map_memory_in_bytes{index="foo"}': 0,
782 'primaries_segments_fixed_bit_set_memory_in_bytes{index="foo"}': 0,
783 'primaries_segments_max_unsafe_auto_id_timestamp{index="foo"}': -1,
784 'primaries_translog_operations{index="foo"}': 3,
785 'primaries_translog_size_in_bytes{index="foo"}': 491,
786 'primaries_request_cache_memory_size_in_bytes{index="foo"}': 0,
787 'primaries_request_cache_evictions{index="foo"}': 0,
788 'primaries_request_cache_hit_count{index="foo"}': 0,
789 'primaries_request_cache_miss_count{index="foo"}': 0,
790 'primaries_recovery_current_as_source{index="foo"}': 0,
791 'primaries_recovery_current_as_target{index="foo"}': 0,
792 'primaries_recovery_throttle_time_in_millis{index="foo"}': 0,
793 'total_docs_count{index="foo"}': 3,
794 'total_docs_deleted{index="foo"}': 0,
795 'total_store_size_in_bytes{index="foo"}': 12690,
796 'total_store_throttle_time_in_millis{index="foo"}': 0,
797 'total_indexing_index_total{index="foo"}': 3,
798 'total_indexing_index_time_in_millis{index="foo"}': 45,
799 'total_indexing_index_current{index="foo"}': 0,
800 'total_indexing_index_failed{index="foo"}': 0,
801 'total_indexing_delete_total{index="foo"}': 0,
802 'total_indexing_delete_time_in_millis{index="foo"}': 0,
803 'total_indexing_delete_current{index="foo"}': 0,
804 'total_indexing_noop_update_total{index="foo"}': 0,
805 'total_indexing_is_throttled{index="foo"}': 0,
806 'total_indexing_throttle_time_in_millis{index="foo"}': 0,
807 'total_get_total{index="foo"}': 0,
808 'total_get_time_in_millis{index="foo"}': 0,
809 'total_get_exists_total{index="foo"}': 0,
810 'total_get_exists_time_in_millis{index="foo"}': 0,
811 'total_get_missing_total{index="foo"}': 0,
812 'total_get_missing_time_in_millis{index="foo"}': 0,
813 'total_get_current{index="foo"}': 0,
814 'total_search_open_contexts{index="foo"}': 0,
815 'total_search_query_total{index="foo"}': 0,
816 'total_search_query_time_in_millis{index="foo"}': 0,
817 'total_search_query_current{index="foo"}': 0,
818 'total_search_fetch_total{index="foo"}': 0,
819 'total_search_fetch_time_in_millis{index="foo"}': 0,
820 'total_search_fetch_current{index="foo"}': 0,
821 'total_search_scroll_total{index="foo"}': 0,
822 'total_search_scroll_time_in_millis{index="foo"}': 0,
823 'total_search_scroll_current{index="foo"}': 0,
824 'total_search_suggest_total{index="foo"}': 0,
825 'total_search_suggest_time_in_millis{index="foo"}': 0,
826 'total_search_suggest_current{index="foo"}': 0,
827 'total_merges_current{index="foo"}': 0,
828 'total_merges_current_docs{index="foo"}': 0,
829 'total_merges_current_size_in_bytes{index="foo"}': 0,
830 'total_merges_total{index="foo"}': 0,
831 'total_merges_total_time_in_millis{index="foo"}': 0,
832 'total_merges_total_docs{index="foo"}': 0,
833 'total_merges_total_size_in_bytes{index="foo"}': 0,
834 'total_merges_total_stopped_time_in_millis{index="foo"}': 0,
835 'total_merges_total_throttled_time_in_millis{index="foo"}': 0,
836 'total_merges_total_auto_throttle_in_bytes{index="foo"}': 104857600,
837 'total_refresh_total{index="foo"}': 3,
838 'total_refresh_total_time_in_millis{index="foo"}': 107,
839 'total_flush_total{index="foo"}': 0,
840 'total_flush_total_time_in_millis{index="foo"}': 0,
841 'total_warmer_current{index="foo"}': 0,
842 'total_warmer_total{index="foo"}': 8,
843 'total_warmer_total_time_in_millis{index="foo"}': 6,
844 'total_query_cache_memory_size_in_bytes{index="foo"}': 0,
845 'total_query_cache_total_count{index="foo"}': 0,
846 'total_query_cache_hit_count{index="foo"}': 0,
847 'total_query_cache_miss_count{index="foo"}': 0,
848 'total_query_cache_cache_size{index="foo"}': 0,
849 'total_query_cache_cache_count{index="foo"}': 0,
850 'total_query_cache_evictions{index="foo"}': 0,
851 'total_fielddata_memory_size_in_bytes{index="foo"}': 0,
852 'total_fielddata_evictions{index="foo"}': 0,
853 'total_fielddata_fields_memory_size_in_bytes{index="foo",field="group1"}': 1024,
854 'total_fielddata_fields_memory_size_in_bytes{index="foo",field="group2"}': 2048,
855 'total_completion_size_in_bytes{index="foo"}': 0,
856 'total_segments_count{index="foo"}': 3,
857 'total_segments_memory_in_bytes{index="foo"}': 7908,
858 'total_segments_terms_memory_in_bytes{index="foo"}': 5976,
859 'total_segments_stored_fields_memory_in_bytes{index="foo"}': 936,
860 'total_segments_term_vectors_memory_in_bytes{index="foo"}': 0,
861 'total_segments_norms_memory_in_bytes{index="foo"}': 576,
862 'total_segments_points_memory_in_bytes{index="foo"}': 144,
863 'total_segments_doc_values_memory_in_bytes{index="foo"}': 276,
864 'total_segments_index_writer_memory_in_bytes{index="foo"}': 0,
865 'total_segments_version_map_memory_in_bytes{index="foo"}': 0,
866 'total_segments_fixed_bit_set_memory_in_bytes{index="foo"}': 0,
867 'total_segments_max_unsafe_auto_id_timestamp{index="foo"}': -1,
868 'total_translog_operations{index="foo"}': 3,
869 'total_translog_size_in_bytes{index="foo"}': 491,
870 'total_request_cache_memory_size_in_bytes{index="foo"}': 0,
871 'total_request_cache_evictions{index="foo"}': 0,
872 'total_request_cache_hit_count{index="foo"}': 0,
873 'total_request_cache_miss_count{index="foo"}': 0,
874 'total_recovery_current_as_source{index="foo"}': 0,
875 'total_recovery_current_as_target{index="foo"}': 0,
876 'total_recovery_throttle_time_in_millis{index="foo"}': 0,
877 }
878 result = convert_result(parse_response(self.response, parse_indices=True))
879 self.assertEqual(expected, result)
880
881
882if __name__ == '__main__':
883 unittest.main()