Class: Fluent::Plugin::BareOutput
Constant Summary
Configurable::CONFIG_TYPE_REGISTRY
Instance Attribute Summary
#log
Attributes inherited from Base
#under_plugin_development
Instance Method Summary
collapse
included, #terminate
#plugin_id, #plugin_id_configured?, #plugin_id_for_test?, #plugin_root_dir, #stop
included
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?
#system_config, #system_config_override
#config, #configure_proxy_generate, #configured_section_create, included, lookup_type, register_type
Constructor Details
Returns a new instance of BareOutput.
59
60
61
62
63
64
65
66
67
|
# File 'lib/fluent/plugin/bare_output.rb', line 59
def initialize
super
@counter_mutex = Mutex.new
@num_errors_metrics = nil
@emit_count_metrics = nil
@emit_records_metrics = nil
@emit_size_metrics = nil
end
|
Instance Method Details
69
70
71
72
73
74
75
76
77
|
# File 'lib/fluent/plugin/bare_output.rb', line 69
def configure(conf)
super
@num_errors_metrics = metrics_create(namespace: "fluentd", subsystem: "bare_output", name: "num_errors", help_text: "Number of count num errors")
@emit_count_metrics = metrics_create(namespace: "fluentd", subsystem: "bare_output", name: "emit_count", help_text: "Number of count emits")
@emit_records_metrics = metrics_create(namespace: "fluentd", subsystem: "bare_output", name: "emit_records", help_text: "Number of emit records")
@emit_size_metrics = metrics_create(namespace: "fluentd", subsystem: "bare_output", name: "emit_size", help_text: "Total size of emit events")
@enable_size_metrics = !!system_config.enable_size_metrics
end
|
#emit_count ⇒ Object
47
48
49
|
# File 'lib/fluent/plugin/bare_output.rb', line 47
def emit_count
@emit_count_metrics.get
end
|
#emit_records ⇒ Object
55
56
57
|
# File 'lib/fluent/plugin/bare_output.rb', line 55
def emit_records
@emit_records_metrics.get
end
|
#emit_size ⇒ Object
51
52
53
|
# File 'lib/fluent/plugin/bare_output.rb', line 51
def emit_size
@emit_size_metrics.get
end
|
#emit_sync(tag, es) ⇒ Object
Also known as:
emit_events
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/fluent/plugin/bare_output.rb', line 90
def emit_sync(tag, es)
@emit_count_metrics.inc
begin
process(tag, es)
@emit_records_metrics.add(es.size)
@emit_size_metrics.add(es.to_msgpack_stream.bytesize) if @enable_size_metrics
rescue
@num_errors_metrics.inc
raise
end
end
|
#num_errors ⇒ Object
43
44
45
|
# File 'lib/fluent/plugin/bare_output.rb', line 43
def num_errors
@num_errors_metrics.get
end
|
#process(tag, es) ⇒ Object
39
40
41
|
# File 'lib/fluent/plugin/bare_output.rb', line 39
def process(tag, es)
raise NotImplementedError, "BUG: output plugins MUST implement this method"
end
|
#statistics ⇒ Object
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/fluent/plugin/bare_output.rb', line 79
def statistics
stats = {
'num_errors' => @num_errors_metrics.get,
'emit_records' => @emit_records_metrics.get,
'emit_count' => @emit_count_metrics.get,
'emit_size' => @emit_size_metrics.get,
}
{ 'bare_output' => stats }
end
|