Class: Fluent::Plugin::Metrics

Inherits:
Base
  • Object
show all
Includes:
Fluent::PluginId, Fluent::PluginLoggerMixin, UniqueId::Mixin
Defined in:
lib/fluent/plugin/metrics.rb

Direct Known Subclasses

LocalMetrics

Constant Summary collapse

DEFAULT_TYPE =
'local'

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary collapse

Attributes included from Fluent::PluginLoggerMixin

#log

Attributes inherited from Base

#under_plugin_development

Instance Method Summary collapse

Methods included from UniqueId::Mixin

#dump_unique_id_hex, #generate_unique_id

Methods included from Fluent::PluginLoggerMixin

included, #terminate

Methods included from Fluent::PluginId

#plugin_id, #plugin_id_configured?, #plugin_id_for_test?, #plugin_root_dir, #stop

Methods inherited from Base

#acquire_worker_lock, #after_shutdown, #after_shutdown?, #after_start, #after_started?, #before_shutdown, #before_shutdown?, #called_in_test?, #close, #closed?, #configured?, #context_router, #context_router=, #fluentd_worker_id, #get_lock_path, #has_router?, #inspect, #multi_workers_ready?, #plugin_root_dir, #reloadable_plugin?, #shutdown, #shutdown?, #start, #started?, #stop, #stopped?, #string_safe_encoding, #terminate, #terminated?

Methods included from SystemConfig::Mixin

#system_config, #system_config_override

Methods included from Configurable

#config, #configure_proxy_generate, #configured_section_create, included, lookup_type, register_type

Constructor Details

#initializeMetrics

Returns a new instance of Metrics.



42
43
44
45
46
47
48
# File 'lib/fluent/plugin/metrics.rb', line 42

def initialize
  super

  @has_methods_for_counter = false
  @has_methods_for_gauge = false
  @use_gauge_metric = false
end

Instance Attribute Details

#has_methods_for_counterObject (readonly)

Returns the value of attribute has_methods_for_counter.



40
41
42
# File 'lib/fluent/plugin/metrics.rb', line 40

def has_methods_for_counter
  @has_methods_for_counter
end

#has_methods_for_gaugeObject (readonly)

Returns the value of attribute has_methods_for_gauge.



40
41
42
# File 'lib/fluent/plugin/metrics.rb', line 40

def has_methods_for_gauge
  @has_methods_for_gauge
end

#use_gauge_metricObject

Returns the value of attribute use_gauge_metric.



39
40
41
# File 'lib/fluent/plugin/metrics.rb', line 39

def use_gauge_metric
  @use_gauge_metric
end

Instance Method Details

#add(value) ⇒ Object

Raises:

  • (NotImplementedError)


82
83
84
# File 'lib/fluent/plugin/metrics.rb', line 82

def add(value)
  raise NotImplementedError, "Implement this method in child class"
end

#configure(conf) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/fluent/plugin/metrics.rb', line 50

def configure(conf)
  super

  if use_gauge_metric
    @has_methods_for_gauge = has_methods_for_gauge?
  else
    @has_methods_for_counter = has_methods_for_counter?
  end
end

#create(namespace:, subsystem:, name:, help_text:, labels: {}) ⇒ Object



66
67
68
# File 'lib/fluent/plugin/metrics.rb', line 66

def create(namespace:, subsystem:,name:,help_text:,labels: {})
  # This API is for cmetrics type.
end

#decObject

Raises:

  • (NotImplementedError)


78
79
80
# File 'lib/fluent/plugin/metrics.rb', line 78

def dec
  raise NotImplementedError, "Implement this method in child class"
end

#getObject

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/fluent/plugin/metrics.rb', line 70

def get
  raise NotImplementedError, "Implement this method in child class"
end

#incObject

Raises:

  • (NotImplementedError)


74
75
76
# File 'lib/fluent/plugin/metrics.rb', line 74

def inc
  raise NotImplementedError, "Implement this method in child class"
end

#set(value) ⇒ Object

Raises:

  • (NotImplementedError)


90
91
92
# File 'lib/fluent/plugin/metrics.rb', line 90

def set(value)
  raise NotImplementedError, "Implement this method in child class"
end

#sub(value) ⇒ Object

Raises:

  • (NotImplementedError)


86
87
88
# File 'lib/fluent/plugin/metrics.rb', line 86

def sub(value)
  raise NotImplementedError, "Implement this method in child class"
end