Class: Bipbip::Plugin::Elasticsearch

Inherits:
Bipbip::Plugin show all
Defined in:
lib/bipbip/plugin/elasticsearch.rb

Instance Attribute Summary

Attributes inherited from Bipbip::Plugin

#config, #metric_group, #name, #pid

Instance Method Summary collapse

Methods inherited from Bipbip::Plugin

factory, #frequency, #initialize, #interrupt, #interrupted?, #metrics_names, #run, #source_identifier

Methods included from InterruptibleSleep

#interrupt_sleep, #interruptible_sleep

Constructor Details

This class inherits a constructor from Bipbip::Plugin

Instance Method Details

#metrics_schemaObject



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
# File 'lib/bipbip/plugin/elasticsearch.rb', line 9

def metrics_schema
  [
      {:name => 'store_size', :type => 'gauge', :unit => 'b'},
      {:name => 'docs_count', :type => 'gauge', :unit => 'Docs'},
      {:name => 'docs_deleted', :type => 'counter', :unit => 'Deleted'},
      {:name => 'segments_count', :type => 'gauge', :unit => 'Segments'},

      {:name => 'search_query_total', :type => 'counter', :unit => 'Queries'},
      {:name => 'search_query_time', :type => 'counter', :unit => 'Seconds'},
      {:name => 'search_fetch_total', :type => 'counter', :unit => 'Fetches'},
      {:name => 'search_fetch_time', :type => 'counter', :unit => 'Seconds'},

      {:name => 'get_total', :type => 'counter', :unit => 'Gets'},
      {:name => 'get_time', :type => 'counter', :unit => 'Seconds'},
      {:name => 'get_exists_total', :type => 'counter', :unit => 'Exists'},
      {:name => 'get_exists_time', :type => 'counter', :unit => 'Seconds'},
      {:name => 'get_missing_total', :type => 'counter', :unit => 'Missing'},
      {:name => 'get_missing_time', :type => 'counter', :unit => 'Seconds'},

      {:name => 'indexing_index_total', :type => 'counter', :unit => 'Indexes'},
      {:name => 'indexing_index_time', :type => 'counter', :unit => 'Seconds'},
      {:name => 'indexing_delete_total', :type => 'counter', :unit => 'Deletes'},
      {:name => 'indexing_delete_time', :type => 'counter', :unit => 'Seconds'},

      {:name => 'cache_filter_size', :type => 'gauge', :unit => 'b'},
      {:name => 'cache_filter_evictions', :type => 'gauge', :unit => 'b'},
      {:name => 'cache_field_size', :type => 'gauge', :unit => 'b'},
      {:name => 'cache_field_evictions', :type => 'gauge', :unit => 'b'},
  ]
end

#monitorObject



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
# File 'lib/bipbip/plugin/elasticsearch.rb', line 40

def monitor
  @stats = nil
  {
      'store_size' => stats_sum(['indices', 'store', 'size_in_bytes']),
      'docs_count' => stats_sum(['indices', 'docs', 'count']),
      'docs_deleted' => stats_sum(['indices', 'docs', 'deleted']),
      'segments_count' => stats_sum(['indices', 'segments', 'count']),

      'search_query_total' => stats_sum(['indices', 'search', 'query_total']),
      'search_query_time' => stats_sum(['indices', 'search', 'query_time_in_millis'])/1000,
      'search_fetch_total' => stats_sum(['indices', 'search', 'fetch_total']),
      'search_fetch_time' => stats_sum(['indices', 'search', 'fetch_time_in_millis'])/1000,

      'get_total' => stats_sum(['indices', 'get', 'total']),
      'get_time' => stats_sum(['indices', 'get', 'time_in_millis'])/1000,
      'get_exists_total' => stats_sum(['indices', 'get', 'exists_total']),
      'get_exists_time' => stats_sum(['indices', 'get', 'exists_time_in_millis'])/1000,
      'get_missing_total' => stats_sum(['indices', 'get', 'missing_total']),
      'get_missing_time' => stats_sum(['indices', 'get', 'missing_time_in_millis'])/1000,

      'indexing_index_total' => stats_sum(['indices', 'indexing', 'index_total']),
      'indexing_index_time' => stats_sum(['indices', 'indexing', 'index_time_in_millis'])/1000,
      'indexing_delete_total' => stats_sum(['indices', 'indexing', 'delete_total']),
      'indexing_delete_time' => stats_sum(['indices', 'indexing', 'delete_time_in_millis'])/1000,

      'cache_filter_size' => stats_sum(['indices', 'filter_cache', 'memory_size_in_bytes']),
      'cache_filter_evictions' => stats_sum(['indices', 'filter_cache', 'evictions']),
      'cache_field_size' => stats_sum(['indices', 'fielddata', 'memory_size_in_bytes']),
      'cache_field_evictions' => stats_sum(['indices', 'fielddata', 'evictions']),
  }
end