| import unittest |
| |
| from prometheus_es_exporter.indices_stats_parser import parse_response |
| from tests.utils import convert_result |
| |
| |
| # Sample responses generated by querying the endpoint on a Elasticsearch |
| # server populated with the following data (http command = Httpie utility): |
| # > http -v POST localhost:9200/foo/bar/1 val:=1 group1=a group2=a |
| # > http -v POST localhost:9200/foo/bar/2 val:=2 group1=a group2=b |
| # > http -v POST localhost:9200/foo/bar/3 val:=3 group1=b group2=b |
| # Some details are instance specific, so mileage may vary! |
| class Test(unittest.TestCase): |
| maxDiff = None |
| |
| # Endpoint: /_stats?pretty |
| response = { |
| '_shards': { |
| 'total': 10, |
| 'successful': 5, |
| 'failed': 0 |
| }, |
| '_all': { |
| 'primaries': { |
| 'docs': { |
| 'count': 3, |
| 'deleted': 0 |
| }, |
| 'store': { |
| 'size_in_bytes': 12690, |
| 'throttle_time_in_millis': 0 |
| }, |
| 'indexing': { |
| 'index_total': 3, |
| 'index_time_in_millis': 45, |
| 'index_current': 0, |
| 'index_failed': 0, |
| 'delete_total': 0, |
| 'delete_time_in_millis': 0, |
| 'delete_current': 0, |
| 'noop_update_total': 0, |
| 'is_throttled': False, |
| 'throttle_time_in_millis': 0 |
| }, |
| 'get': { |
| 'total': 0, |
| 'time_in_millis': 0, |
| 'exists_total': 0, |
| 'exists_time_in_millis': 0, |
| 'missing_total': 0, |
| 'missing_time_in_millis': 0, |
| 'current': 0 |
| }, |
| 'search': { |
| 'open_contexts': 0, |
| 'query_total': 0, |
| 'query_time_in_millis': 0, |
| 'query_current': 0, |
| 'fetch_total': 0, |
| 'fetch_time_in_millis': 0, |
| 'fetch_current': 0, |
| 'scroll_total': 0, |
| 'scroll_time_in_millis': 0, |
| 'scroll_current': 0, |
| 'suggest_total': 0, |
| 'suggest_time_in_millis': 0, |
| 'suggest_current': 0 |
| }, |
| 'merges': { |
| 'current': 0, |
| 'current_docs': 0, |
| 'current_size_in_bytes': 0, |
| 'total': 0, |
| 'total_time_in_millis': 0, |
| 'total_docs': 0, |
| 'total_size_in_bytes': 0, |
| 'total_stopped_time_in_millis': 0, |
| 'total_throttled_time_in_millis': 0, |
| 'total_auto_throttle_in_bytes': 104857600 |
| }, |
| 'refresh': { |
| 'total': 3, |
| 'total_time_in_millis': 107 |
| }, |
| 'flush': { |
| 'total': 0, |
| 'total_time_in_millis': 0 |
| }, |
| 'warmer': { |
| 'current': 0, |
| 'total': 8, |
| 'total_time_in_millis': 6 |
| }, |
| 'query_cache': { |
| 'memory_size_in_bytes': 0, |
| 'total_count': 0, |
| 'hit_count': 0, |
| 'miss_count': 0, |
| 'cache_size': 0, |
| 'cache_count': 0, |
| 'evictions': 0 |
| }, |
| 'fielddata': { |
| 'memory_size_in_bytes': 0, |
| 'evictions': 0, |
| 'fields': { |
| 'group1': { |
| 'memory_size_in_bytes': 1024 |
| }, |
| 'group2': { |
| 'memory_size_in_bytes': 2048 |
| } |
| } |
| }, |
| 'completion': { |
| 'size_in_bytes': 0 |
| }, |
| 'segments': { |
| 'count': 3, |
| 'memory_in_bytes': 7908, |
| 'terms_memory_in_bytes': 5976, |
| 'stored_fields_memory_in_bytes': 936, |
| 'term_vectors_memory_in_bytes': 0, |
| 'norms_memory_in_bytes': 576, |
| 'points_memory_in_bytes': 144, |
| 'doc_values_memory_in_bytes': 276, |
| 'index_writer_memory_in_bytes': 0, |
| 'version_map_memory_in_bytes': 0, |
| 'fixed_bit_set_memory_in_bytes': 0, |
| 'max_unsafe_auto_id_timestamp': -1, |
| 'file_sizes': {} |
| }, |
| 'translog': { |
| 'operations': 3, |
| 'size_in_bytes': 491 |
| }, |
| 'request_cache': { |
| 'memory_size_in_bytes': 0, |
| 'evictions': 0, |
| 'hit_count': 0, |
| 'miss_count': 0 |
| }, |
| 'recovery': { |
| 'current_as_source': 0, |
| 'current_as_target': 0, |
| 'throttle_time_in_millis': 0 |
| } |
| }, |
| 'total': { |
| 'docs': { |
| 'count': 3, |
| 'deleted': 0 |
| }, |
| 'store': { |
| 'size_in_bytes': 12690, |
| 'throttle_time_in_millis': 0 |
| }, |
| 'indexing': { |
| 'index_total': 3, |
| 'index_time_in_millis': 45, |
| 'index_current': 0, |
| 'index_failed': 0, |
| 'delete_total': 0, |
| 'delete_time_in_millis': 0, |
| 'delete_current': 0, |
| 'noop_update_total': 0, |
| 'is_throttled': False, |
| 'throttle_time_in_millis': 0 |
| }, |
| 'get': { |
| 'total': 0, |
| 'time_in_millis': 0, |
| 'exists_total': 0, |
| 'exists_time_in_millis': 0, |
| 'missing_total': 0, |
| 'missing_time_in_millis': 0, |
| 'current': 0 |
| }, |
| 'search': { |
| 'open_contexts': 0, |
| 'query_total': 0, |
| 'query_time_in_millis': 0, |
| 'query_current': 0, |
| 'fetch_total': 0, |
| 'fetch_time_in_millis': 0, |
| 'fetch_current': 0, |
| 'scroll_total': 0, |
| 'scroll_time_in_millis': 0, |
| 'scroll_current': 0, |
| 'suggest_total': 0, |
| 'suggest_time_in_millis': 0, |
| 'suggest_current': 0 |
| }, |
| 'merges': { |
| 'current': 0, |
| 'current_docs': 0, |
| 'current_size_in_bytes': 0, |
| 'total': 0, |
| 'total_time_in_millis': 0, |
| 'total_docs': 0, |
| 'total_size_in_bytes': 0, |
| 'total_stopped_time_in_millis': 0, |
| 'total_throttled_time_in_millis': 0, |
| 'total_auto_throttle_in_bytes': 104857600 |
| }, |
| 'refresh': { |
| 'total': 3, |
| 'total_time_in_millis': 107 |
| }, |
| 'flush': { |
| 'total': 0, |
| 'total_time_in_millis': 0 |
| }, |
| 'warmer': { |
| 'current': 0, |
| 'total': 8, |
| 'total_time_in_millis': 6 |
| }, |
| 'query_cache': { |
| 'memory_size_in_bytes': 0, |
| 'total_count': 0, |
| 'hit_count': 0, |
| 'miss_count': 0, |
| 'cache_size': 0, |
| 'cache_count': 0, |
| 'evictions': 0 |
| }, |
| 'fielddata': { |
| 'memory_size_in_bytes': 0, |
| 'evictions': 0, |
| 'fields': { |
| 'group1': { |
| 'memory_size_in_bytes': 1024 |
| }, |
| 'group2': { |
| 'memory_size_in_bytes': 2048 |
| } |
| } |
| }, |
| 'completion': { |
| 'size_in_bytes': 0 |
| }, |
| 'segments': { |
| 'count': 3, |
| 'memory_in_bytes': 7908, |
| 'terms_memory_in_bytes': 5976, |
| 'stored_fields_memory_in_bytes': 936, |
| 'term_vectors_memory_in_bytes': 0, |
| 'norms_memory_in_bytes': 576, |
| 'points_memory_in_bytes': 144, |
| 'doc_values_memory_in_bytes': 276, |
| 'index_writer_memory_in_bytes': 0, |
| 'version_map_memory_in_bytes': 0, |
| 'fixed_bit_set_memory_in_bytes': 0, |
| 'max_unsafe_auto_id_timestamp': -1, |
| 'file_sizes': {} |
| }, |
| 'translog': { |
| 'operations': 3, |
| 'size_in_bytes': 491 |
| }, |
| 'request_cache': { |
| 'memory_size_in_bytes': 0, |
| 'evictions': 0, |
| 'hit_count': 0, |
| 'miss_count': 0 |
| }, |
| 'recovery': { |
| 'current_as_source': 0, |
| 'current_as_target': 0, |
| 'throttle_time_in_millis': 0 |
| } |
| } |
| }, |
| 'indices': { |
| 'foo': { |
| 'primaries': { |
| 'docs': { |
| 'count': 3, |
| 'deleted': 0 |
| }, |
| 'store': { |
| 'size_in_bytes': 12690, |
| 'throttle_time_in_millis': 0 |
| }, |
| 'indexing': { |
| 'index_total': 3, |
| 'index_time_in_millis': 45, |
| 'index_current': 0, |
| 'index_failed': 0, |
| 'delete_total': 0, |
| 'delete_time_in_millis': 0, |
| 'delete_current': 0, |
| 'noop_update_total': 0, |
| 'is_throttled': False, |
| 'throttle_time_in_millis': 0 |
| }, |
| 'get': { |
| 'total': 0, |
| 'time_in_millis': 0, |
| 'exists_total': 0, |
| 'exists_time_in_millis': 0, |
| 'missing_total': 0, |
| 'missing_time_in_millis': 0, |
| 'current': 0 |
| }, |
| 'search': { |
| 'open_contexts': 0, |
| 'query_total': 0, |
| 'query_time_in_millis': 0, |
| 'query_current': 0, |
| 'fetch_total': 0, |
| 'fetch_time_in_millis': 0, |
| 'fetch_current': 0, |
| 'scroll_total': 0, |
| 'scroll_time_in_millis': 0, |
| 'scroll_current': 0, |
| 'suggest_total': 0, |
| 'suggest_time_in_millis': 0, |
| 'suggest_current': 0 |
| }, |
| 'merges': { |
| 'current': 0, |
| 'current_docs': 0, |
| 'current_size_in_bytes': 0, |
| 'total': 0, |
| 'total_time_in_millis': 0, |
| 'total_docs': 0, |
| 'total_size_in_bytes': 0, |
| 'total_stopped_time_in_millis': 0, |
| 'total_throttled_time_in_millis': 0, |
| 'total_auto_throttle_in_bytes': 104857600 |
| }, |
| 'refresh': { |
| 'total': 3, |
| 'total_time_in_millis': 107 |
| }, |
| 'flush': { |
| 'total': 0, |
| 'total_time_in_millis': 0 |
| }, |
| 'warmer': { |
| 'current': 0, |
| 'total': 8, |
| 'total_time_in_millis': 6 |
| }, |
| 'query_cache': { |
| 'memory_size_in_bytes': 0, |
| 'total_count': 0, |
| 'hit_count': 0, |
| 'miss_count': 0, |
| 'cache_size': 0, |
| 'cache_count': 0, |
| 'evictions': 0 |
| }, |
| 'fielddata': { |
| 'memory_size_in_bytes': 0, |
| 'evictions': 0, |
| 'fields': { |
| 'group1': { |
| 'memory_size_in_bytes': 1024 |
| }, |
| 'group2': { |
| 'memory_size_in_bytes': 2048 |
| } |
| } |
| }, |
| 'completion': { |
| 'size_in_bytes': 0 |
| }, |
| 'segments': { |
| 'count': 3, |
| 'memory_in_bytes': 7908, |
| 'terms_memory_in_bytes': 5976, |
| 'stored_fields_memory_in_bytes': 936, |
| 'term_vectors_memory_in_bytes': 0, |
| 'norms_memory_in_bytes': 576, |
| 'points_memory_in_bytes': 144, |
| 'doc_values_memory_in_bytes': 276, |
| 'index_writer_memory_in_bytes': 0, |
| 'version_map_memory_in_bytes': 0, |
| 'fixed_bit_set_memory_in_bytes': 0, |
| 'max_unsafe_auto_id_timestamp': -1, |
| 'file_sizes': {} |
| }, |
| 'translog': { |
| 'operations': 3, |
| 'size_in_bytes': 491 |
| }, |
| 'request_cache': { |
| 'memory_size_in_bytes': 0, |
| 'evictions': 0, |
| 'hit_count': 0, |
| 'miss_count': 0 |
| }, |
| 'recovery': { |
| 'current_as_source': 0, |
| 'current_as_target': 0, |
| 'throttle_time_in_millis': 0 |
| } |
| }, |
| 'total': { |
| 'docs': { |
| 'count': 3, |
| 'deleted': 0 |
| }, |
| 'store': { |
| 'size_in_bytes': 12690, |
| 'throttle_time_in_millis': 0 |
| }, |
| 'indexing': { |
| 'index_total': 3, |
| 'index_time_in_millis': 45, |
| 'index_current': 0, |
| 'index_failed': 0, |
| 'delete_total': 0, |
| 'delete_time_in_millis': 0, |
| 'delete_current': 0, |
| 'noop_update_total': 0, |
| 'is_throttled': False, |
| 'throttle_time_in_millis': 0 |
| }, |
| 'get': { |
| 'total': 0, |
| 'time_in_millis': 0, |
| 'exists_total': 0, |
| 'exists_time_in_millis': 0, |
| 'missing_total': 0, |
| 'missing_time_in_millis': 0, |
| 'current': 0 |
| }, |
| 'search': { |
| 'open_contexts': 0, |
| 'query_total': 0, |
| 'query_time_in_millis': 0, |
| 'query_current': 0, |
| 'fetch_total': 0, |
| 'fetch_time_in_millis': 0, |
| 'fetch_current': 0, |
| 'scroll_total': 0, |
| 'scroll_time_in_millis': 0, |
| 'scroll_current': 0, |
| 'suggest_total': 0, |
| 'suggest_time_in_millis': 0, |
| 'suggest_current': 0 |
| }, |
| 'merges': { |
| 'current': 0, |
| 'current_docs': 0, |
| 'current_size_in_bytes': 0, |
| 'total': 0, |
| 'total_time_in_millis': 0, |
| 'total_docs': 0, |
| 'total_size_in_bytes': 0, |
| 'total_stopped_time_in_millis': 0, |
| 'total_throttled_time_in_millis': 0, |
| 'total_auto_throttle_in_bytes': 104857600 |
| }, |
| 'refresh': { |
| 'total': 3, |
| 'total_time_in_millis': 107 |
| }, |
| 'flush': { |
| 'total': 0, |
| 'total_time_in_millis': 0 |
| }, |
| 'warmer': { |
| 'current': 0, |
| 'total': 8, |
| 'total_time_in_millis': 6 |
| }, |
| 'query_cache': { |
| 'memory_size_in_bytes': 0, |
| 'total_count': 0, |
| 'hit_count': 0, |
| 'miss_count': 0, |
| 'cache_size': 0, |
| 'cache_count': 0, |
| 'evictions': 0 |
| }, |
| 'fielddata': { |
| 'memory_size_in_bytes': 0, |
| 'evictions': 0, |
| 'fields': { |
| 'group1': { |
| 'memory_size_in_bytes': 1024 |
| }, |
| 'group2': { |
| 'memory_size_in_bytes': 2048 |
| } |
| } |
| }, |
| 'completion': { |
| 'size_in_bytes': 0 |
| }, |
| 'segments': { |
| 'count': 3, |
| 'memory_in_bytes': 7908, |
| 'terms_memory_in_bytes': 5976, |
| 'stored_fields_memory_in_bytes': 936, |
| 'term_vectors_memory_in_bytes': 0, |
| 'norms_memory_in_bytes': 576, |
| 'points_memory_in_bytes': 144, |
| 'doc_values_memory_in_bytes': 276, |
| 'index_writer_memory_in_bytes': 0, |
| 'version_map_memory_in_bytes': 0, |
| 'fixed_bit_set_memory_in_bytes': 0, |
| 'max_unsafe_auto_id_timestamp': -1, |
| 'file_sizes': {} |
| }, |
| 'translog': { |
| 'operations': 3, |
| 'size_in_bytes': 491 |
| }, |
| 'request_cache': { |
| 'memory_size_in_bytes': 0, |
| 'evictions': 0, |
| 'hit_count': 0, |
| 'miss_count': 0 |
| }, |
| 'recovery': { |
| 'current_as_source': 0, |
| 'current_as_target': 0, |
| 'throttle_time_in_millis': 0 |
| } |
| } |
| } |
| } |
| } |
| |
| def test_endpoint_cluster(self): |
| |
| expected = { |
| 'primaries_docs_count{index="_all"}': 3, |
| 'primaries_docs_deleted{index="_all"}': 0, |
| 'primaries_store_size_in_bytes{index="_all"}': 12690, |
| 'primaries_store_throttle_time_in_millis{index="_all"}': 0, |
| 'primaries_indexing_index_total{index="_all"}': 3, |
| 'primaries_indexing_index_time_in_millis{index="_all"}': 45, |
| 'primaries_indexing_index_current{index="_all"}': 0, |
| 'primaries_indexing_index_failed{index="_all"}': 0, |
| 'primaries_indexing_delete_total{index="_all"}': 0, |
| 'primaries_indexing_delete_time_in_millis{index="_all"}': 0, |
| 'primaries_indexing_delete_current{index="_all"}': 0, |
| 'primaries_indexing_noop_update_total{index="_all"}': 0, |
| 'primaries_indexing_is_throttled{index="_all"}': 0, |
| 'primaries_indexing_throttle_time_in_millis{index="_all"}': 0, |
| 'primaries_get_total{index="_all"}': 0, |
| 'primaries_get_time_in_millis{index="_all"}': 0, |
| 'primaries_get_exists_total{index="_all"}': 0, |
| 'primaries_get_exists_time_in_millis{index="_all"}': 0, |
| 'primaries_get_missing_total{index="_all"}': 0, |
| 'primaries_get_missing_time_in_millis{index="_all"}': 0, |
| 'primaries_get_current{index="_all"}': 0, |
| 'primaries_search_open_contexts{index="_all"}': 0, |
| 'primaries_search_query_total{index="_all"}': 0, |
| 'primaries_search_query_time_in_millis{index="_all"}': 0, |
| 'primaries_search_query_current{index="_all"}': 0, |
| 'primaries_search_fetch_total{index="_all"}': 0, |
| 'primaries_search_fetch_time_in_millis{index="_all"}': 0, |
| 'primaries_search_fetch_current{index="_all"}': 0, |
| 'primaries_search_scroll_total{index="_all"}': 0, |
| 'primaries_search_scroll_time_in_millis{index="_all"}': 0, |
| 'primaries_search_scroll_current{index="_all"}': 0, |
| 'primaries_search_suggest_total{index="_all"}': 0, |
| 'primaries_search_suggest_time_in_millis{index="_all"}': 0, |
| 'primaries_search_suggest_current{index="_all"}': 0, |
| 'primaries_merges_current{index="_all"}': 0, |
| 'primaries_merges_current_docs{index="_all"}': 0, |
| 'primaries_merges_current_size_in_bytes{index="_all"}': 0, |
| 'primaries_merges_total{index="_all"}': 0, |
| 'primaries_merges_total_time_in_millis{index="_all"}': 0, |
| 'primaries_merges_total_docs{index="_all"}': 0, |
| 'primaries_merges_total_size_in_bytes{index="_all"}': 0, |
| 'primaries_merges_total_stopped_time_in_millis{index="_all"}': 0, |
| 'primaries_merges_total_throttled_time_in_millis{index="_all"}': 0, |
| 'primaries_merges_total_auto_throttle_in_bytes{index="_all"}': 104857600, |
| 'primaries_refresh_total{index="_all"}': 3, |
| 'primaries_refresh_total_time_in_millis{index="_all"}': 107, |
| 'primaries_flush_total{index="_all"}': 0, |
| 'primaries_flush_total_time_in_millis{index="_all"}': 0, |
| 'primaries_warmer_current{index="_all"}': 0, |
| 'primaries_warmer_total{index="_all"}': 8, |
| 'primaries_warmer_total_time_in_millis{index="_all"}': 6, |
| 'primaries_query_cache_memory_size_in_bytes{index="_all"}': 0, |
| 'primaries_query_cache_total_count{index="_all"}': 0, |
| 'primaries_query_cache_hit_count{index="_all"}': 0, |
| 'primaries_query_cache_miss_count{index="_all"}': 0, |
| 'primaries_query_cache_cache_size{index="_all"}': 0, |
| 'primaries_query_cache_cache_count{index="_all"}': 0, |
| 'primaries_query_cache_evictions{index="_all"}': 0, |
| 'primaries_fielddata_memory_size_in_bytes{index="_all"}': 0, |
| 'primaries_fielddata_evictions{index="_all"}': 0, |
| 'primaries_fielddata_fields_memory_size_in_bytes{index="_all",field="group1"}': 1024, |
| 'primaries_fielddata_fields_memory_size_in_bytes{index="_all",field="group2"}': 2048, |
| 'primaries_completion_size_in_bytes{index="_all"}': 0, |
| 'primaries_segments_count{index="_all"}': 3, |
| 'primaries_segments_memory_in_bytes{index="_all"}': 7908, |
| 'primaries_segments_terms_memory_in_bytes{index="_all"}': 5976, |
| 'primaries_segments_stored_fields_memory_in_bytes{index="_all"}': 936, |
| 'primaries_segments_term_vectors_memory_in_bytes{index="_all"}': 0, |
| 'primaries_segments_norms_memory_in_bytes{index="_all"}': 576, |
| 'primaries_segments_points_memory_in_bytes{index="_all"}': 144, |
| 'primaries_segments_doc_values_memory_in_bytes{index="_all"}': 276, |
| 'primaries_segments_index_writer_memory_in_bytes{index="_all"}': 0, |
| 'primaries_segments_version_map_memory_in_bytes{index="_all"}': 0, |
| 'primaries_segments_fixed_bit_set_memory_in_bytes{index="_all"}': 0, |
| 'primaries_segments_max_unsafe_auto_id_timestamp{index="_all"}': -1, |
| 'primaries_translog_operations{index="_all"}': 3, |
| 'primaries_translog_size_in_bytes{index="_all"}': 491, |
| 'primaries_request_cache_memory_size_in_bytes{index="_all"}': 0, |
| 'primaries_request_cache_evictions{index="_all"}': 0, |
| 'primaries_request_cache_hit_count{index="_all"}': 0, |
| 'primaries_request_cache_miss_count{index="_all"}': 0, |
| 'primaries_recovery_current_as_source{index="_all"}': 0, |
| 'primaries_recovery_current_as_target{index="_all"}': 0, |
| 'primaries_recovery_throttle_time_in_millis{index="_all"}': 0, |
| 'total_docs_count{index="_all"}': 3, |
| 'total_docs_deleted{index="_all"}': 0, |
| 'total_store_size_in_bytes{index="_all"}': 12690, |
| 'total_store_throttle_time_in_millis{index="_all"}': 0, |
| 'total_indexing_index_total{index="_all"}': 3, |
| 'total_indexing_index_time_in_millis{index="_all"}': 45, |
| 'total_indexing_index_current{index="_all"}': 0, |
| 'total_indexing_index_failed{index="_all"}': 0, |
| 'total_indexing_delete_total{index="_all"}': 0, |
| 'total_indexing_delete_time_in_millis{index="_all"}': 0, |
| 'total_indexing_delete_current{index="_all"}': 0, |
| 'total_indexing_noop_update_total{index="_all"}': 0, |
| 'total_indexing_is_throttled{index="_all"}': 0, |
| 'total_indexing_throttle_time_in_millis{index="_all"}': 0, |
| 'total_get_total{index="_all"}': 0, |
| 'total_get_time_in_millis{index="_all"}': 0, |
| 'total_get_exists_total{index="_all"}': 0, |
| 'total_get_exists_time_in_millis{index="_all"}': 0, |
| 'total_get_missing_total{index="_all"}': 0, |
| 'total_get_missing_time_in_millis{index="_all"}': 0, |
| 'total_get_current{index="_all"}': 0, |
| 'total_search_open_contexts{index="_all"}': 0, |
| 'total_search_query_total{index="_all"}': 0, |
| 'total_search_query_time_in_millis{index="_all"}': 0, |
| 'total_search_query_current{index="_all"}': 0, |
| 'total_search_fetch_total{index="_all"}': 0, |
| 'total_search_fetch_time_in_millis{index="_all"}': 0, |
| 'total_search_fetch_current{index="_all"}': 0, |
| 'total_search_scroll_total{index="_all"}': 0, |
| 'total_search_scroll_time_in_millis{index="_all"}': 0, |
| 'total_search_scroll_current{index="_all"}': 0, |
| 'total_search_suggest_total{index="_all"}': 0, |
| 'total_search_suggest_time_in_millis{index="_all"}': 0, |
| 'total_search_suggest_current{index="_all"}': 0, |
| 'total_merges_current{index="_all"}': 0, |
| 'total_merges_current_docs{index="_all"}': 0, |
| 'total_merges_current_size_in_bytes{index="_all"}': 0, |
| 'total_merges_total{index="_all"}': 0, |
| 'total_merges_total_time_in_millis{index="_all"}': 0, |
| 'total_merges_total_docs{index="_all"}': 0, |
| 'total_merges_total_size_in_bytes{index="_all"}': 0, |
| 'total_merges_total_stopped_time_in_millis{index="_all"}': 0, |
| 'total_merges_total_throttled_time_in_millis{index="_all"}': 0, |
| 'total_merges_total_auto_throttle_in_bytes{index="_all"}': 104857600, |
| 'total_refresh_total{index="_all"}': 3, |
| 'total_refresh_total_time_in_millis{index="_all"}': 107, |
| 'total_flush_total{index="_all"}': 0, |
| 'total_flush_total_time_in_millis{index="_all"}': 0, |
| 'total_warmer_current{index="_all"}': 0, |
| 'total_warmer_total{index="_all"}': 8, |
| 'total_warmer_total_time_in_millis{index="_all"}': 6, |
| 'total_query_cache_memory_size_in_bytes{index="_all"}': 0, |
| 'total_query_cache_total_count{index="_all"}': 0, |
| 'total_query_cache_hit_count{index="_all"}': 0, |
| 'total_query_cache_miss_count{index="_all"}': 0, |
| 'total_query_cache_cache_size{index="_all"}': 0, |
| 'total_query_cache_cache_count{index="_all"}': 0, |
| 'total_query_cache_evictions{index="_all"}': 0, |
| 'total_fielddata_memory_size_in_bytes{index="_all"}': 0, |
| 'total_fielddata_evictions{index="_all"}': 0, |
| 'total_fielddata_fields_memory_size_in_bytes{index="_all",field="group1"}': 1024, |
| 'total_fielddata_fields_memory_size_in_bytes{index="_all",field="group2"}': 2048, |
| 'total_completion_size_in_bytes{index="_all"}': 0, |
| 'total_segments_count{index="_all"}': 3, |
| 'total_segments_memory_in_bytes{index="_all"}': 7908, |
| 'total_segments_terms_memory_in_bytes{index="_all"}': 5976, |
| 'total_segments_stored_fields_memory_in_bytes{index="_all"}': 936, |
| 'total_segments_term_vectors_memory_in_bytes{index="_all"}': 0, |
| 'total_segments_norms_memory_in_bytes{index="_all"}': 576, |
| 'total_segments_points_memory_in_bytes{index="_all"}': 144, |
| 'total_segments_doc_values_memory_in_bytes{index="_all"}': 276, |
| 'total_segments_index_writer_memory_in_bytes{index="_all"}': 0, |
| 'total_segments_version_map_memory_in_bytes{index="_all"}': 0, |
| 'total_segments_fixed_bit_set_memory_in_bytes{index="_all"}': 0, |
| 'total_segments_max_unsafe_auto_id_timestamp{index="_all"}': -1, |
| 'total_translog_operations{index="_all"}': 3, |
| 'total_translog_size_in_bytes{index="_all"}': 491, |
| 'total_request_cache_memory_size_in_bytes{index="_all"}': 0, |
| 'total_request_cache_evictions{index="_all"}': 0, |
| 'total_request_cache_hit_count{index="_all"}': 0, |
| 'total_request_cache_miss_count{index="_all"}': 0, |
| 'total_recovery_current_as_source{index="_all"}': 0, |
| 'total_recovery_current_as_target{index="_all"}': 0, |
| 'total_recovery_throttle_time_in_millis{index="_all"}': 0, |
| } |
| result = convert_result(parse_response(self.response, parse_indices=False)) |
| self.assertEqual(expected, result) |
| |
| def test_endpoint_indices(self): |
| |
| expected = { |
| 'primaries_docs_count{index="foo"}': 3, |
| 'primaries_docs_deleted{index="foo"}': 0, |
| 'primaries_store_size_in_bytes{index="foo"}': 12690, |
| 'primaries_store_throttle_time_in_millis{index="foo"}': 0, |
| 'primaries_indexing_index_total{index="foo"}': 3, |
| 'primaries_indexing_index_time_in_millis{index="foo"}': 45, |
| 'primaries_indexing_index_current{index="foo"}': 0, |
| 'primaries_indexing_index_failed{index="foo"}': 0, |
| 'primaries_indexing_delete_total{index="foo"}': 0, |
| 'primaries_indexing_delete_time_in_millis{index="foo"}': 0, |
| 'primaries_indexing_delete_current{index="foo"}': 0, |
| 'primaries_indexing_noop_update_total{index="foo"}': 0, |
| 'primaries_indexing_is_throttled{index="foo"}': 0, |
| 'primaries_indexing_throttle_time_in_millis{index="foo"}': 0, |
| 'primaries_get_total{index="foo"}': 0, |
| 'primaries_get_time_in_millis{index="foo"}': 0, |
| 'primaries_get_exists_total{index="foo"}': 0, |
| 'primaries_get_exists_time_in_millis{index="foo"}': 0, |
| 'primaries_get_missing_total{index="foo"}': 0, |
| 'primaries_get_missing_time_in_millis{index="foo"}': 0, |
| 'primaries_get_current{index="foo"}': 0, |
| 'primaries_search_open_contexts{index="foo"}': 0, |
| 'primaries_search_query_total{index="foo"}': 0, |
| 'primaries_search_query_time_in_millis{index="foo"}': 0, |
| 'primaries_search_query_current{index="foo"}': 0, |
| 'primaries_search_fetch_total{index="foo"}': 0, |
| 'primaries_search_fetch_time_in_millis{index="foo"}': 0, |
| 'primaries_search_fetch_current{index="foo"}': 0, |
| 'primaries_search_scroll_total{index="foo"}': 0, |
| 'primaries_search_scroll_time_in_millis{index="foo"}': 0, |
| 'primaries_search_scroll_current{index="foo"}': 0, |
| 'primaries_search_suggest_total{index="foo"}': 0, |
| 'primaries_search_suggest_time_in_millis{index="foo"}': 0, |
| 'primaries_search_suggest_current{index="foo"}': 0, |
| 'primaries_merges_current{index="foo"}': 0, |
| 'primaries_merges_current_docs{index="foo"}': 0, |
| 'primaries_merges_current_size_in_bytes{index="foo"}': 0, |
| 'primaries_merges_total{index="foo"}': 0, |
| 'primaries_merges_total_time_in_millis{index="foo"}': 0, |
| 'primaries_merges_total_docs{index="foo"}': 0, |
| 'primaries_merges_total_size_in_bytes{index="foo"}': 0, |
| 'primaries_merges_total_stopped_time_in_millis{index="foo"}': 0, |
| 'primaries_merges_total_throttled_time_in_millis{index="foo"}': 0, |
| 'primaries_merges_total_auto_throttle_in_bytes{index="foo"}': 104857600, |
| 'primaries_refresh_total{index="foo"}': 3, |
| 'primaries_refresh_total_time_in_millis{index="foo"}': 107, |
| 'primaries_flush_total{index="foo"}': 0, |
| 'primaries_flush_total_time_in_millis{index="foo"}': 0, |
| 'primaries_warmer_current{index="foo"}': 0, |
| 'primaries_warmer_total{index="foo"}': 8, |
| 'primaries_warmer_total_time_in_millis{index="foo"}': 6, |
| 'primaries_query_cache_memory_size_in_bytes{index="foo"}': 0, |
| 'primaries_query_cache_total_count{index="foo"}': 0, |
| 'primaries_query_cache_hit_count{index="foo"}': 0, |
| 'primaries_query_cache_miss_count{index="foo"}': 0, |
| 'primaries_query_cache_cache_size{index="foo"}': 0, |
| 'primaries_query_cache_cache_count{index="foo"}': 0, |
| 'primaries_query_cache_evictions{index="foo"}': 0, |
| 'primaries_fielddata_memory_size_in_bytes{index="foo"}': 0, |
| 'primaries_fielddata_evictions{index="foo"}': 0, |
| 'primaries_fielddata_fields_memory_size_in_bytes{index="foo",field="group1"}': 1024, |
| 'primaries_fielddata_fields_memory_size_in_bytes{index="foo",field="group2"}': 2048, |
| 'primaries_completion_size_in_bytes{index="foo"}': 0, |
| 'primaries_segments_count{index="foo"}': 3, |
| 'primaries_segments_memory_in_bytes{index="foo"}': 7908, |
| 'primaries_segments_terms_memory_in_bytes{index="foo"}': 5976, |
| 'primaries_segments_stored_fields_memory_in_bytes{index="foo"}': 936, |
| 'primaries_segments_term_vectors_memory_in_bytes{index="foo"}': 0, |
| 'primaries_segments_norms_memory_in_bytes{index="foo"}': 576, |
| 'primaries_segments_points_memory_in_bytes{index="foo"}': 144, |
| 'primaries_segments_doc_values_memory_in_bytes{index="foo"}': 276, |
| 'primaries_segments_index_writer_memory_in_bytes{index="foo"}': 0, |
| 'primaries_segments_version_map_memory_in_bytes{index="foo"}': 0, |
| 'primaries_segments_fixed_bit_set_memory_in_bytes{index="foo"}': 0, |
| 'primaries_segments_max_unsafe_auto_id_timestamp{index="foo"}': -1, |
| 'primaries_translog_operations{index="foo"}': 3, |
| 'primaries_translog_size_in_bytes{index="foo"}': 491, |
| 'primaries_request_cache_memory_size_in_bytes{index="foo"}': 0, |
| 'primaries_request_cache_evictions{index="foo"}': 0, |
| 'primaries_request_cache_hit_count{index="foo"}': 0, |
| 'primaries_request_cache_miss_count{index="foo"}': 0, |
| 'primaries_recovery_current_as_source{index="foo"}': 0, |
| 'primaries_recovery_current_as_target{index="foo"}': 0, |
| 'primaries_recovery_throttle_time_in_millis{index="foo"}': 0, |
| 'total_docs_count{index="foo"}': 3, |
| 'total_docs_deleted{index="foo"}': 0, |
| 'total_store_size_in_bytes{index="foo"}': 12690, |
| 'total_store_throttle_time_in_millis{index="foo"}': 0, |
| 'total_indexing_index_total{index="foo"}': 3, |
| 'total_indexing_index_time_in_millis{index="foo"}': 45, |
| 'total_indexing_index_current{index="foo"}': 0, |
| 'total_indexing_index_failed{index="foo"}': 0, |
| 'total_indexing_delete_total{index="foo"}': 0, |
| 'total_indexing_delete_time_in_millis{index="foo"}': 0, |
| 'total_indexing_delete_current{index="foo"}': 0, |
| 'total_indexing_noop_update_total{index="foo"}': 0, |
| 'total_indexing_is_throttled{index="foo"}': 0, |
| 'total_indexing_throttle_time_in_millis{index="foo"}': 0, |
| 'total_get_total{index="foo"}': 0, |
| 'total_get_time_in_millis{index="foo"}': 0, |
| 'total_get_exists_total{index="foo"}': 0, |
| 'total_get_exists_time_in_millis{index="foo"}': 0, |
| 'total_get_missing_total{index="foo"}': 0, |
| 'total_get_missing_time_in_millis{index="foo"}': 0, |
| 'total_get_current{index="foo"}': 0, |
| 'total_search_open_contexts{index="foo"}': 0, |
| 'total_search_query_total{index="foo"}': 0, |
| 'total_search_query_time_in_millis{index="foo"}': 0, |
| 'total_search_query_current{index="foo"}': 0, |
| 'total_search_fetch_total{index="foo"}': 0, |
| 'total_search_fetch_time_in_millis{index="foo"}': 0, |
| 'total_search_fetch_current{index="foo"}': 0, |
| 'total_search_scroll_total{index="foo"}': 0, |
| 'total_search_scroll_time_in_millis{index="foo"}': 0, |
| 'total_search_scroll_current{index="foo"}': 0, |
| 'total_search_suggest_total{index="foo"}': 0, |
| 'total_search_suggest_time_in_millis{index="foo"}': 0, |
| 'total_search_suggest_current{index="foo"}': 0, |
| 'total_merges_current{index="foo"}': 0, |
| 'total_merges_current_docs{index="foo"}': 0, |
| 'total_merges_current_size_in_bytes{index="foo"}': 0, |
| 'total_merges_total{index="foo"}': 0, |
| 'total_merges_total_time_in_millis{index="foo"}': 0, |
| 'total_merges_total_docs{index="foo"}': 0, |
| 'total_merges_total_size_in_bytes{index="foo"}': 0, |
| 'total_merges_total_stopped_time_in_millis{index="foo"}': 0, |
| 'total_merges_total_throttled_time_in_millis{index="foo"}': 0, |
| 'total_merges_total_auto_throttle_in_bytes{index="foo"}': 104857600, |
| 'total_refresh_total{index="foo"}': 3, |
| 'total_refresh_total_time_in_millis{index="foo"}': 107, |
| 'total_flush_total{index="foo"}': 0, |
| 'total_flush_total_time_in_millis{index="foo"}': 0, |
| 'total_warmer_current{index="foo"}': 0, |
| 'total_warmer_total{index="foo"}': 8, |
| 'total_warmer_total_time_in_millis{index="foo"}': 6, |
| 'total_query_cache_memory_size_in_bytes{index="foo"}': 0, |
| 'total_query_cache_total_count{index="foo"}': 0, |
| 'total_query_cache_hit_count{index="foo"}': 0, |
| 'total_query_cache_miss_count{index="foo"}': 0, |
| 'total_query_cache_cache_size{index="foo"}': 0, |
| 'total_query_cache_cache_count{index="foo"}': 0, |
| 'total_query_cache_evictions{index="foo"}': 0, |
| 'total_fielddata_memory_size_in_bytes{index="foo"}': 0, |
| 'total_fielddata_evictions{index="foo"}': 0, |
| 'total_fielddata_fields_memory_size_in_bytes{index="foo",field="group1"}': 1024, |
| 'total_fielddata_fields_memory_size_in_bytes{index="foo",field="group2"}': 2048, |
| 'total_completion_size_in_bytes{index="foo"}': 0, |
| 'total_segments_count{index="foo"}': 3, |
| 'total_segments_memory_in_bytes{index="foo"}': 7908, |
| 'total_segments_terms_memory_in_bytes{index="foo"}': 5976, |
| 'total_segments_stored_fields_memory_in_bytes{index="foo"}': 936, |
| 'total_segments_term_vectors_memory_in_bytes{index="foo"}': 0, |
| 'total_segments_norms_memory_in_bytes{index="foo"}': 576, |
| 'total_segments_points_memory_in_bytes{index="foo"}': 144, |
| 'total_segments_doc_values_memory_in_bytes{index="foo"}': 276, |
| 'total_segments_index_writer_memory_in_bytes{index="foo"}': 0, |
| 'total_segments_version_map_memory_in_bytes{index="foo"}': 0, |
| 'total_segments_fixed_bit_set_memory_in_bytes{index="foo"}': 0, |
| 'total_segments_max_unsafe_auto_id_timestamp{index="foo"}': -1, |
| 'total_translog_operations{index="foo"}': 3, |
| 'total_translog_size_in_bytes{index="foo"}': 491, |
| 'total_request_cache_memory_size_in_bytes{index="foo"}': 0, |
| 'total_request_cache_evictions{index="foo"}': 0, |
| 'total_request_cache_hit_count{index="foo"}': 0, |
| 'total_request_cache_miss_count{index="foo"}': 0, |
| 'total_recovery_current_as_source{index="foo"}': 0, |
| 'total_recovery_current_as_target{index="foo"}': 0, |
| 'total_recovery_throttle_time_in_millis{index="foo"}': 0, |
| } |
| result = convert_result(parse_response(self.response, parse_indices=True)) |
| self.assertEqual(expected, result) |
| |
| |
| if __name__ == '__main__': |
| unittest.main() |