Class: Fluent::Plugin::ElasticsearchStats::NodesStatsData
- Defined in:
- lib/fluent/plugin/elasticsearch_stats/nodes_stats_data.rb
Constant Summary collapse
- NAME =
'nodes_stats'
Instance Attribute Summary
Attributes inherited from BaseData
Instance Method Summary collapse
Methods inherited from BaseData
Constructor Details
This class inherits a constructor from Fluent::Plugin::ElasticsearchStats::BaseData
Instance Method Details
#extract_metrics ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fluent/plugin/elasticsearch_stats/nodes_stats_data.rb', line 11 def extract_metrics metrics = [] nodes.each_value do |node_stats| .dup .set(label: 'hostname', value: node_stats['name']) .set(label: 'host', value: node_stats['host']) node_stats.each do |stat_family, stats| next unless stats.is_a?(Hash) stats.delete('timestamp') stats.delete('indices') if stat_family == 'indices' # FIXME: indices stats to extract ? flattened_stats = Utils.hash_flatten_keys(stats, separator: metric.name_separator) flattened_stats.each do |k, v| metrics << metric.format(name: ['node', stat_family, k], value: v, family: family, metadata: ) end end end metrics.compact end |